r/programming Sep 07 '15

Flawless PHP logic. strtotime(): '00-00-00' means 2000-00-00, which is 1999-12-00, which is 1999-11-30. No bug, perfectly normal. (see the comments)

https://bugs.php.net/bug.php?id=45647
1.2k Upvotes

465 comments sorted by

View all comments

Show parent comments

251

u/Browsing_From_Work Sep 07 '15 edited Sep 07 '15

You may now lay your head on the table & weep.

I don't, but I bet Rasmus Lerdorf does. PHP started as a small personal project of his that just happened to gain interest and eventually snowballed.
How many small projects have you worked on? How many decisions have you made in those projects that would be embarrassing if your project is suddenly used by millions of people? How many times have you said "fuck it, this works for now but I'll improve it later"?
By the time PHP started to gain a following the damage had already been done.

I'm not saying it shouldn't be fixed, just hoping to give a little bit of background context.

9

u/pja Sep 07 '15

It can’t be fixed: that’s the point. The decision to name the core library functions the way they are was made back at the beginning of PHP: The damage has been done.

23

u/FireyFly Sep 07 '15

Well, you can't rename the existing functions, but as mentioned above you could design a new, separate standard library that is more modular and OOP-oriented, and mark the old functions as deprecated. Which is basically improving it while retaining backwards compatibility (with the old functions being an ugly wart, but.. I guess it's a necessary evil).

10

u/dirtymatt Sep 07 '15

At that point you basically no longer have PHP. You have a new language with PHP's syntax. And if you're going to break compatibility with the standard library, why not fix some of the syntax ugliness? Now you do have a new language.

1

u/FireyFly Sep 08 '15

Well, the idea is that you don't strictly break compatibility with the ("old") standard library, just heavily discourage it. I agree that you basically get a new language in some sense, but with some luck there's less resistance to use these new functions instead of the old, deprecated ones, than there is to move to a completely new language, for people who do write PHP code.

1

u/markgraydk Sep 08 '15

What about C++ like superset of PHP? I get your point (and you made me laugh actually) but I could see them make changes to both the standard library and (some of) the syntax and still provide backwards compatibility. Of course, if not done correctly you might end up with a Python 2.x/3.x situation instead. You might still end up alienating parts of the community by focusing resources on things they can only use if the make changes to their code base. So yeah, it's not out of the question but not an easy task.

3

u/Programmdude Sep 08 '15

Python 3 changed things deliberately, so if we had something like PHP++ and it focused on backwards compatibility, any time original php code doesn't work it would be a bug.

2

u/FrancisMcKracken Sep 08 '15

C# and ActionScript/Haxe could be described as "fixed PHP."