Live data from Hacker News

25 Years of PHP

jetbrains.com

251–260 of 426 posts

Re: 25 Years of PHP

#251

Earlier quoted context omitted.

You're moving the goalposts. PHP was a great option in 1995. It is not today (except as a basic scripting language, where you and I agree completely. I would use PHP as soon as my bash script gets to about 100 lines). Your post here is arguing about 1995 or whatever. The post I replied to was full of present-tense about "just use the good parts" and "all languages have issues", etc.

Not just moving the goalposts, but actually programming PHP 14 years before it first appeared in 1995, and putting database-driven websites on the web 8 years before it was invented in 1989. His post here is arguing about 1981, actually. >I’ll admit to a soft spot for PHP - I was putting database-driven websites on the web when that wasn’t much of a thing (back in 1981, if foggy memory recalls true). I wrote the asse…

As I replied above, my maths was off.

For what it's worth, I started using PHP at Oyster Partners (then Oyster Systems). We did the London Metal Exchange, Swiss Bank, Euromoney and all it's sister magazines. When I joined Oyster, it was 3 people and it ran off a dual-link ISDN line... These days the company has been subsumed into a much larger business worth several million, but Luke still runs that business.

I left Oyster after a couple of years (then 50-strong) to set up my own business in 1998 with an angel investor - the business that Apple eventually bought, and the wayback machine puts us on the web in 2001, which makes sense - we spent a couple of years writing the app before it went public.

The link to the wayback machine site is https://web.archive.org/web/20010501133322/http://www.tea-an...

Re: 25 Years of PHP

#252

Earlier quoted context omitted.

> This revisionist stance that there was never anything really wrong with PHP This strikes me as a strawman. PHP spent years being a generally loathed language for reasons that at this point aren't really worth reiterating. But, in an analog to Javascript, it has made progress, grown up and become a better language. One of the best? Like Javascript, no. But serviceable at worst. I stopped earnest work in PHP ~ 5.7. I…

Javascript has made progress too. While far from perfect and I think PHP's journey started at a worse point has has gone further JS certainly is a lot better now and the major failings of JS are of it's ecosystem and not the language itself. I also think that both JS and PHP get a lot of flak for maintaining backwards compat as far back as they do. You can run a lot of webapps (frontend and backend) from 10-20 years…

> Javascript has made progress too.

To be clear, this is what I was saying when I called upon it as an analog.

Re: 25 Years of PHP

#253

Earlier quoted context omitted.

Yup. My bad. I started trying to figure out when it was by when I was at college, how long I did the PhD for, how long I was in the first job, how long into the second job I started using it and I screwed up the maths along the way. It was in 1996, not 1981... No excuses, that's just bad.

You also said you wrote the asset management system that was used by Lucasfilm on Star Wars, which was released in 1977. Are you sure you don't mean one of the later J. J. Abrams films, and not the film whose title was actually "Star Wars"? Mistakes about dates and context aside, I still can't believe you're actually trying to make excuses for mysql_real_escape_string. It has the word "real" in it. I mean, come on, w…

Well, it was episode I, which of course was the 4th film.

Re: 25 Years of PHP

#254
post #29

I started with PHP 15 years ago, but after 5 years I just moved to Java. The worst thing with PHP was people and standards, everything was a mess, there was no right way to do stuff and larger projects had like 100 different implementations for the same thing. PHP was really challenging to work with as coming to a shared agreement for how one should implement stuff was a recipe for personal conflicts. So after a few…

> A completely different, but much more enjoyable environment and much more friendly people. You must have found a neat subculture in Java - not been my experience at all. The "shared agreement" thing - I've moved between multiple Java environments over the years, and there's never any agreement between companies on the 'right' way to do Java. Open communities in Java - I've often felt they require a huge amount of t…

All communities are defensive, when someone comes in with "this is shit, why can't I do it like I do it in X".

Are you not aware of the flamewars between RoR and Enterprise Java people, when RoR was being pushed into the enterprise?

Re: 25 Years of PHP

#255

Earlier quoted context omitted.

Stop looking at the syntax, then. PHP semantics almost completely match Java's- single inheritance, no const, everything is a reference, effectively no top-level functions, etc. And in what way is it actually less verbose? It's almost identical to Java...

As in defined outside of any class, object, or interface? PHP has a million of those and people write their own that way all the time. Everything is certainly not a reference and constants exist. Are you just talking about some narrow subset of PHP used in some frameworks?

I feel like your reply needs a little more context. Is the first part of responding to my claim of "effectively no top level functions"? If so, my response is that no public code seems to use them and they're much more of a pain in the butt to use because the PSR-whatever autoloader stuff only picks up classes. It's way more idiomatic to write static methods on a class- exactly like Java.

"Everything" is a reference as in "every instantiated class". Again, exactly like Java. Java has primitives. Any data type YOU write is a reference.

PHP is almost exactly Java 7, but with better null handling and way worse containers.

Re: 25 Years of PHP

#256
post #225

Earlier quoted context omitted.

Link me to those edge cases please, I did not hit that many so I should be prepared. Thanks.

Here's some that are utterly trivial to find. There are plenty more. Feel free, as a supposedly competent PHP programmer, to go and find the rest, becayse you definitely need to know about them to be able to write code that's going to work properly. Moved the examples to a gist due to HN formatting: https://gist.github.com/wjessop/0923e0667d7dd53ae0503459894e...

This gotchas are similar to JS or Python ones. I hit more issues related to php configuration or server configuration then language issues, maybe because I use a good IDE that will prevent such trivial bugs.

Re: 25 Years of PHP

#257
post #32

I wrote a lot of PHP from 1999-2008. First as a hobby, then professionally. From 20 LOC guestbooks to payment gateways used to process millions in payments. It wasn't until recently that I was sure I'd written more code in any other language than PHP. These days I'll occasionally poke around with it or patch a bug, but that's about it. Is it a perfect language? No. But which language is? (I can hear the Lisp crowd gr…

While I agree that PHP does have pros as well as cons, I find it disconcerting that I've read MANY assertions here on HN, that PHP detractors just haven't used it very much or are mostly complaining about things like bad standard library function names. I've used PHP in earnest. It and JavaScript are tied for worst programming languages I've used. JavaScript gets more of a "pass" from me because I'm just not a dynami…

> Keys are sometimes strings, sometimes ints. And you don't always know which it is!

Could you give an example? Because I've never had any issues with it and find it very predictable.

> The fact that you can't typehint everywhere also sucks.

Type-hinting is being implemented and is already available in most places. But why you'd expect that in a dynamically typed language is beyond me.

> No generics sucks.

Again, dynamic language.

> No threads sucks.

pthreads has been considered stable since early 2014: https://pecl.php.net/package/pthreads

> Globals suck

Are you talking about "register_globals" which had its default setting changed to "off" 18 years ago and was completely removed 8 years ago: https://www.php.net/manual/en/security.globals.php ?

> But is that because PHP did anything useful, or because Apache and Nginx support PHP out of the box?

Do they? Last I checked you had to install and enable support for PHP just like anything else. Unless you're talking about bundles like MAMP, but then it doesn't really make much sense.

You may claim that you've used PHP in earnest, but I honestly find that a little hard to believe when seeing these claims. And I don't mean that I expect you to understand all the little edge-cases of type-coercion, but if you'd really needed threads I'm sure you'd have stumbled upon pthreads, and if you've been using globals, then you've been following some oooooold guides.

Re: 25 Years of PHP

#258
post #32

I wrote a lot of PHP from 1999-2008. First as a hobby, then professionally. From 20 LOC guestbooks to payment gateways used to process millions in payments. It wasn't until recently that I was sure I'd written more code in any other language than PHP. These days I'll occasionally poke around with it or patch a bug, but that's about it. Is it a perfect language? No. But which language is? (I can hear the Lisp crowd gr…

> It has a very rich standard library Yet I still have to define startsWith() and endsWith() any time I touch PHP code... (More importantly, PHP is the one language I can never write from memory without referencing the manual for each and every function call because of how inconsistent it is. Eg Sometimes $haystack is the first parameter and sometimes it is $needle.)

This is my problem with PHP. Python for instance has it's own issues, but after coding in Python for awhile I can just guess the interface of various methods etc and be correct almost all of the time. PHP in comparison is so egregiously inconsistent that I have to reference documentation constantly. Python, Go and even Javascript are light years beyond PHP quality-wise (I'm comparing to those 3 languages because they're the ones I use daily right now).

Re: 25 Years of PHP

#259

Earlier quoted context omitted.

You also said you wrote the asset management system that was used by Lucasfilm on Star Wars, which was released in 1977. Are you sure you don't mean one of the later J. J. Abrams films, and not the film whose title was actually "Star Wars"? Mistakes about dates and context aside, I still can't believe you're actually trying to make excuses for mysql_real_escape_string. It has the word "real" in it. I mean, come on, w…

Well, it was episode I, which of course was the 4th film.

It's not which verion of Star Wars you worked on in what year, it's that you're choosing to defend mysql_real_escape_string, and the culture that produced and maintained and evangelized it.

What you've so brilliantly and unwittingly illustrated here is that PEOPLE MAKE MISTAKES. And that contradicts your argument that attempts to shift the blame for PHP's footguns like mysql_real_escape_string onto "crappy coders" instead of the culture and designers of PHP itself. People love to use that argument the self-aggrandize themselves, claiming they're too smart to make those mistakes, and only crappy inexperienced coders do that, so it's not a problem.

But PHP has always been widely evangelized to inexperienced coders, foot-guns and all.

Yes it DOES make a difference if a language is full of foot-guns, and the culture and developers around it don't give a shit (and don't bother running tests before checking in buggy changes to crypto functions before making a release) because they think they're too hot-shot to aim the foot-guns they designed and loaded at their own feet, then go around evangelizing their language to inexperienced crappy programmers.

https://www.php.net/archive/2011.php#id2011-08-22-1

5.3.7 upgrade warning

[22-Aug-2011]

Due to unfortunate issues with 5.3.7 (see bug#55439) users should postpone upgrading until 5.3.8 is released (expected in a few days).

https://bugs.php.net/bug.php?id=55439

Bug #55439 crypt() returns only the salt for MD5

https://news.ycombinator.com/item?id=2912678

Do not upgrade to PHP 5.3.7 due to a bug in crypt() (php.net)

https://news.ycombinator.com/item?id=2913310

dramaticus3 on Aug 22, 2011 | parent | favorite | on: Do not upgrade to PHP 5.3.7 due to a bug in crypt(...

Get ready for some WTF-ery Crypt takes an optional salt. If that value is an MD5 hash it is prefixed with the chars $1$ to tell the underlying crypt(3) function to use Modular Crypt Format[1]. MCF is an ad-hoc cruft because the orginal crypt() is weak.

Anyway guess who did it :

"let's use strlcpy/strlcat instead for these static string copies" - Rasmus I guess that's Lerdorf himself

Whoever it was also didn't check the return values for error. Strlcat returns the length of the new string which might not be the same as strlen(dst) + strlen(src).

"I'm not a real programmer. I throw together things until it works then I move on." - Rasmus Lerdorf

Here's where he broke it : Sun Aug 7 16:10:34 2011 UTC http://svn.php.net/viewvc/php/php-src/trunk/ext/standard/php...

Here's it being fixed : Fri Aug 19 22:49:18 2011 UTC http://svn.php.net/viewvc/php/php-src/trunk/ext/standard/php...

[1] http://packages.python.org/passlib/modular_crypt_format.html

rll on Aug 22, 2011 [–]

If you have never broken anything you have probably never built anything.

dramaticus3 on Aug 22, 2011 [–]

The project leader. Tests, I'm in charge, I don't test.

dangrossman on Aug 22, 2011 [–]

This code had a unit test, and it failed after the change as expected:

http://gcov.php.net/viewer.php?version=PHP_5_3&func=tests&fi...

Re: 25 Years of PHP

#260
post #121

While I don't use PHP today, it always makes me wonder at deceptively easy it is to deploy a PHP app. There's no having to worry about restarting processes since the next request picks up the code changes and deploying at scale has so many problems auto-solved by that such as rolling restarts. You can then handle things like percent based feature roll outs at the application level which is likely where it belongs any…

>There's no having to worry about restarting processes since the next request picks up the code changes and deploying at scale has so many problems auto-solved by that such as rolling restarts. Nearly any serious PHP deployment will use an opcode cache which has to be invalidated, though maybe they are smart enough to do that from the filesystem now. >On the flip side, for single server deploys, you can also get by w…

> Nearly any serious PHP deployment will use an opcode cache which has to be invalidated, though maybe they are smart enough to do that from the filesystem now.

Etsy has a massive PHP deployment. In one of their talks they mentioned one of the main perks of using PHP is they can just drop code onto a server and be done with it. They are operating at pretty crazy scale. Even deploying to hundreds of servers can happen very very quickly since you don't need to step through a tiered rolling restart.

> You want incremental rollout essentially every time you change code; if you feature flagged every single change, you'd have your codebase's entire history all hanging out on master, with far too many possible combinations of feature flags to ever test.

Often times you want to restrict features or certain things based on business logic in your app, not just a "dumb" load balancer. For example, you might want to enable new things for specific users who opt into a beta program or maybe only staff to start. But it could also be to a % of users. Usually the idea is to feature flag bigger things and once it's rolled out fully you remove the flag and now it's just something that exists all the time. Of course this depends on your organization tho.

Post reply on HN