subreddit stringclasses 7
values | author stringlengths 3 20 | id stringlengths 5 7 | content stringlengths 67 30.4k | score int64 0 140k |
|---|---|---|---|---|
lolphp | porkslow | 81enf9 | <|sols|><|sot|>WordPress overrides all PHP superglobals by adding magic quotes<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/74cb5936fc8be8314b55f3240740553f4fc4075b/wp-includes/load.php#L712<|eol|><|eols|><|endoftext|> | 51 |
lolphp | cfreak2399 | dv2qlm9 | <|sols|><|sot|>WordPress overrides all PHP superglobals by adding magic quotes<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/74cb5936fc8be8314b55f3240740553f4fc4075b/wp-includes/load.php#L712<|eol|><|sor|>Despite this being LOL-Wordpress, Wordpress might as well be PHP since that's what most PHP websites run.
This is some really big WTF. At first I thought it wasn't that bad, make sure PHP's laughably bad magic quotes are off and add their own sanitation. Misnamed but not terrible.
BUT ... Investigation into `add_magic_quotes` ... literally calls `addslashes()`. Good lord they could have at least made it perform better by not removing all the slashes first if magic quotes was already on!
Terrible security and bad performance. It's so beautiful it brings a tear to my eye.<|eor|><|eols|><|endoftext|> | 27 |
lolphp | Brandon0 | dv2v993 | <|sols|><|sot|>WordPress overrides all PHP superglobals by adding magic quotes<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/74cb5936fc8be8314b55f3240740553f4fc4075b/wp-includes/load.php#L712<|eol|><|sor|>Despite this being LOL-Wordpress, Wordpress might as well be PHP since that's what most PHP websites run.
This is some really big WTF. At first I thought it wasn't that bad, make sure PHP's laughably bad magic quotes are off and add their own sanitation. Misnamed but not terrible.
BUT ... Investigation into `add_magic_quotes` ... literally calls `addslashes()`. Good lord they could have at least made it perform better by not removing all the slashes first if magic quotes was already on!
Terrible security and bad performance. It's so beautiful it brings a tear to my eye.<|eor|><|sor|>Their justification for all of this is really just as silly as you would expect:
> WordPress ignores the built in php magic quotes setting and the value of get_magic_quotes_gpc() and will always add magic quotes (even after the feature is removed from PHP in 5.4).
> WordPress does this because too much core and plugin code has come to rely on the quotes being there, so disabling quotes on the super globals (as is done in both the "Basic Example" and "Good Coding Practice" examples above) is likely to cause security holes.
https://codex.wordpress.org/Function_Reference/stripslashes_deep<|eor|><|eols|><|endoftext|> | 20 |
lolphp | chewitt | dv35cdc | <|sols|><|sot|>WordPress overrides all PHP superglobals by adding magic quotes<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/74cb5936fc8be8314b55f3240740553f4fc4075b/wp-includes/load.php#L712<|eol|><|sor|>Despite this being LOL-Wordpress, Wordpress might as well be PHP since that's what most PHP websites run.
This is some really big WTF. At first I thought it wasn't that bad, make sure PHP's laughably bad magic quotes are off and add their own sanitation. Misnamed but not terrible.
BUT ... Investigation into `add_magic_quotes` ... literally calls `addslashes()`. Good lord they could have at least made it perform better by not removing all the slashes first if magic quotes was already on!
Terrible security and bad performance. It's so beautiful it brings a tear to my eye.<|eor|><|sor|>Their justification for all of this is really just as silly as you would expect:
> WordPress ignores the built in php magic quotes setting and the value of get_magic_quotes_gpc() and will always add magic quotes (even after the feature is removed from PHP in 5.4).
> WordPress does this because too much core and plugin code has come to rely on the quotes being there, so disabling quotes on the super globals (as is done in both the "Basic Example" and "Good Coding Practice" examples above) is likely to cause security holes.
https://codex.wordpress.org/Function_Reference/stripslashes_deep<|eor|><|sor|>Note: Using our "Good Coding Practice" example is likely to cause security holes.
-Wordpress<|eor|><|eols|><|endoftext|> | 20 |
lolphp | geggleto | dv3wdvj | <|sols|><|sot|>WordPress overrides all PHP superglobals by adding magic quotes<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/74cb5936fc8be8314b55f3240740553f4fc4075b/wp-includes/load.php#L712<|eol|><|sor|>Despite this being LOL-Wordpress, Wordpress might as well be PHP since that's what most PHP websites run.
This is some really big WTF. At first I thought it wasn't that bad, make sure PHP's laughably bad magic quotes are off and add their own sanitation. Misnamed but not terrible.
BUT ... Investigation into `add_magic_quotes` ... literally calls `addslashes()`. Good lord they could have at least made it perform better by not removing all the slashes first if magic quotes was already on!
Terrible security and bad performance. It's so beautiful it brings a tear to my eye.<|eor|><|sor|>Their justification for all of this is really just as silly as you would expect:
> WordPress ignores the built in php magic quotes setting and the value of get_magic_quotes_gpc() and will always add magic quotes (even after the feature is removed from PHP in 5.4).
> WordPress does this because too much core and plugin code has come to rely on the quotes being there, so disabling quotes on the super globals (as is done in both the "Basic Example" and "Good Coding Practice" examples above) is likely to cause security holes.
https://codex.wordpress.org/Function_Reference/stripslashes_deep<|eor|><|sor|>Wow! This is true lolphp.
Its quite remarkable how bad a language really can be. I have no idea why you would pick PHP in 2018 as your tech stack.<|eor|><|sor|>You can do crap with every language, although some languages will prevent you from doing so. Why would you pick C today over something like java or go/rust/lolcode? If you pick your tech stack just by the fact that more mature techniques are old and useless, I rather would not like to maintain your projects...<|eor|><|sor|>Well C definitely has its place and use. Its low level and its literally in every OS out there. Even poor old PHP is built with it.
PHP on the other hand is a niche (crappy) language. Its only (99.99%) used for websites. For this task there is countless better options. PHP was relevant back in the late 90s to early 2000s when the web was mostly static, with some forms and some database for storing posted data.
There is really no reason to choose PHP today, unless you want to deal with all its mindbending lols. The fact that this subreddit exists tells a lot. <|eor|><|sor|>There are only 2 types of languages that exist.
One where no-one uses it and the other where people complain constantly about it.<|eor|><|eols|><|endoftext|> | 13 |
lolphp | beerdude26 | dv386k0 | <|sols|><|sot|>WordPress overrides all PHP superglobals by adding magic quotes<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/74cb5936fc8be8314b55f3240740553f4fc4075b/wp-includes/load.php#L712<|eol|><|sor|>Despite this being LOL-Wordpress, Wordpress might as well be PHP since that's what most PHP websites run.
This is some really big WTF. At first I thought it wasn't that bad, make sure PHP's laughably bad magic quotes are off and add their own sanitation. Misnamed but not terrible.
BUT ... Investigation into `add_magic_quotes` ... literally calls `addslashes()`. Good lord they could have at least made it perform better by not removing all the slashes first if magic quotes was already on!
Terrible security and bad performance. It's so beautiful it brings a tear to my eye.<|eor|><|sor|>Their justification for all of this is really just as silly as you would expect:
> WordPress ignores the built in php magic quotes setting and the value of get_magic_quotes_gpc() and will always add magic quotes (even after the feature is removed from PHP in 5.4).
> WordPress does this because too much core and plugin code has come to rely on the quotes being there, so disabling quotes on the super globals (as is done in both the "Basic Example" and "Good Coding Practice" examples above) is likely to cause security holes.
https://codex.wordpress.org/Function_Reference/stripslashes_deep<|eor|><|sor|>Wow! This is true lolphp.
Its quite remarkable how bad a language really can be. I have no idea why you would pick PHP in 2018 as your tech stack.<|eor|><|sor|>You can do crap with every language, although some languages will prevent you from doing so. Why would you pick C today over something like java or go/rust/lolcode? If you pick your tech stack just by the fact that more mature techniques are old and useless, I rather would not like to maintain your projects...<|eor|><|sor|>Well C definitely has its place and use. Its low level and its literally in every OS out there. Even poor old PHP is built with it.
PHP on the other hand is a niche (crappy) language. Its only (99.99%) used for websites. For this task there is countless better options. PHP was relevant back in the late 90s to early 2000s when the web was mostly static, with some forms and some database for storing posted data.
There is really no reason to choose PHP today, unless you want to deal with all its mindbending lols. The fact that this subreddit exists tells a lot. <|eor|><|sor|>Sure the language has many flaws. It has its very own style and solutions but it this serves its purpose.
With the help of the community and companies like facebook it has proofed as usable.
I simply believe that adapting every hyped new technology does not help alot for big and longrunning projects.<|eor|><|sor|>>With the help of the community and companies like facebook it has proofed as usable.
Facebook wrote its own compiler in OCaml for PHP that had a lot more type security and was JITed to C++-like performant code. And now they've said their custom language will break from PHP entirely.
10 years ago? Yeah. Now? Nope.<|eor|><|eols|><|endoftext|> | 10 |
lolphp | cfreak2399 | dv6hqj6 | <|sols|><|sot|>WordPress overrides all PHP superglobals by adding magic quotes<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/74cb5936fc8be8314b55f3240740553f4fc4075b/wp-includes/load.php#L712<|eol|><|sor|>Despite this being LOL-Wordpress, Wordpress might as well be PHP since that's what most PHP websites run.
This is some really big WTF. At first I thought it wasn't that bad, make sure PHP's laughably bad magic quotes are off and add their own sanitation. Misnamed but not terrible.
BUT ... Investigation into `add_magic_quotes` ... literally calls `addslashes()`. Good lord they could have at least made it perform better by not removing all the slashes first if magic quotes was already on!
Terrible security and bad performance. It's so beautiful it brings a tear to my eye.<|eor|><|sor|>Can anyone dumb that down for me? I only have a very light grasp on PHP (thank goodness?).<|eor|><|sor|>By default PHP used to escape all incoming strings by simply adding `\` to "unsafe" characters. For many reasons this is insecure and easily defeated. Not to mention the frustration in finding the language literally corrupting incoming data. The setting is called `magic_quotes_gpc` and now they turn it off by default and *highly* recommend it no longer be used.
WordPress has a lot of older code that the setting to be "on" but since it can only be turned on from the PHP.ini file (a setting file that's not controlled from running code), they call the equivalent function `addslashes()` on all incoming `GET` and `POST` data in order to force the same effect.
Then just to add another layer of WTF, they strip out all the back-slashes if the setting was on and use their hack to add them back in. They could have at least just passed through that layer of code, they're already checking if it's on or not. But off or on, everyone gets a small performance hit.
It's also bad because it ensures that if PHP ever did something sane, like make the setting produce escaping that didn't suck so bad, Wordpress would ruin that with this hack too.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | lollaser | dv2zyp8 | <|sols|><|sot|>WordPress overrides all PHP superglobals by adding magic quotes<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/74cb5936fc8be8314b55f3240740553f4fc4075b/wp-includes/load.php#L712<|eol|><|sor|>Despite this being LOL-Wordpress, Wordpress might as well be PHP since that's what most PHP websites run.
This is some really big WTF. At first I thought it wasn't that bad, make sure PHP's laughably bad magic quotes are off and add their own sanitation. Misnamed but not terrible.
BUT ... Investigation into `add_magic_quotes` ... literally calls `addslashes()`. Good lord they could have at least made it perform better by not removing all the slashes first if magic quotes was already on!
Terrible security and bad performance. It's so beautiful it brings a tear to my eye.<|eor|><|sor|>Their justification for all of this is really just as silly as you would expect:
> WordPress ignores the built in php magic quotes setting and the value of get_magic_quotes_gpc() and will always add magic quotes (even after the feature is removed from PHP in 5.4).
> WordPress does this because too much core and plugin code has come to rely on the quotes being there, so disabling quotes on the super globals (as is done in both the "Basic Example" and "Good Coding Practice" examples above) is likely to cause security holes.
https://codex.wordpress.org/Function_Reference/stripslashes_deep<|eor|><|sor|>Wow! This is true lolphp.
Its quite remarkable how bad a language really can be. I have no idea why you would pick PHP in 2018 as your tech stack.<|eor|><|sor|>You can do crap with every language, although some languages will prevent you from doing so. Why would you pick C today over something like java or go/rust/lolcode? If you pick your tech stack just by the fact that more mature techniques are old and useless, I rather would not like to maintain your projects...<|eor|><|eols|><|endoftext|> | 8 |
lolphp | berkes | dv5d29h | <|sols|><|sot|>WordPress overrides all PHP superglobals by adding magic quotes<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/74cb5936fc8be8314b55f3240740553f4fc4075b/wp-includes/load.php#L712<|eol|><|sor|>Despite this being LOL-Wordpress, Wordpress might as well be PHP since that's what most PHP websites run.
This is some really big WTF. At first I thought it wasn't that bad, make sure PHP's laughably bad magic quotes are off and add their own sanitation. Misnamed but not terrible.
BUT ... Investigation into `add_magic_quotes` ... literally calls `addslashes()`. Good lord they could have at least made it perform better by not removing all the slashes first if magic quotes was already on!
Terrible security and bad performance. It's so beautiful it brings a tear to my eye.<|eor|><|sor|>Their justification for all of this is really just as silly as you would expect:
> WordPress ignores the built in php magic quotes setting and the value of get_magic_quotes_gpc() and will always add magic quotes (even after the feature is removed from PHP in 5.4).
> WordPress does this because too much core and plugin code has come to rely on the quotes being there, so disabling quotes on the super globals (as is done in both the "Basic Example" and "Good Coding Practice" examples above) is likely to cause security holes.
https://codex.wordpress.org/Function_Reference/stripslashes_deep<|eor|><|sor|>Wow! This is true lolphp.
Its quite remarkable how bad a language really can be. I have no idea why you would pick PHP in 2018 as your tech stack.<|eor|><|sor|>You can do crap with every language, although some languages will prevent you from doing so. Why would you pick C today over something like java or go/rust/lolcode? If you pick your tech stack just by the fact that more mature techniques are old and useless, I rather would not like to maintain your projects...<|eor|><|sor|>Sure you *can*. But where is the truly horrific Ruby CMS? Or the django-based blogging-tool that is full of examples like this? Where are the .Net, Java or go examples so full of lol?
PHP is more than just a language, it's a community and an ecosystem. The language has improved. But its ecosystem on the whole, hardly. Most of that is due to the two biggest fish in that ecosystem : drupal and WordPress.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | stumpychubbins | 5uf0zg | <|sols|><|sot|>A PHP commentor describes the error-surpression operator (already a lolPHP) in the most PHP terms possible<|eot|><|sol|>http://uk1.php.net/manual/en/language.operators.errorcontrol.php#99805<|eol|><|eols|><|endoftext|> | 51 |
lolphp | yxpow | ddu15ik | <|sols|><|sot|>A PHP commentor describes the error-surpression operator (already a lolPHP) in the most PHP terms possible<|eot|><|sol|>http://uk1.php.net/manual/en/language.operators.errorcontrol.php#99805<|eol|><|sor|>the php comments section effect: for every php article with an example, there is an even shittier example in the comments<|eor|><|eols|><|endoftext|> | 25 |
lolphp | myaut | ddu16c1 | <|sols|><|sot|>A PHP commentor describes the error-surpression operator (already a lolPHP) in the most PHP terms possible<|eot|><|sol|>http://uk1.php.net/manual/en/language.operators.errorcontrol.php#99805<|eol|><|sor|>Wait, you can't just catch an exception? You gotta test it the condition before or you suppress everything? What.
What is the point of throwing specific errors if you can't catch them to deal with them?<|eor|><|sor|>PHP _errors_ were added to language long before _exceptions_. And they are mostly incompatible. <|eor|><|eols|><|endoftext|> | 22 |
lolphp | bart2019 | dduj1li | <|sols|><|sot|>A PHP commentor describes the error-surpression operator (already a lolPHP) in the most PHP terms possible<|eot|><|sol|>http://uk1.php.net/manual/en/language.operators.errorcontrol.php#99805<|eol|><|sor|>Wait, you can't just catch an exception? You gotta test it the condition before or you suppress everything? What.
What is the point of throwing specific errors if you can't catch them to deal with them?<|eor|><|sor|>PHP _errors_ were added to language long before _exceptions_. And they are mostly incompatible. <|eor|><|sor|>I don't know the difference, I don't use php so I have no idea what is going on lol.<|eor|><|sor|>The short version: PHP will log those errors in the errorlog, even though in this case you expect and catch them.
So the problem is not that it doesn't work. It works. The problem is that it also makes a lot of noise.<|eor|><|eols|><|endoftext|> | 12 |
lolphp | bart2019 | ddujbw0 | <|sols|><|sot|>A PHP commentor describes the error-surpression operator (already a lolPHP) in the most PHP terms possible<|eot|><|sol|>http://uk1.php.net/manual/en/language.operators.errorcontrol.php#99805<|eol|><|sor|>99% of all performance claims are unsubstantiated.<|eor|><|sor|>But it is substantiated.
$x = @$array['nonexist'];
is quite a bit slower (as I recall: at least an order of magnitutde) than the much more elaborate
$x = isset($array['nonexist']) ? $array['nonexist'] : null;
p.s. How about this? Does this show up in the logs? I really am not sure.
$x = $array['nonexist'] ?: null;
I know that it works, though I have no idea where to find it in the online PHP docs.
<|eor|><|eols|><|endoftext|> | 8 |
lolphp | edave64 | ddtov0q | <|sols|><|sot|>A PHP commentor describes the error-surpression operator (already a lolPHP) in the most PHP terms possible<|eot|><|sol|>http://uk1.php.net/manual/en/language.operators.errorcontrol.php#99805<|eol|><|sor|>The link only works for me of I drop the subdomain uk1.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | BilgeXA | ddu5b08 | <|sols|><|sot|>A PHP commentor describes the error-surpression operator (already a lolPHP) in the most PHP terms possible<|eot|><|sol|>http://uk1.php.net/manual/en/language.operators.errorcontrol.php#99805<|eol|><|sor|>99% of all performance claims are unsubstantiated.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | Rican7 | dduv5n5 | <|sols|><|sot|>A PHP commentor describes the error-surpression operator (already a lolPHP) in the most PHP terms possible<|eot|><|sol|>http://uk1.php.net/manual/en/language.operators.errorcontrol.php#99805<|eol|><|sor|>99% of all performance claims are unsubstantiated.<|eor|><|sor|>But it is substantiated.
$x = @$array['nonexist'];
is quite a bit slower (as I recall: at least an order of magnitutde) than the much more elaborate
$x = isset($array['nonexist']) ? $array['nonexist'] : null;
p.s. How about this? Does this show up in the logs? I really am not sure.
$x = $array['nonexist'] ?: null;
I know that it works, though I have no idea where to find it in the online PHP docs.
<|eor|><|sor|>> p.s. How about this? Does this show up in the logs? I really am not sure.
>
> $x=$array['nonexist']?:null;
>
That will still throw an error. The [ternary operator (both longhand and shorthand versions)](http://php.net/manual/en/language.operators.comparison.php#language.operators.comparison.ternary) will only check if expression before the `?` character evaluates to `true`. Therefore accessing a non-existent index in an array will still throw an error.
However, as of PHP 7 a new ["null coalescing operator"](http://php.net/manual/en/language.operators.comparison.php#language.operators.comparison.coalesce) is available to perform tasks like this without throwing errors (notices) when accessing an out-of-bounds index. So **this** will work without error:
$x = $array['nonexist'] ?? null;
<|eor|><|eols|><|endoftext|> | 7 |
lolphp | stumpychubbins | ddywums | <|sols|><|sot|>A PHP commentor describes the error-surpression operator (already a lolPHP) in the most PHP terms possible<|eot|><|sol|>http://uk1.php.net/manual/en/language.operators.errorcontrol.php#99805<|eol|><|sor|>99% of all performance claims are unsubstantiated.<|eor|><|sor|>But it is substantiated.
$x = @$array['nonexist'];
is quite a bit slower (as I recall: at least an order of magnitutde) than the much more elaborate
$x = isset($array['nonexist']) ? $array['nonexist'] : null;
p.s. How about this? Does this show up in the logs? I really am not sure.
$x = $array['nonexist'] ?: null;
I know that it works, though I have no idea where to find it in the online PHP docs.
<|eor|><|sor|>> p.s. How about this? Does this show up in the logs? I really am not sure.
>
> $x=$array['nonexist']?:null;
>
That will still throw an error. The [ternary operator (both longhand and shorthand versions)](http://php.net/manual/en/language.operators.comparison.php#language.operators.comparison.ternary) will only check if expression before the `?` character evaluates to `true`. Therefore accessing a non-existent index in an array will still throw an error.
However, as of PHP 7 a new ["null coalescing operator"](http://php.net/manual/en/language.operators.comparison.php#language.operators.comparison.coalesce) is available to perform tasks like this without throwing errors (notices) when accessing an out-of-bounds index. So **this** will work without error:
$x = $array['nonexist'] ?? null;
<|eor|><|soopr|>You've got to be fucking kidding me. PHP is going to have _two_ null coalescing operators? _What the fuck_.<|eoopr|><|eols|><|endoftext|> | 6 |
lolphp | pleurplus | ddu1044 | <|sols|><|sot|>A PHP commentor describes the error-surpression operator (already a lolPHP) in the most PHP terms possible<|eot|><|sol|>http://uk1.php.net/manual/en/language.operators.errorcontrol.php#99805<|eol|><|sor|>Wait, you can't just catch an exception? You gotta test it the condition before or you suppress everything? What.
What is the point of throwing specific errors if you can't catch them to deal with them?<|eor|><|eols|><|endoftext|> | 5 |
lolphp | bart2019 | dduje5t | <|sols|><|sot|>A PHP commentor describes the error-surpression operator (already a lolPHP) in the most PHP terms possible<|eot|><|sol|>http://uk1.php.net/manual/en/language.operators.errorcontrol.php#99805<|eol|><|sor|>the php comments section effect: for every php article with an example, there is an even shittier example in the comments<|eor|><|sor|>True. On the upside: most of those borderline shitty comments are eventually removed by a moderator.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | MazeChaZer | 4fms1c | <|sols|><|sot|>"Pragmatic" design decicions regarding the DateTimeImmutable API<|eot|><|sol|>http://comments.gmane.org/gmane.comp.php.devel/78803<|eol|><|eols|><|endoftext|> | 55 |
lolphp | foobar5678 | d2asjta | <|sols|><|sot|>"Pragmatic" design decicions regarding the DateTimeImmutable API<|eot|><|sol|>http://comments.gmane.org/gmane.comp.php.devel/78803<|eol|><|sor|>Original message:
> The DateTimeImmutable class extends the DateTime class. Why was this done this way?
ReplyA:
> To quote Stas, "As for established practice, everybody expects DateTime, so IMHO we should leave DateTime as base class even though it's not strictly OO-pure."
Argument against ReplyA:
> Just because the outward API *looks* the same, a DateTimeImmutable is NOT a drop in replacement for DateTime.
Argument against ReplyA:
> The problem with the argument that "everybody 'typehints' DateTime; we should inherit from it so that the code will run when the pass it a DateTimeImmutable" is that it assumes that everybody who typehints DateTime uses DateTime in a manner compatible with DateTimeImmutable.
ReplyB:
> They're not really "incompatible". Functions that do not modify dates would work just fine. So it's "not 100% compatible", which is not the same as incompatible.
What a mess. This is quality gold standard lolphp material right here. I feel like people who critisize PHP get a lot of flak from PHP users who retort with "just because stdlib has stupid names doesn't mean the whole language is bad." This clusterfuck right here is why we hate PHP. This is a feature which was implemented in an awful way (to cover their previous fuck up), and implementing this "the right way" wouldn't have even been that difficult.
To quote someone else in that email thread:
> I'd prefer to have nothing over having something bad.
<|eor|><|eols|><|endoftext|> | 25 |
lolphp | nikic | d2bg9oi | <|sols|><|sot|>"Pragmatic" design decicions regarding the DateTimeImmutable API<|eot|><|sol|>http://comments.gmane.org/gmane.comp.php.devel/78803<|eol|><|sor|>Original message:
> The DateTimeImmutable class extends the DateTime class. Why was this done this way?
ReplyA:
> To quote Stas, "As for established practice, everybody expects DateTime, so IMHO we should leave DateTime as base class even though it's not strictly OO-pure."
Argument against ReplyA:
> Just because the outward API *looks* the same, a DateTimeImmutable is NOT a drop in replacement for DateTime.
Argument against ReplyA:
> The problem with the argument that "everybody 'typehints' DateTime; we should inherit from it so that the code will run when the pass it a DateTimeImmutable" is that it assumes that everybody who typehints DateTime uses DateTime in a manner compatible with DateTimeImmutable.
ReplyB:
> They're not really "incompatible". Functions that do not modify dates would work just fine. So it's "not 100% compatible", which is not the same as incompatible.
What a mess. This is quality gold standard lolphp material right here. I feel like people who critisize PHP get a lot of flak from PHP users who retort with "just because stdlib has stupid names doesn't mean the whole language is bad." This clusterfuck right here is why we hate PHP. This is a feature which was implemented in an awful way (to cover their previous fuck up), and implementing this "the right way" wouldn't have even been that difficult.
To quote someone else in that email thread:
> I'd prefer to have nothing over having something bad.
<|eor|><|sor|>To be clear, as the result of this discussion the inheritance hierarchy was changed. DateTimeImmutable no longer extends DateTime, instead both implement a common DateTimeInterface, which has only the read-only methods.<|eor|><|eols|><|endoftext|> | 12 |
lolphp | DoctorWaluigiTime | d2b3wl2 | <|sols|><|sot|>"Pragmatic" design decicions regarding the DateTimeImmutable API<|eot|><|sol|>http://comments.gmane.org/gmane.comp.php.devel/78803<|eol|><|sor|>> I think it was done to ease adoption.
PHP in a nutshell, ladies and gentlemen. Why do something right, when you can do something that "eases adoption"? AKA, "heaven forbid a PHP developer has to think."<|eor|><|eols|><|endoftext|> | 8 |
lolphp | polish_niceguy | 4cv3km | <|sols|><|sot|>print_r silently casts booleans to integers. Took me two hours to find out why my code was failing.<|eot|><|sol|>https://3v4l.org/L6HhW<|eol|><|eols|><|endoftext|> | 53 |
lolphp | polish_niceguy | d1ln4yw | <|sols|><|sot|>print_r silently casts booleans to integers. Took me two hours to find out why my code was failing.<|eot|><|sol|>https://3v4l.org/L6HhW<|eol|><|soopr|>Little backstory: I was parsing received JSON, which happened to have boolean values. I was using `print_r()` to quickly dump the resulting array to a file, so I initially thought that there were only integers. But somewhere deep in the code `is_numeric()` was failing. Took two hours out of my life, thanks PHP.
Also, it looks like the `print_r()` behavior is undefined for booleans. Because why not.<|eoopr|><|eols|><|endoftext|> | 17 |
lolphp | postmodest | d1lw3i8 | <|sols|><|sot|>print_r silently casts booleans to integers. Took me two hours to find out why my code was failing.<|eot|><|sol|>https://3v4l.org/L6HhW<|eol|><|soopr|>Little backstory: I was parsing received JSON, which happened to have boolean values. I was using `print_r()` to quickly dump the resulting array to a file, so I initially thought that there were only integers. But somewhere deep in the code `is_numeric()` was failing. Took two hours out of my life, thanks PHP.
Also, it looks like the `print_r()` behavior is undefined for booleans. Because why not.<|eoopr|><|sor|>i hope you learned a lesson, next time var_dump() :p<|eor|><|soopr|>`print_r` can be returned as a variable and than put into a file, while `var_dump` can't. The best you can do is to hack around it with `ob_start` and that's how I finally did it.<|eoopr|><|sor|>`$dump = var_export($var,true)`<|eor|><|eols|><|endoftext|> | 16 |
lolphp | cythrawll | d1mharo | <|sols|><|sot|>print_r silently casts booleans to integers. Took me two hours to find out why my code was failing.<|eot|><|sol|>https://3v4l.org/L6HhW<|eol|><|sor|>print_r is a garbage function, I'd be in favor of deprecating it.
I been telling people years of it's evil. var_dump and var_export is what you really want/need. By itself print_r does nothing useful. It's useless for debugging as you found out, and as an output mechanism it has formatting that no one wants or needs. Why is it still around?
I'd be favor of at least putting a big red flashing marquee on the documentation page that says "You probably don't want to use this function"<|eor|><|eols|><|endoftext|> | 13 |
lolphp | Takeoded | d1lqtm2 | <|sols|><|sot|>print_r silently casts booleans to integers. Took me two hours to find out why my code was failing.<|eot|><|sol|>https://3v4l.org/L6HhW<|eol|><|soopr|>Little backstory: I was parsing received JSON, which happened to have boolean values. I was using `print_r()` to quickly dump the resulting array to a file, so I initially thought that there were only integers. But somewhere deep in the code `is_numeric()` was failing. Took two hours out of my life, thanks PHP.
Also, it looks like the `print_r()` behavior is undefined for booleans. Because why not.<|eoopr|><|sor|>i hope you learned a lesson, next time var_dump() :p<|eor|><|eols|><|endoftext|> | 11 |
lolphp | polish_niceguy | d1mdess | <|sols|><|sot|>print_r silently casts booleans to integers. Took me two hours to find out why my code was failing.<|eot|><|sol|>https://3v4l.org/L6HhW<|eol|><|soopr|>Little backstory: I was parsing received JSON, which happened to have boolean values. I was using `print_r()` to quickly dump the resulting array to a file, so I initially thought that there were only integers. But somewhere deep in the code `is_numeric()` was failing. Took two hours out of my life, thanks PHP.
Also, it looks like the `print_r()` behavior is undefined for booleans. Because why not.<|eoopr|><|sor|>i hope you learned a lesson, next time var_dump() :p<|eor|><|soopr|>`print_r` can be returned as a variable and than put into a file, while `var_dump` can't. The best you can do is to hack around it with `ob_start` and that's how I finally did it.<|eoopr|><|sor|>`$dump = var_export($var,true)`<|eor|><|soopr|>Huh. 10 years with PHP and this is the first time that this function would be useful. No wonder I forgot about it completely.<|eoopr|><|eols|><|endoftext|> | 10 |
lolphp | Cyphr | d1lsxxi | <|sols|><|sot|>print_r silently casts booleans to integers. Took me two hours to find out why my code was failing.<|eot|><|sol|>https://3v4l.org/L6HhW<|eol|><|sor|>Isn't that a symptom of PHP's String casting? Bool(true) strings to '1', and Bool(false) strings to ''. It's really dumb, and makes no sense to me. <|eor|><|eols|><|endoftext|> | 8 |
lolphp | jsanc623 | d1lo5pv | <|sols|><|sot|>print_r silently casts booleans to integers. Took me two hours to find out why my code was failing.<|eot|><|sol|>https://3v4l.org/L6HhW<|eol|><|soopr|>Little backstory: I was parsing received JSON, which happened to have boolean values. I was using `print_r()` to quickly dump the resulting array to a file, so I initially thought that there were only integers. But somewhere deep in the code `is_numeric()` was failing. Took two hours out of my life, thanks PHP.
Also, it looks like the `print_r()` behavior is undefined for booleans. Because why not.<|eoopr|><|sor|>Why would you use print_r to print to a file though? I'd never let that get past a code review.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | carlos_vini | d1lxt47 | <|sols|><|sot|>print_r silently casts booleans to integers. Took me two hours to find out why my code was failing.<|eot|><|sol|>https://3v4l.org/L6HhW<|eol|><|soopr|>Little backstory: I was parsing received JSON, which happened to have boolean values. I was using `print_r()` to quickly dump the resulting array to a file, so I initially thought that there were only integers. But somewhere deep in the code `is_numeric()` was failing. Took two hours out of my life, thanks PHP.
Also, it looks like the `print_r()` behavior is undefined for booleans. Because why not.<|eoopr|><|sor|>i hope you learned a lesson, next time var_dump() :p<|eor|><|soopr|>`print_r` can be returned as a variable and than put into a file, while `var_dump` can't. The best you can do is to hack around it with `ob_start` and that's how I finally did it.<|eoopr|><|sor|>`$dump = var_export($var,true)`<|eor|><|sor|>If you really want to save anything to a file and them get it back var_export won't work with stdClass (because __set_state is not implemented). But serialize() will: https://3v4l.org/H2P5l
Also if you plan to use this data cross-language or can't trust the file source, you'd better use json_encode to avoid Object Injection.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | midir | d1milva | <|sols|><|sot|>print_r silently casts booleans to integers. Took me two hours to find out why my code was failing.<|eot|><|sol|>https://3v4l.org/L6HhW<|eol|><|sor|>print_r is a garbage function, I'd be in favor of deprecating it.
I been telling people years of it's evil. var_dump and var_export is what you really want/need. By itself print_r does nothing useful. It's useless for debugging as you found out, and as an output mechanism it has formatting that no one wants or needs. Why is it still around?
I'd be favor of at least putting a big red flashing marquee on the documentation page that says "You probably don't want to use this function"<|eor|><|sor|>I tend to use `print_r` with arrays and objects because it displays keys and values on the same line, and doesn't quote the key names, so it can be easier to sift through and see the data than with `var_dump`.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | polish_niceguy | d1ltmcf | <|sols|><|sot|>print_r silently casts booleans to integers. Took me two hours to find out why my code was failing.<|eot|><|sol|>https://3v4l.org/L6HhW<|eol|><|sor|>Isn't that a symptom of PHP's String casting? Bool(true) strings to '1', and Bool(false) strings to ''. It's really dumb, and makes no sense to me. <|eor|><|soopr|>The logic here is on par with `empty()`.<|eoopr|><|eols|><|endoftext|> | 6 |
lolphp | cythrawll | d1miunb | <|sols|><|sot|>print_r silently casts booleans to integers. Took me two hours to find out why my code was failing.<|eot|><|sol|>https://3v4l.org/L6HhW<|eol|><|sor|>print_r is a garbage function, I'd be in favor of deprecating it.
I been telling people years of it's evil. var_dump and var_export is what you really want/need. By itself print_r does nothing useful. It's useless for debugging as you found out, and as an output mechanism it has formatting that no one wants or needs. Why is it still around?
I'd be favor of at least putting a big red flashing marquee on the documentation page that says "You probably don't want to use this function"<|eor|><|sor|>I tend to use `print_r` with arrays and objects because it displays keys and values on the same line, and doesn't quote the key names, so it can be easier to sift through and see the data than with `var_dump`.<|eor|><|sor|>then try var_export, stop using print_r.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | Deviltry1 | 4bqu1s | <|sols|><|sot|>DivisionByZero exception, it does nothing<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/<|eol|><|eols|><|endoftext|> | 52 |
lolphp | vytah | d1bljn2 | <|sols|><|sot|>DivisionByZero exception, it does nothing<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/<|eol|><|sor|>So, a **DivisionByZero**Error is never thrown when a **division by zero** actually occurs.
Makes perfect sense.<|eor|><|eols|><|endoftext|> | 33 |
lolphp | nikic | d1bnjrw | <|sols|><|sot|>DivisionByZero exception, it does nothing<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/<|eol|><|sor|>To clarify: DivisionByZeroError is an *integer* division error. It is thrown by `%` and `intdiv`, which are the integer division operations. Integer division by zero has no well-defined result.
Floating point division by zero on the other hand is a well-defined operation under IEEE754 and does not throw an exception. Floating point divisions are performed by `/` and `fmod`.<|eor|><|eols|><|endoftext|> | 31 |
lolphp | Mattho | d1bl5s8 | <|sols|><|sot|>DivisionByZero exception, it does nothing<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/<|eol|><|sor|>> The DivisionByZeroError is only thrown when using modulus as opposed to division. When you divide by 0, the result will also be either an INF or NAN (new PHP 7 constants i think). You can check for them and throw a DivisionByZeroError manually.
The fuck is this language?<|eor|><|eols|><|endoftext|> | 24 |
lolphp | nikic | d1bww17 | <|sols|><|sot|>DivisionByZero exception, it does nothing<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/<|eol|><|sor|>To clarify: DivisionByZeroError is an *integer* division error. It is thrown by `%` and `intdiv`, which are the integer division operations. Integer division by zero has no well-defined result.
Floating point division by zero on the other hand is a well-defined operation under IEEE754 and does not throw an exception. Floating point divisions are performed by `/` and `fmod`.<|eor|><|sor|>> Floating point division by zero on the other hand is a well-defined operation under IEEE754 and does not throw an exception.
Unless, you know, you want to write floating point code that aborts without having to check for funny values after each operations so you just turn on floating point exceptions, as you would in any sane language like Perl, Python, D, C++... Oh wait, I said sane languages, carry on.<|eor|><|sor|>If you want it to abort, just make it abort. Nobody preventing you from turning that warning into an exception automatically.
> as you would in any sane language like Perl, Python, D, C++... Oh wait, I said sane languages, carry on.
Of course I agree with you that languages like JavaScript, Java or Matlab are all terrible, how could they implement IEEE754 otherwise. I also particularly like your mention of C++ where, just like in C, floating division by zero is undefined behavior, so the compiler is allowed to do whatever with your code. You won't be getting sigfpe's in a default setup and generally nobody bothers changing that.
That said, I'd have preferred the exception. PHP is not exactly big on scientific computing, and that's the main case where it would be annoying.<|eor|><|eols|><|endoftext|> | 15 |
lolphp | phoshi | d1bqs8j | <|sols|><|sot|>DivisionByZero exception, it does nothing<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/<|eol|><|sor|>> The DivisionByZeroError is only thrown when using modulus as opposed to division. When you divide by 0, the result will also be either an INF or NAN (new PHP 7 constants i think). You can check for them and throw a DivisionByZeroError manually.
The fuck is this language?<|eor|><|sor|>Best part being that if you implement that naively and check if your $result == NaN, you'll always get false because NaN is not equal to anything (which is a wtf in the spec, not php) <|eor|><|eols|><|endoftext|> | 11 |
lolphp | merreborn | d1cdig8 | <|sols|><|sot|>DivisionByZero exception, it does nothing<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/<|eol|><|sor|>Maybe they can add a new exception that's called DivideByZero in Hebrew? I think that will clear everything right up.<|eor|><|sor|> UNEXPECTED_DIVIDUM_NULLIKUM<|eor|><|eols|><|endoftext|> | 11 |
lolphp | ebvalaim | d1bk9to | <|sols|><|sot|>DivisionByZero exception, it does nothing<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/<|eol|><|sor|>https://bugs.php.net/bug.php?id=71306
Well... yeah.<|eor|><|eols|><|endoftext|> | 9 |
lolphp | cbraga | d1bts29 | <|sols|><|sot|>DivisionByZero exception, it does nothing<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/<|eol|><|sor|>> The DivisionByZeroError is only thrown when using modulus as opposed to division. When you divide by 0, the result will also be either an INF or NAN (new PHP 7 constants i think). You can check for them and throw a DivisionByZeroError manually.
The fuck is this language?<|eor|><|sor|>Best part being that if you implement that naively and check if your $result == NaN, you'll always get false because NaN is not equal to anything (which is a wtf in the spec, not php) <|eor|><|sor|>> check if your $result == NaN, you'll always get false because NaN is not equal to anything (which is a wtf in the spec, not php)
in my experience (with sane languages) attempting that comparison will give a warning to the effect of "comparison always evaluates to false" or something like that
of course php has no warning for it, that would be bothering the programmer with useless details<|eor|><|eols|><|endoftext|> | 9 |
lolphp | PlasmaSheep | d1cbwn7 | <|sols|><|sot|>DivisionByZero exception, it does nothing<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/<|eol|><|sor|>Maybe they can add a new exception that's called DivideByZero in Hebrew? I think that will clear everything right up.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | cbraga | d1btv8j | <|sols|><|sot|>DivisionByZero exception, it does nothing<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/<|eol|><|sor|>To clarify: DivisionByZeroError is an *integer* division error. It is thrown by `%` and `intdiv`, which are the integer division operations. Integer division by zero has no well-defined result.
Floating point division by zero on the other hand is a well-defined operation under IEEE754 and does not throw an exception. Floating point divisions are performed by `/` and `fmod`.<|eor|><|sor|>> Floating point division by zero on the other hand is a well-defined operation under IEEE754 and does not throw an exception.
Unless, you know, you want to write floating point code that aborts without having to check for funny values after each operations so you just turn on floating point exceptions, as you would in any sane language like Perl, Python, D, C++... Oh wait, I said sane languages, carry on.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | milordi | d1c8xey | <|sols|><|sot|>DivisionByZero exception, it does nothing<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/<|eol|><|sor|>https://bugs.php.net/bug.php?id=71306
Well... yeah.<|eor|><|sor|>>-Status: Open
>+Status: Not a bug
Everything as excepted.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | greenthumble | d1c16rx | <|sols|><|sot|>DivisionByZero exception, it does nothing<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/<|eol|><|sor|>> The DivisionByZeroError is only thrown when using modulus as opposed to division. When you divide by 0, the result will also be either an INF or NAN (new PHP 7 constants i think). You can check for them and throw a DivisionByZeroError manually.
The fuck is this language?<|eor|><|sor|>Best part being that if you implement that naively and check if your $result == NaN, you'll always get false because NaN is not equal to anything (which is a wtf in the spec, not php) <|eor|><|sor|>There is this though http://php.net/manual/en/function.is-nan.php<|eor|><|eols|><|endoftext|> | 8 |
lolphp | masklinn | d1cbk8v | <|sols|><|sot|>DivisionByZero exception, it does nothing<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/<|eol|><|sor|>> The DivisionByZeroError is only thrown when using modulus as opposed to division. When you divide by 0, the result will also be either an INF or NAN (new PHP 7 constants i think). You can check for them and throw a DivisionByZeroError manually.
The fuck is this language?<|eor|><|sor|>Best part being that if you implement that naively and check if your $result == NaN, you'll always get false because NaN is not equal to anything (which is a wtf in the spec, not php) <|eor|><|sor|>> which is a wtf in the spec
It makes perfect sense if you see `NaN` is a subtype of numbers qualified by what it's not rather than what it is: `0/0` and `parseInt("yolo")` are nans, but what sense would it make for both to be the same value? <|eor|><|eols|><|endoftext|> | 7 |
lolphp | mayobutter | d1cq2z2 | <|sols|><|sot|>DivisionByZero exception, it does nothing<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/<|eol|><|sor|>Maybe they can add a new exception that's called DivideByZero in Hebrew? I think that will clear everything right up.<|eor|><|sor|>or an exception named DivisionByRealZero<|eor|><|eols|><|endoftext|> | 6 |
lolphp | webdeverper | 3gwlup | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|eols|><|endoftext|> | 52 |
lolphp | MaxNanasy | cu2d5ho | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|sor|>>**Note:**
>easter_date() relies on your system's C library time functions, rather than using PHP's internal date and time functions. As a consequence, easter_date() uses the TZ environment variable to determine the time zone it should operate in, rather than using PHP's default time zone, which may result in unexpected behaviour when using this function in conjunction with other date functions in PHP.
I don't know why this exists, but, given that it does, would it really be that hard to make it consistent?<|eor|><|sor|>> consistent
> PHP
Pick one.<|eor|><|eols|><|endoftext|> | 49 |
lolphp | ajmarks | cu29a5v | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|sor|>>**Note:**
>easter_date() relies on your system's C library time functions, rather than using PHP's internal date and time functions. As a consequence, easter_date() uses the TZ environment variable to determine the time zone it should operate in, rather than using PHP's default time zone, which may result in unexpected behaviour when using this function in conjunction with other date functions in PHP.
I don't know why this exists, but, given that it does, would it really be that hard to make it consistent?<|eor|><|eols|><|endoftext|> | 42 |
lolphp | vytah | cu2ibuz | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|sor|>[Given how complex calculating the date of Easter actually is](https://en.m.wikipedia.org/wiki/Computus), this is one of the least offensive things about PHP. <|eor|><|soopr|>So then php should try to do every hard thing in computer science as a separate global function?
Overall I'm not mad about this I just think it's incredibly quirky and perfect for "lol".<|eoopr|><|sor|> traveling_salesman()
real_travelling_salesman()
(different spelling of travel(l)ing, because one dev was American and the other was British)<|eor|><|eols|><|endoftext|> | 41 |
lolphp | mrpaco | cu270y2 | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|sor|>[Given how complex calculating the date of Easter actually is](https://en.m.wikipedia.org/wiki/Computus), this is one of the least offensive things about PHP. <|eor|><|eols|><|endoftext|> | 38 |
lolphp | vytah | cu2idq7 | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|soopr|>No thanksgiving_date() , christmas_date() or halloween_date() :'(
<|eoopr|><|sor|>Not to mention freedom_date() (returns the date of the fourth of July in the current year)<|eor|><|sor|>[deleted]<|eor|><|sor|>Sorry, you'll have to file a bug report!<|eor|><|sor|> freedom_date()
Returns the date of the independence day of this locale's country.
If the country does not have an independence day, freedom_date returns false.
If the country has multiple independence days, freedom_date returns the most important one,
unless they're equally important, in which case it returns the one that comes sooner.
If the country is unknown, freedom_date returns the date of Jan 1st and raises a warning.
If the locale doesn't have a country, freedom_date returns null and raises a warning.
You can supress the warning using the @ operator.
<|eor|><|eols|><|endoftext|> | 33 |
lolphp | webdeverper | cu2bq37 | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|sor|>[Given how complex calculating the date of Easter actually is](https://en.m.wikipedia.org/wiki/Computus), this is one of the least offensive things about PHP. <|eor|><|soopr|>So then php should try to do every hard thing in computer science as a separate global function?
Overall I'm not mad about this I just think it's incredibly quirky and perfect for "lol".<|eoopr|><|eols|><|endoftext|> | 27 |
lolphp | ThisIsADogHello | cu2z797 | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|sor|>[Given how complex calculating the date of Easter actually is](https://en.m.wikipedia.org/wiki/Computus), this is one of the least offensive things about PHP. <|eor|><|soopr|>So then php should try to do every hard thing in computer science as a separate global function?
Overall I'm not mad about this I just think it's incredibly quirky and perfect for "lol".<|eoopr|><|sor|> traveling_salesman()
real_travelling_salesman()
(different spelling of travel(l)ing, because one dev was American and the other was British)<|eor|><|sor|>The fake traveling_salesman() just spends a lot of time going out doing nothing, afraid to tell his wife he's been fired a couple weeks ago.<|eor|><|eols|><|endoftext|> | 19 |
lolphp | webdeverper | cu24k3i | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|soopr|>No thanksgiving_date() , christmas_date() or halloween_date() :'(
<|eoopr|><|eols|><|endoftext|> | 17 |
lolphp | tgp1994 | cu2dmaz | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|soopr|>No thanksgiving_date() , christmas_date() or halloween_date() :'(
<|eoopr|><|sor|>Not to mention freedom_date() (returns the date of the fourth of July in the current year)<|eor|><|eols|><|endoftext|> | 16 |
lolphp | Various_Pickles | cu2lvhg | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|soopr|>No thanksgiving_date() , christmas_date() or halloween_date() :'(
<|eoopr|><|sor|>Not to mention freedom_date() (returns the date of the fourth of July in the current year)<|eor|><|sor|>[deleted]<|eor|><|sor|>Sorry, you'll have to file a bug report!<|eor|><|sor|> freedom_date()
Returns the date of the independence day of this locale's country.
If the country does not have an independence day, freedom_date returns false.
If the country has multiple independence days, freedom_date returns the most important one,
unless they're equally important, in which case it returns the one that comes sooner.
If the country is unknown, freedom_date returns the date of Jan 1st and raises a warning.
If the locale doesn't have a country, freedom_date returns null and raises a warning.
You can supress the warning using the @ operator.
<|eor|><|sor|> If the flags argument contains an 'e' character, the content of the
SUCH_FREEDOM variable is evaluated as PHP in the context of the function call.<|eor|><|eols|><|endoftext|> | 14 |
lolphp | ajmarks | cu2mts1 | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|soopr|>No thanksgiving_date() , christmas_date() or halloween_date() :'(
<|eoopr|><|sor|>Those dates are easy; they're the same each. Calculating which day easter is is harder. Should PHP include a global function for that? Probably not. But, while the others would just return a fixed date and thus be rather unnecessary, easter is different.<|eor|><|sor|>Just need to do non-Christian holidays then. I want to see channukah_date(), ramadan_dates(), and diwali_date() added to the the global namespace.<|eor|><|eols|><|endoftext|> | 13 |
lolphp | polish_niceguy | cu2mobe | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|soopr|>No thanksgiving_date() , christmas_date() or halloween_date() :'(
<|eoopr|><|sor|>Not to mention freedom_date() (returns the date of the fourth of July in the current year)<|eor|><|sor|>[deleted]<|eor|><|sor|>Sorry, you'll have to file a bug report!<|eor|><|sor|> freedom_date()
Returns the date of the independence day of this locale's country.
If the country does not have an independence day, freedom_date returns false.
If the country has multiple independence days, freedom_date returns the most important one,
unless they're equally important, in which case it returns the one that comes sooner.
If the country is unknown, freedom_date returns the date of Jan 1st and raises a warning.
If the locale doesn't have a country, freedom_date returns null and raises a warning.
You can supress the warning using the @ operator.
<|eor|><|sor|> If the country no longer exists, freedom_date throws an exception.<|eor|><|eols|><|endoftext|> | 13 |
lolphp | tgp1994 | cu2duv0 | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|soopr|>No thanksgiving_date() , christmas_date() or halloween_date() :'(
<|eoopr|><|sor|>Not to mention freedom_date() (returns the date of the fourth of July in the current year)<|eor|><|sor|>[deleted]<|eor|><|sor|>Sorry, you'll have to file a bug report!<|eor|><|eols|><|endoftext|> | 10 |
lolphp | webdeverper | cu2nmem | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|soopr|>No thanksgiving_date() , christmas_date() or halloween_date() :'(
<|eoopr|><|sor|>Not to mention freedom_date() (returns the date of the fourth of July in the current year)<|eor|><|sor|>[deleted]<|eor|><|sor|>Sorry, you'll have to file a bug report!<|eor|><|sor|> freedom_date()
Returns the date of the independence day of this locale's country.
If the country does not have an independence day, freedom_date returns false.
If the country has multiple independence days, freedom_date returns the most important one,
unless they're equally important, in which case it returns the one that comes sooner.
If the country is unknown, freedom_date returns the date of Jan 1st and raises a warning.
If the locale doesn't have a country, freedom_date returns null and raises a warning.
You can supress the warning using the @ operator.
<|eor|><|soopr|>If &$date is passed as a parameter, the result is stored there instead of returning it. <|eoopr|><|eols|><|endoftext|> | 10 |
lolphp | mort96 | cu2jq5t | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|soopr|>No thanksgiving_date() , christmas_date() or halloween_date() :'(
<|eoopr|><|sor|>Those dates are easy; they're the same each. Calculating which day easter is is harder. Should PHP include a global function for that? Probably not. But, while the others would just return a fixed date and thus be rather unnecessary, easter is different.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | mort96 | cu2kfm8 | <|sols|><|sot|>easter_date Get Unix timestamp for midnight on Easter of a given year<|eot|><|sol|>http://php.net/manual/en/function.easter-date.php<|eol|><|soopr|>No thanksgiving_date() , christmas_date() or halloween_date() :'(
<|eoopr|><|sor|>Those dates are easy; they're the same each. Calculating which day easter is is harder. Should PHP include a global function for that? Probably not. But, while the others would just return a fixed date and thus be rather unnecessary, easter is different.<|eor|><|sor|><|eor|><|sor|>Oh, I didn't know that. Same arguments applies to that too then; adding it to the global namespace would of course be completely ridiculous, just like the easter time, but would make more sense than Christmas and Halloween.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | volnix | 39l1tu | <|sols|><|sot|>PHP typing in a nutshell<|eot|><|sol|>http://xkcd.com/1537/<|eol|><|eols|><|endoftext|> | 54 |
lolphp | myaut | cs4pzd0 | <|sols|><|sot|>PHP typing in a nutshell<|eot|><|sol|>http://xkcd.com/1537/<|eol|><|sor|>I think PHP7 should introduce `declare(xkcd_types=1)` which will implement these to maintain regular level of madness in core language.<|eor|><|eols|><|endoftext|> | 36 |
lolphp | satan-repents | cs4iiiv | <|sols|><|sot|>PHP typing in a nutshell<|eot|><|sol|>http://xkcd.com/1537/<|eol|><|sor|>This has nothing to do with PHP.<|eor|><|sor|>This whole subreddit rarely has anything to do with PHP. Just a bunch of butthurt developers bashing things they don't like. <|eor|><|sor|>Butthurt after years of traumatic php development, yep. This sub is helping me regain my self respect.<|eor|><|eols|><|endoftext|> | 21 |
lolphp | suspiciously_calm | cs4l4jy | <|sols|><|sot|>PHP typing in a nutshell<|eot|><|sol|>http://xkcd.com/1537/<|eol|><|sor|>This has nothing to do with PHP.<|eor|><|sor|>What do you mean it has nothing to do with PHP?
It shows the interactive shell of the upcoming PHP version! ^at^least^thats^highly^plausible<|eor|><|eols|><|endoftext|> | 17 |
lolphp | expugnator3000 | cs4ntr7 | <|sols|><|sot|>PHP typing in a nutshell<|eot|><|sol|>http://xkcd.com/1537/<|eol|><|sor|>This whole subreddit rarely has anything to do with PHP. Just a bunch of butthurt developers bashing things they don't like. <|eor|><|sor|>Butthurt after years of traumatic php development, yep. This sub is helping me regain my self respect.<|eor|><|sor|>Except most complains are by people who don't realize that PHP has had significant enhancements in the last 10 years so it's not like the PHP they wrote back then when they got negative impressions.<|eor|><|sor|>Still working with PHP, unfortunately. I push this poor excuse for a language as hard as I can. Every feature and "clever" hack I can find to make it more bearable, I use. It's still a slow piece of dogshit.<|eor|><|sor|>I guarantee that I am pushing PHP far far further than you are and enjoying every minute of it.<|eor|><|sor|>I want to push it so far it turns into Hack, so no, you're not pushing it as hard as I am. To be clear, I define pushing as pushing it towards maintainability, code elegance and reuse and stability. And the language pushes back every step of the way.<|eor|><|sor|>I bet you're wrong. I can't show what I'm working on, but I know that I am.<|eor|><|sor|>You won't get anyone to agree with you by waving your PHPenis around mate<|eor|><|eols|><|endoftext|> | 17 |
lolphp | BilgeXA | cs4bk4w | <|sols|><|sot|>PHP typing in a nutshell<|eot|><|sol|>http://xkcd.com/1537/<|eol|><|sor|>This has nothing to do with PHP.<|eor|><|eols|><|endoftext|> | 15 |
lolphp | beerdude26 | cs4j9hg | <|sols|><|sot|>PHP typing in a nutshell<|eot|><|sol|>http://xkcd.com/1537/<|eol|><|sor|>This has nothing to do with PHP.<|eor|><|sor|>This whole subreddit rarely has anything to do with PHP. Just a bunch of butthurt developers bashing things they don't like. <|eor|><|sor|>Butthurt after years of traumatic php development, yep. This sub is helping me regain my self respect.<|eor|><|sor|>Except most complains are by people who don't realize that PHP has had significant enhancements in the last 10 years so it's not like the PHP they wrote back then when they got negative impressions.<|eor|><|sor|>Still working with PHP, unfortunately. I push this poor excuse for a language as hard as I can. Every feature and "clever" hack I can find to make it more bearable, I use. It's still a slow piece of dogshit.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | c_wraith | cs5npee | <|sols|><|sot|>PHP typing in a nutshell<|eot|><|sol|>http://xkcd.com/1537/<|eol|><|sor|>[deleted]<|eor|><|sor|>https://hackage.haskell.org/package/acme-php might be of interest to you. Look at the source, too. Those instances don't appear in the haddocks, and are quite... impressive.<|eor|><|eols|><|endoftext|> | 10 |
lolphp | beerdude26 | cs4jzqz | <|sols|><|sot|>PHP typing in a nutshell<|eot|><|sol|>http://xkcd.com/1537/<|eol|><|sor|>This whole subreddit rarely has anything to do with PHP. Just a bunch of butthurt developers bashing things they don't like. <|eor|><|sor|>Butthurt after years of traumatic php development, yep. This sub is helping me regain my self respect.<|eor|><|sor|>Except most complains are by people who don't realize that PHP has had significant enhancements in the last 10 years so it's not like the PHP they wrote back then when they got negative impressions.<|eor|><|sor|>Still working with PHP, unfortunately. I push this poor excuse for a language as hard as I can. Every feature and "clever" hack I can find to make it more bearable, I use. It's still a slow piece of dogshit.<|eor|><|sor|>I guarantee that I am pushing PHP far far further than you are and enjoying every minute of it.<|eor|><|sor|>I want to push it so far it turns into Hack, so no, you're not pushing it as hard as I am. To be clear, I define pushing as pushing it towards maintainability, code elegance and reuse and stability. And the language pushes back every step of the way.<|eor|><|sor|>I bet you're wrong. I can't show what I'm working on, but I know that I am.<|eor|><|sor|>Pushing to make PHP maintainable just turns it into another language, mainly Java (see Symfony). Could also make it more Python-ish or Haskellish (see HHVM). Anyway, I bid you good luck on your projects. <|eor|><|eols|><|endoftext|> | 10 |
lolphp | iheartrms | cs51nr8 | <|sols|><|sot|>PHP typing in a nutshell<|eot|><|sol|>http://xkcd.com/1537/<|eol|><|sor|>This has nothing to do with PHP.<|eor|><|sor|>This whole subreddit rarely has anything to do with PHP. Just a bunch of butthurt developers bashing things they don't like. <|eor|><|sor|>Butthurt after years of traumatic php development, yep. This sub is helping me regain my self respect.<|eor|><|sor|>Except most complains are by people who don't realize that PHP has had significant enhancements in the last 10 years so it's not like the PHP they wrote back then when they got negative impressions.<|eor|><|sor|>But its still, and will always be a pile of hacks, its like a pig with lipstick. The only way to salvation is by total BC breakage.<|eor|><|sor|>Which is exactly what Facebook has done. Don't believe anyone when they brag that Facebook uses PHP. It isn't PHP that any of us would recognize nor does it run in our standard PHP systems.<|eor|><|eols|><|endoftext|> | 9 |
lolphp | BilgeXA | cs4nr9a | <|sols|><|sot|>PHP typing in a nutshell<|eot|><|sol|>http://xkcd.com/1537/<|eol|><|sor|>This has nothing to do with PHP.<|eor|><|sor|>What do you mean it has nothing to do with PHP?
It shows the interactive shell of the upcoming PHP version! ^at^least^thats^highly^plausible<|eor|><|sor|>Good one.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | Ickle_Chris | cs4ehcz | <|sols|><|sot|>PHP typing in a nutshell<|eot|><|sol|>http://xkcd.com/1537/<|eol|><|sor|>http://awesomegifs.com/wp-content/uploads/dead-horse.gif<|eor|><|eols|><|endoftext|> | 6 |
lolphp | beerdude26 | cs4jl08 | <|sols|><|sot|>PHP typing in a nutshell<|eot|><|sol|>http://xkcd.com/1537/<|eol|><|sor|>This has nothing to do with PHP.<|eor|><|sor|>This whole subreddit rarely has anything to do with PHP. Just a bunch of butthurt developers bashing things they don't like. <|eor|><|sor|>Butthurt after years of traumatic php development, yep. This sub is helping me regain my self respect.<|eor|><|sor|>Except most complains are by people who don't realize that PHP has had significant enhancements in the last 10 years so it's not like the PHP they wrote back then when they got negative impressions.<|eor|><|sor|>Still working with PHP, unfortunately. I push this poor excuse for a language as hard as I can. Every feature and "clever" hack I can find to make it more bearable, I use. It's still a slow piece of dogshit.<|eor|><|sor|>I guarantee that I am pushing PHP far far further than you are and enjoying every minute of it.<|eor|><|sor|>I want to push it so far it turns into Hack, so no, you're not pushing it as hard as I am. To be clear, I define pushing as pushing it towards maintainability, code elegance and reuse and stability. And the language pushes back every step of the way.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | jadkik94 | 37pcnc | <|sols|><|sot|>2001-01-0x is a valid date<|eot|><|sol|>http://3v4l.org/JFnc4<|eol|><|eols|><|endoftext|> | 54 |
lolphp | philipwhiuk | crotcgp | <|sols|><|sot|>2001-01-0x is a valid date<|eot|><|sol|>http://3v4l.org/JFnc4<|eol|><|sor|>I can see what happens here
The x is not parsed any more, so the parsed date ends up to be 2000-12-31, since if you take the 0th day of a month, it always leaps to the last day of the previous month(which is actually useful in a lot of cases)<|eor|><|soopr|>I think the last character is parsed as timezone. I've tried it with different characters and apparently every character seems to be a different timezone.
Why x is GMT-11:00 is beyond me though.<|eoopr|><|sor|>Because that's what the timezone is named in nautical time.
> In the section names, the letter after the offset is that used in nautical time. If present, a dagger () indicates the usage of a nautical time zone letter outside of the standard geographic definition of that time zone.
http://en.wikipedia.org/wiki/List_of_UTC_time_offsets
http://en.wikipedia.org/wiki/List_of_military_time_zones<|eor|><|sor|>So it's not a php fuckup?<|eor|><|sor|>No it is - it's not a reasonable behaviour of the function. Just because we can work out why the insanity is occurring doesn't stop it being such :) It should obviously ignore it / throw an error.
You're passing a date, you don't expect a random letter to mean a timezone
<|eor|><|eols|><|endoftext|> | 28 |
lolphp | philipwhiuk | croq969 | <|sols|><|sot|>2001-01-0x is a valid date<|eot|><|sol|>http://3v4l.org/JFnc4<|eol|><|sor|>I can see what happens here
The x is not parsed any more, so the parsed date ends up to be 2000-12-31, since if you take the 0th day of a month, it always leaps to the last day of the previous month(which is actually useful in a lot of cases)<|eor|><|soopr|>I think the last character is parsed as timezone. I've tried it with different characters and apparently every character seems to be a different timezone.
Why x is GMT-11:00 is beyond me though.<|eoopr|><|sor|>Because that's what the timezone is named in nautical time.
> In the section names, the letter after the offset is that used in nautical time. If present, a dagger () indicates the usage of a nautical time zone letter outside of the standard geographic definition of that time zone.
http://en.wikipedia.org/wiki/List_of_UTC_time_offsets
http://en.wikipedia.org/wiki/List_of_military_time_zones<|eor|><|eols|><|endoftext|> | 26 |
lolphp | kinsi55 | croporl | <|sols|><|sot|>2001-01-0x is a valid date<|eot|><|sol|>http://3v4l.org/JFnc4<|eol|><|sor|>I can see what happens here
The x is not parsed any more, so the parsed date ends up to be 2000-12-31, since if you take the 0th day of a month, it always leaps to the last day of the previous month(which is actually useful in a lot of cases)<|eor|><|eols|><|endoftext|> | 22 |
lolphp | jadkik94 | croq58t | <|sols|><|sot|>2001-01-0x is a valid date<|eot|><|sol|>http://3v4l.org/JFnc4<|eol|><|sor|>I can see what happens here
The x is not parsed any more, so the parsed date ends up to be 2000-12-31, since if you take the 0th day of a month, it always leaps to the last day of the previous month(which is actually useful in a lot of cases)<|eor|><|soopr|>I think the last character is parsed as timezone. I've tried it with different characters and apparently every character seems to be a different timezone.
Why x is GMT-11:00 is beyond me though.<|eoopr|><|eols|><|endoftext|> | 18 |
lolphp | maweki | crovabl | <|sols|><|sot|>2001-01-0x is a valid date<|eot|><|sol|>http://3v4l.org/JFnc4<|eol|><|sor|>I can see what happens here
The x is not parsed any more, so the parsed date ends up to be 2000-12-31, since if you take the 0th day of a month, it always leaps to the last day of the previous month(which is actually useful in a lot of cases)<|eor|><|soopr|>I think the last character is parsed as timezone. I've tried it with different characters and apparently every character seems to be a different timezone.
Why x is GMT-11:00 is beyond me though.<|eoopr|><|sor|>Because that's what the timezone is named in nautical time.
> In the section names, the letter after the offset is that used in nautical time. If present, a dagger () indicates the usage of a nautical time zone letter outside of the standard geographic definition of that time zone.
http://en.wikipedia.org/wiki/List_of_UTC_time_offsets
http://en.wikipedia.org/wiki/List_of_military_time_zones<|eor|><|sor|>So it's not a php fuckup?<|eor|><|sor|>No it is - it's not a reasonable behaviour of the function. Just because we can work out why the insanity is occurring doesn't stop it being such :) It should obviously ignore it / throw an error.
You're passing a date, you don't expect a random letter to mean a timezone
<|eor|><|sor|>Funny enough, the documentation (http://php.net/manual/de/class.datetime.php) does not have a single example for timezones not being a "random letter".
const string ATOM = "Y-m-d\TH:i:sP" ;
const string COOKIE = "l, d-M-Y H:i:s T" ;
const string ISO8601 = "Y-m-d\TH:i:sO" ;
const string RFC822 = "D, d M y H:i:s O" ;
const string RFC850 = "l, d-M-y H:i:s T" ;
const string RFC1036 = "D, d M y H:i:s O" ;
const string RFC1123 = "D, d M Y H:i:s O" ;
const string RFC2822 = "D, d M Y H:i:s O" ;
const string RFC3339 = "Y-m-d\TH:i:sP" ;
const string RSS = "D, d M Y H:i:s O" ;
const string W3C = "Y-m-d\TH:i:sP" ;
I didn't even know these letter-encoding existed.<|eor|><|eols|><|endoftext|> | 14 |
lolphp | iWaterPlants | crotaoj | <|sols|><|sot|>2001-01-0x is a valid date<|eot|><|sol|>http://3v4l.org/JFnc4<|eol|><|sor|>I can see what happens here
The x is not parsed any more, so the parsed date ends up to be 2000-12-31, since if you take the 0th day of a month, it always leaps to the last day of the previous month(which is actually useful in a lot of cases)<|eor|><|soopr|>I think the last character is parsed as timezone. I've tried it with different characters and apparently every character seems to be a different timezone.
Why x is GMT-11:00 is beyond me though.<|eoopr|><|sor|>Because that's what the timezone is named in nautical time.
> In the section names, the letter after the offset is that used in nautical time. If present, a dagger () indicates the usage of a nautical time zone letter outside of the standard geographic definition of that time zone.
http://en.wikipedia.org/wiki/List_of_UTC_time_offsets
http://en.wikipedia.org/wiki/List_of_military_time_zones<|eor|><|sor|>So it's not a php fuckup?<|eor|><|eols|><|endoftext|> | 8 |
lolphp | jadkik94 | crovavw | <|sols|><|sot|>2001-01-0x is a valid date<|eot|><|sol|>http://3v4l.org/JFnc4<|eol|><|sor|>I can see what happens here
The x is not parsed any more, so the parsed date ends up to be 2000-12-31, since if you take the 0th day of a month, it always leaps to the last day of the previous month(which is actually useful in a lot of cases)<|eor|><|soopr|>I think the last character is parsed as timezone. I've tried it with different characters and apparently every character seems to be a different timezone.
Why x is GMT-11:00 is beyond me though.<|eoopr|><|sor|>Because that's what the timezone is named in nautical time.
> In the section names, the letter after the offset is that used in nautical time. If present, a dagger () indicates the usage of a nautical time zone letter outside of the standard geographic definition of that time zone.
http://en.wikipedia.org/wiki/List_of_UTC_time_offsets
http://en.wikipedia.org/wiki/List_of_military_time_zones<|eor|><|sor|>So it's not a php fuckup?<|eor|><|sor|>No it is - it's not a reasonable behaviour of the function. Just because we can work out why the insanity is occurring doesn't stop it being such :) It should obviously ignore it / throw an error.
You're passing a date, you don't expect a random letter to mean a timezone
<|eor|><|soopr|>It also doesn't accept "M*" while it accepts "M". It probably has another cryptic character it accepts for those!<|eoopr|><|eols|><|endoftext|> | 7 |
lolphp | cbraga | croxqj0 | <|sols|><|sot|>2001-01-0x is a valid date<|eot|><|sol|>http://3v4l.org/JFnc4<|eol|><|sor|>I can see what happens here
The x is not parsed any more, so the parsed date ends up to be 2000-12-31, since if you take the 0th day of a month, it always leaps to the last day of the previous month(which is actually useful in a lot of cases)<|eor|><|soopr|>I think the last character is parsed as timezone. I've tried it with different characters and apparently every character seems to be a different timezone.
Why x is GMT-11:00 is beyond me though.<|eoopr|><|sor|>Because that's what the timezone is named in nautical time.
> In the section names, the letter after the offset is that used in nautical time. If present, a dagger () indicates the usage of a nautical time zone letter outside of the standard geographic definition of that time zone.
http://en.wikipedia.org/wiki/List_of_UTC_time_offsets
http://en.wikipedia.org/wiki/List_of_military_time_zones<|eor|><|sor|>So it's not a php fuckup?<|eor|><|sor|>Not even in C does the calendar begin with the 0th day<|eor|><|eols|><|endoftext|> | 6 |
lolphp | stesch | 2oyxs8 | <|sols|><|sot|>PHP :: Bug #53711 :: Casting float->string->float with locale<|eot|><|sol|>https://bugs.php.net/bug.php?id=53711<|eol|><|eols|><|endoftext|> | 54 |
lolphp | cfreak2399 | cmrrikt | <|sols|><|sot|>PHP :: Bug #53711 :: Casting float->string->float with locale<|eot|><|sol|>https://bugs.php.net/bug.php?id=53711<|eol|><|sor|>Heh "won't fix". Essentially because fixing it would be hard. <|eor|><|eols|><|endoftext|> | 35 |
lolphp | Dave9876 | cmsm59f | <|sols|><|sot|>PHP :: Bug #53711 :: Casting float->string->float with locale<|eot|><|sol|>https://bugs.php.net/bug.php?id=53711<|eol|><|sor|>>This may not be intuitive, or even particularly useful, but it is long
standing (and intended) behaviour, per (among many others) bug #31963
and doc bug #38785. I don't see any way to change this without a
massive backward compatibility break.
Uh, wait. The only who would notice the "break in backward compatibility" would be so thrilled to see it fixed, I'm sure.
As someone who lives in a country with such a locale, I can safely state that this is unwanted behavior.
Either *both* conversions should respect locale, or *neither*.
But this, this is the worst of both worlds.<|eor|><|sor|>PHP: The worst of both worlds!<|eor|><|eols|><|endoftext|> | 26 |
lolphp | Retzudo | cmrtjkw | <|sols|><|sot|>PHP :: Bug #53711 :: Casting float->string->float with locale<|eot|><|sol|>https://bugs.php.net/bug.php?id=53711<|eol|><|sor|>> This may not be intuitive, or even particularly useful, but it is long
standing (and intended) behaviour, per (among many others) bug #31963
and doc bug #38785.
It's not useful or intuitive but intended behaviour. Welp...can't say anything against that!<|eor|><|eols|><|endoftext|> | 25 |
lolphp | cbraga | cmrsm09 | <|sols|><|sot|>PHP :: Bug #53711 :: Casting float->string->float with locale<|eot|><|sol|>https://bugs.php.net/bug.php?id=53711<|eol|><|sor|>Heh "won't fix". Essentially because fixing it would be hard. <|eor|><|sor|>And the proposed solution: create an .ini setting.
Pure gold.<|eor|><|eols|><|endoftext|> | 25 |
lolphp | bart2019 | cms9eao | <|sols|><|sot|>PHP :: Bug #53711 :: Casting float->string->float with locale<|eot|><|sol|>https://bugs.php.net/bug.php?id=53711<|eol|><|sor|>>This may not be intuitive, or even particularly useful, but it is long
standing (and intended) behaviour, per (among many others) bug #31963
and doc bug #38785. I don't see any way to change this without a
massive backward compatibility break.
Uh, wait. The only who would notice the "break in backward compatibility" would be so thrilled to see it fixed, I'm sure.
As someone who lives in a country with such a locale, I can safely state that this is unwanted behavior.
Either *both* conversions should respect locale, or *neither*.
But this, this is the worst of both worlds.<|eor|><|eols|><|endoftext|> | 20 |
lolphp | TheOnlyMrYeah | cmscrpd | <|sols|><|sot|>PHP :: Bug #53711 :: Casting float->string->float with locale<|eot|><|sol|>https://bugs.php.net/bug.php?id=53711<|eol|><|sor|>> This may not be intuitive, or even particularly useful, but it is long standing (and intended) behaviour
I translate:
> It's shit and I know it's shit, but it's documented shit so this shit stays.<|eor|><|eols|><|endoftext|> | 18 |
lolphp | Dave9876 | cmtan3g | <|sols|><|sot|>PHP :: Bug #53711 :: Casting float->string->float with locale<|eot|><|sol|>https://bugs.php.net/bug.php?id=53711<|eol|><|sor|>Heh "won't fix". Essentially because fixing it would be hard. <|eor|><|sor|>And the proposed solution: create an .ini setting.
Pure gold.<|eor|><|sor|>Even better that the .ini solution defaults to "stay_broken = true"
<|eor|><|sor|>Nono, it's "keep_backwards_compatibility_at_all_costs = true", duh
Edit: Add important last bit<|eor|><|sor|>Too much english, obviously we should use esperanto for it:
konservi_malantaen_kongruo = true<|eor|><|eols|><|endoftext|> | 10 |
lolphp | bart2019 | cmsr39b | <|sols|><|sot|>PHP :: Bug #53711 :: Casting float->string->float with locale<|eot|><|sol|>https://bugs.php.net/bug.php?id=53711<|eol|><|sor|>>This may not be intuitive, or even particularly useful, but it is long
standing (and intended) behaviour, per (among many others) bug #31963
and doc bug #38785. I don't see any way to change this without a
massive backward compatibility break.
Uh, wait. The only who would notice the "break in backward compatibility" would be so thrilled to see it fixed, I'm sure.
As someone who lives in a country with such a locale, I can safely state that this is unwanted behavior.
Either *both* conversions should respect locale, or *neither*.
But this, this is the worst of both worlds.<|eor|><|sor|>They probably wouldn't be thrilled to see it fixed, because everyone writing apps for the non-English-speaking market now has to change their code to continue parsing commas properly in numbers.
I mean, there are two options:
* Always ignore locale (breaks lots of existing code, especially for non-English speakers)
* Always use locale (also breaks lots of code)
Either way, you piss off a lot of people.<|eor|><|sor|>As someone who writes such code, I can tell you what we do: we replace commas with periods, so people can use *either* a comma or a period. Only one is allowed, so "12.345,678" is forbidden. (The thousands separator is for readability, not for inputting data. *Nobody* inputs numbers this way, except maybe through copy/paste.)
If you do it any other way, you may be more friendly for the lazy programmer, but you sure will piss off a lot of *users*, because different websites expect their input in different ways.<|eor|><|eols|><|endoftext|> | 9 |
lolphp | jamieflournoy | cmsi3oi | <|sols|><|sot|>PHP :: Bug #53711 :: Casting float->string->float with locale<|eot|><|sol|>https://bugs.php.net/bug.php?id=53711<|eol|><|sor|>For comparison:
keith@Keiths-Hackintosh ~ $ irb
2.0.0-p247 :001 > (1234.56.to_s).to_f == 1234.56
=> true
<|eor|><|sor|>Hm, what happens if you change the locale? <|eor|><|sor|>There's no global locale to be set. *Encoding*, sure, but that should almost always be UTF-8, and strings track their encoding (so converting a float to a string and then changing the global encoding doesn't affect the existing string).
If you want to output a number in a locale-specific way, you use a library which understands locales (like the I18n library, which is part of the standard library). There is literally no explanation for PHP's incorrect behavior other than bad design.<|eor|><|sor|>1234.56 is as much a locale-specific way of formatting a float as 1234,56 is. Locales don't just mean "non-US_English places".<|eor|><|eols|><|endoftext|> | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.