Live data from Hacker News

PHP 7 Released

github.com

111–120 of 317 posts

Re: PHP 7 Released

#112

Earlier quoted context omitted.

"My experience with hosting PHP apps has historicity been one of fending off security issues" Unfortunately PHP seems to have this reputation. It's not so much the language that is the problem but the people using it. PHP typically had such a low bar to entry that literally anyone could pick it up and do anything and everything with it. And quite frankly there were (and still are) a lot of beginner tutorials out ther…

Not the language? PHP is the only lasting language where making code that allows SQL injection is easier than code that forbids it. PHP includes all the worst practices you'll find on any languages. Javascript has the eval problem - PHP has it too; Perl have the too fluid type system where you can't specify anything - PHP too, except that it lacks Perl's tainted mode; Asp made it easier to create code subject to XSS…

> PHP is the only lasting language where making code that allows SQL injection is easier than code that forbids it.

Pretty sure this is true for any language, the key difference is education. When learning JDBC for example, you're taught to use prepared statements with params vs. string concatenation.

Re: PHP 7 Released

#113
post #105

Earlier quoted context omitted.

Mainly how easy it is to have zero clue that you're doing something horrible (SQL performance wise). Not positive that's what parent meant, but that's my guess.

AR works nicely for simple basic queries but everything more advanced should be done with custom queries. That helps a lot :)

The issue is that the line between simple and advanced is blurry, especially for an inexperienced developer.

Maybe someday we (Royal we of all software engineers who build tools other engineers use) will learn there's a limit to abstraction layers applicability and put hard breaks into the code when that happens.

I guess one shouldn't complain, the more tools allow developers to shoot themselves in the foot and not feel the pain until the leg needs to be cut off, the more variety of positions that will be open for engineers who've been there done that.

Re: PHP 7 Released

#114
post #101
post #63

Earlier quoted context omitted.

> I urged him to switch to a sane framework like Laravel ...why didn't you taught him about PDO, so he can start with something more universal, not tied to one particular framework that happens to be popular nowadays?! Then he can learn whichever OR/DM or DAL he might like need (Eloquent, Doctrine, Redbean, IdiORM/Paris etc.), and also be able to pop the hood and debug it when needed. I never get it why so many other…

I could've done that but that wouldn't have taught the same things. PDO is awesome but requires deeper level of understanding (for a beginner), which may increase the frustration and may end up returning back to the mysql_query and co. It's easier point to framework that's already using PDO and and making sane defaults and solving bootstrapping problems. Once you've learned bunch of new concepts like ORM in one frame…

Agree, then again there are different types of people.

Some wants to learn from bottom up(analytic approach), others want to see cool stuff then tweak, modify, replace to find the limits (holistic approach).

IIRC there is a tendency that young people prefer the holistic approach while teachers either are selected for or grow into preferring the analytical approach.

Re: PHP 7 Released

#115

I wish every PHP developer would reread the docs and start using new features available instead of just continuing with what they know already just because it works. And of course if there was any way to remove all those old tutorials out there.

And every php developer would wish that suddenly all php in the world upgrades to v7. We are years away from 7 having a big penetration in the ecosystem. And years more till it hits enterprise.

I interview a lot of php-devs, and a very large proportion of PHP shops are still on 5.4 or earlier (which is all EOL). Very often they are not at all aware of the new features in 5.5 and later.

CodeIgniter is still popular and a lot of developers have no clue about namespaces and composer usage. It will really take a _long while_ before php7 becomes commonplace.

Re: PHP 7 Released

#116
post #101
post #63

Earlier quoted context omitted.

> I urged him to switch to a sane framework like Laravel ...why didn't you taught him about PDO, so he can start with something more universal, not tied to one particular framework that happens to be popular nowadays?! Then he can learn whichever OR/DM or DAL he might like need (Eloquent, Doctrine, Redbean, IdiORM/Paris etc.), and also be able to pop the hood and debug it when needed. I never get it why so many other…

I could've done that but that wouldn't have taught the same things. PDO is awesome but requires deeper level of understanding (for a beginner), which may increase the frustration and may end up returning back to the mysql_query and co. It's easier point to framework that's already using PDO and and making sane defaults and solving bootstrapping problems. Once you've learned bunch of new concepts like ORM in one frame…

> PDO is awesome but requires deeper level of understanding (for a beginner), which may increase the frustration and may end up returning back to the mysql_query and co.

Yeah, that's basically why I wrote EasyDB. https://github.com/paragonie/easydb

    $rows = $db->run('SELECT * FROM comments WHERE blogpostid = ? ORDER BY created ASC', $_GET['blogpostid']);
    foreach ($rows as $row) {
        // etc
    }
Teach people to do things this way rather than concatenate strings, say goodbye to SQL injection vulnerabilities.

Re: PHP 7 Released

#117
I haven't worked with PHP in quite some time now but I am happy to see its still kicking. Although it does bring back some haunting memories from versions 3 and 4.

Re: PHP 7 Released

#118

The performance improvements in this release will hopefully encourage people to upgrade, even if the new features don't. Common PHP applications run 70%-100% faster on PHP 7 than they did on PHP 5.6, comparable with or better than HHVM.

The performance increase is what I'm looking forward to most with 7. I can't wait to see how several of my code-heavy WordPress installations do with 7. From the benchmarks I've seen, it's going to be incredible.

Specifically, I'm hoping the page load times will be cut in half.

Re: PHP 7 Released

#119
post #42
post #11

Earlier quoted context omitted.

Please explain why.

http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

Yes, quote a blog post from NEARLY FOUR YEARS AGO that mostly consists of "I don't like the way this thing is so therefore it's wrong" + "This is a problem that was fixed in a later iteration of PHP" to justify why PHP 7 is bad.

One thing I like about PHP 7 is that they had an opportunity to say "Fuck BC" and chose to use this version change to obsolete the shitty tutorials that make bad programmers (mysql_*).

Re: PHP 7 Released

#120
post #20

As a person with more of an ops background can someone explain to me why / when PHP might be a viable language? My experience with hosting PHP apps has historicity been one of fending off security issues and I think that often in the past PHP was often a language for designers that didn't have experienced programming skills, it feels like designers have now shifted to using Node for this?

It depends on whats being hosted. If you're dealing with legacy apps that were built in the PHP 5.2 or even PHP 4 days, be afraid. Be very afraid. If you're dealing with more mainstream PHP apps like WordPress or Magento, its important to stay up on the core updates but also monitor the plugins and templates being installed. The majority of the attack surface on those apps is in the plugins because they're almost nev…

> legacy apps that were built in the PHP 5.2 or even PHP 4 days, be afraid. Be very afraid

BS. Most PHP4 code runs just fine, as do PHP5 code. Almost no one used object oriented code in PHP4 days (it was slow!), so the incompatible changes aren't a problem. And all you need to do is to search and replace some function names like mysql_* to mysqli_*. Most old code bases from PHP4 days also didn't rely on frameworks at all and were completely written from scratch or copy&pasted together - actually an advantage in this case.

Upgrading an old Python or Ruby code from 1.x/2.x days is a lot of more work (as it always includes upgrading to a recent framework version) than upgrading from PHP4 or PHP5 to PHP7.

Post reply on HN