subreddit stringclasses 7
values | author stringlengths 3 20 | id stringlengths 5 7 | content stringlengths 67 30.4k | score int64 0 140k |
|---|---|---|---|---|
lolphp | cythrawll | cgcxpvg | <|sols|><|sot|>htmlentities only displays an error when display_errors is off<|eot|><|sol|>http://insomanic.me.uk/post/191397106/php-htmlspecialchars-htmlentities-invalid<|eol|><|soopr|>Don't worry though, [it's intentional](https://bugs.php.net/bug.php?id=47494)!<|eoopr|><|sor|>I have no words. <|eor|><|soopr|>Mine wa... | 11 |
lolphp | Wompuz | t35bj | <|sols|><|sot|>HORSE<|eot|><|sol|>http://i.imgur.com/1zgFd.jpg<|eol|><|eols|><|endoftext|> | 58 |
lolphp | mestore | c4j4xok | <|sols|><|sot|>HORSE<|eot|><|sol|>http://i.imgur.com/1zgFd.jpg<|eol|><|sor|>I know the community gives php a lot of hate, and 'horse' should never be returned. But let us be honest here, if you code like that, whose fault is it really?
(I think the proper shorthand in php is to wrap each layer in parens)<|eor|><|eols... | 23 |
lolphp | mofrodo | c4j672h | <|sols|><|sot|>HORSE<|eot|><|sol|>http://i.imgur.com/1zgFd.jpg<|eol|><|sor|>There is nothing wrong with this statement.
The first condition is true, which returns the string 'CAR', which also equals to TRUE, which in turn returns 'HORSE'.
But anyway, if you code like this, you're a moron.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | mostrandomguy | 2tpxc9 | <|sols|><|sot|>if ("6 Chickens" + "4 Geese" == "10 Birds")<|eot|><|sol|>http://codepad.org/Ctwy50Nk<|eol|><|eols|><|endoftext|> | 63 |
lolphp | deadstone | co1ckl7 | <|sols|><|sot|>if ("6 Chickens" + "4 Geese" == "10 Birds")<|eot|><|sol|>http://codepad.org/Ctwy50Nk<|eol|><|sor|><|eor|><|sor|>> This has been beaten to death a hundreds of times; php's type coercion when using == is insane, and you should never use ==.
Except this is worse. `"6 Chickens" + "4 Geese" === 10` will stil... | 32 |
lolphp | HiddenKrypt | co1sw2h | <|sols|><|sot|>if ("6 Chickens" + "4 Geese" == "10 Birds")<|eot|><|sol|>http://codepad.org/Ctwy50Nk<|eol|><|sor|>Ahh, a prime example of "is a" inheritance. See, PHP is smart enough to know that geese and chickens are both birds!<|eor|><|eols|><|endoftext|> | 16 |
lolphp | quenoz | co1fa8u | <|sols|><|sot|>if ("6 Chickens" + "4 Geese" == "10 Birds")<|eot|><|sol|>http://codepad.org/Ctwy50Nk<|eol|><|sor|>I can simulate this behavior in C++11:
http://ideone.com/2lZEWd
Now chickens are statically typed ;)<|eor|><|sor|>See, in php you don't need all those preparations, php > c++ confirmed. /s<|eor|><|eols|><|e... | 15 |
lolphp | myaut | co1c41j | <|sols|><|sot|>if ("6 Chickens" + "4 Geese" == "10 Birds")<|eot|><|sol|>http://codepad.org/Ctwy50Nk<|eol|><|sor|>I can simulate this behavior in C++11:
http://ideone.com/2lZEWd
Now chickens are statically typed ;)<|eor|><|eols|><|endoftext|> | 14 |
lolphp | Sgeo | co1el3a | <|sols|><|sot|>if ("6 Chickens" + "4 Geese" == "10 Birds")<|eot|><|sol|>http://codepad.org/Ctwy50Nk<|eol|><|sor|>Why does this work? Does php just automatically convert the strings to numbers? What if you want to compare strings?<|eor|><|sor|>Always use ===<|eor|><|sor|>See other comments in thread.<|eor|><|eols|><|end... | 10 |
lolphp | InconsiderateBastard | co20swo | <|sols|><|sot|>if ("6 Chickens" + "4 Geese" == "10 Birds")<|eot|><|sol|>http://codepad.org/Ctwy50Nk<|eol|><|sor|><|eor|><|sor|>> This has been beaten to death a hundreds of times; php's type coercion when using == is insane, and you should never use ==.
Except this is worse. `"6 Chickens" + "4 Geese" === 10` will stil... | 10 |
lolphp | ZiggyTheHamster | co202cf | <|sols|><|sot|>if ("6 Chickens" + "4 Geese" == "10 Birds")<|eot|><|sol|>http://codepad.org/Ctwy50Nk<|eol|><|sor|><|eor|><|sor|>> This has been beaten to death a hundreds of times; php's type coercion when using == is insane, and you should never use ==.
Except this is worse. `"6 Chickens" + "4 Geese" === 10` will stil... | 10 |
lolphp | barubary | co2cfbz | <|sols|><|sot|>if ("6 Chickens" + "4 Geese" == "10 Birds")<|eot|><|sol|>http://codepad.org/Ctwy50Nk<|eol|><|sor|>Oh God, I've had a few times where I've used `+` instead of `.` and spent hours trying to track down the bug, since `+` is basically the standard string concatenation operator in almost every language ever.<... | 9 |
lolphp | Various_Pickles | co26uf0 | <|sols|><|sot|>if ("6 Chickens" + "4 Geese" == "10 Birds")<|eot|><|sol|>http://codepad.org/Ctwy50Nk<|eol|><|sor|>Although, yes, this is an ancient and well-known *feature* of PHP, I despise the fact that people try to explain it away as "type coercion".
Type coercion is perfectly acceptable (and wonderful) in situatio... | 8 |
lolphp | hipsterhacker | co3ef1s | <|sols|><|sot|>if ("6 Chickens" + "4 Geese" == "10 Birds")<|eot|><|sol|>http://codepad.org/Ctwy50Nk<|eol|><|sor|>Oh God, I've had a few times where I've used `+` instead of `.` and spent hours trying to track down the bug, since `+` is basically the standard string concatenation operator in almost every language ever.<... | 8 |
lolphp | ealf | 1wgrc6 | <|sols|><|sot|>That preg_replace('/(.+)/e', 'foo("$1")') construct that got eBay hacked over a month ago (and Yahoo this week)? The official documentation still uses it as an example.<|eot|><|sol|>http://php.net/preg_replace<|eol|><|eols|><|endoftext|> | 63 |
lolphp | ealf | cf1sfgp | <|sols|><|sot|>That preg_replace('/(.+)/e', 'foo("$1")') construct that got eBay hacked over a month ago (and Yahoo this week)? The official documentation still uses it as an example.<|eot|><|sol|>http://php.net/preg_replace<|eol|><|soopr|>> When using the deprecated e modifier, this function escapes some characters (n... | 20 |
lolphp | ealf | cf24j54 | <|sols|><|sot|>That preg_replace('/(.+)/e', 'foo("$1")') construct that got eBay hacked over a month ago (and Yahoo this week)? The official documentation still uses it as an example.<|eot|><|sol|>http://php.net/preg_replace<|eol|><|sor|>Links for where this was used to hack those sites?<|eor|><|soopr|>http://www.secal... | 11 |
lolphp | PasswordIsntHAMSTER | cf1trdk | <|sols|><|sot|>That preg_replace('/(.+)/e', 'foo("$1")') construct that got eBay hacked over a month ago (and Yahoo this week)? The official documentation still uses it as an example.<|eot|><|sol|>http://php.net/preg_replace<|eol|><|sor|>Example #2 completely baffles my mind.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | dehrmann | cf27q69 | <|sols|><|sot|>That preg_replace('/(.+)/e', 'foo("$1")') construct that got eBay hacked over a month ago (and Yahoo this week)? The official documentation still uses it as an example.<|eot|><|sol|>http://php.net/preg_replace<|eol|><|soopr|>> When using the deprecated e modifier, this function escapes some characters (n... | 7 |
lolphp | _vec_ | cf1y862 | <|sols|><|sot|>That preg_replace('/(.+)/e', 'foo("$1")') construct that got eBay hacked over a month ago (and Yahoo this week)? The official documentation still uses it as an example.<|eot|><|sol|>http://php.net/preg_replace<|eol|><|sor|>Example #2 completely baffles my mind.<|eor|><|sor|>Seriously. What's up with that... | 7 |
lolphp | seventoes | cf1vwqe | <|sols|><|sot|>That preg_replace('/(.+)/e', 'foo("$1")') construct that got eBay hacked over a month ago (and Yahoo this week)? The official documentation still uses it as an example.<|eot|><|sol|>http://php.net/preg_replace<|eol|><|sor|>Example #2 completely baffles my mind.<|eor|><|sor|>Seriously. What's up with that... | 5 |
lolphp | Serialk | 1asgn4 | <|sols|><|sot|>"Because an inconsistency between namespace separator '::' and ternary operator's ':' could not be solved, namespace were finally removed."<|eot|><|sol|>https://wiki.php.net/rfc/namespacecurlies<|eol|><|eols|><|endoftext|> | 58 |
lolphp | scshunt | c90cykm | <|sols|><|sot|>"Because an inconsistency between namespace separator '::' and ternary operator's ':' could not be solved, namespace were finally removed."<|eot|><|sol|>https://wiki.php.net/rfc/namespacecurlies<|eol|><|sor|>Apparently there was no issue with \ and escape sequences, though.<|eor|><|eols|><|endoftext|> | 20 |
lolphp | vytah | c90icnx | <|sols|><|sot|>"Because an inconsistency between namespace separator '::' and ternary operator's ':' could not be solved, namespace were finally removed."<|eot|><|sol|>https://wiki.php.net/rfc/namespacecurlies<|eol|><|sor|>PHP parsing and lexing is just a nightmare.<|eor|><|sor|>PHP is only lexed, it's not parsed. The ... | 20 |
lolphp | dipswitch | c90x4uj | <|sols|><|sot|>"Because an inconsistency between namespace separator '::' and ternary operator's ':' could not be solved, namespace were finally removed."<|eot|><|sol|>https://wiki.php.net/rfc/namespacecurlies<|eol|><|sor|>PHP parsing and lexing is just a nightmare.<|eor|><|sor|>PHP is only lexed, it's not parsed. The ... | 14 |
lolphp | Serialk | c90d0vq | <|sols|><|sot|>"Because an inconsistency between namespace separator '::' and ternary operator's ':' could not be solved, namespace were finally removed."<|eot|><|sol|>https://wiki.php.net/rfc/namespacecurlies<|eol|><|soopr|>It is worth noting that I found this via this RFC : https://wiki.php.net/rfc/namespaceseparator... | 11 |
lolphp | cythrawll | c90dvm1 | <|sols|><|sot|>"Because an inconsistency between namespace separator '::' and ternary operator's ':' could not be solved, namespace were finally removed."<|eot|><|sol|>https://wiki.php.net/rfc/namespacecurlies<|eol|><|sor|>PHP parsing and lexing is just a nightmare.<|eor|><|eols|><|endoftext|> | 10 |
lolphp | chellomere | c9a8649 | <|sols|><|sot|>"Because an inconsistency between namespace separator '::' and ternary operator's ':' could not be solved, namespace were finally removed."<|eot|><|sol|>https://wiki.php.net/rfc/namespacecurlies<|eol|><|sor|>PHP: a language dictated by what a lexer can do.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | vsync | c90tnd0 | <|sols|><|sot|>"Because an inconsistency between namespace separator '::' and ternary operator's ':' could not be solved, namespace were finally removed."<|eot|><|sol|>https://wiki.php.net/rfc/namespacecurlies<|eol|><|sor|>> With the new implementation and no blocks, many people expected one namespace per file.
> Since... | 8 |
lolphp | Packet_Ranger | c90r2vw | <|sols|><|sot|>"Because an inconsistency between namespace separator '::' and ternary operator's ':' could not be solved, namespace were finally removed."<|eot|><|sol|>https://wiki.php.net/rfc/namespacecurlies<|eol|><|soopr|>It is worth noting that I found this via this RFC : https://wiki.php.net/rfc/namespaceseparator... | 8 |
lolphp | hahainternet | c90f4e7 | <|sols|><|sot|>"Because an inconsistency between namespace separator '::' and ternary operator's ':' could not be solved, namespace were finally removed."<|eot|><|sol|>https://wiki.php.net/rfc/namespacecurlies<|eol|><|soopr|>It is worth noting that I found this via this RFC : https://wiki.php.net/rfc/namespaceseparator... | 6 |
lolphp | Sheepshow | c90mm9r | <|sols|><|sot|>"Because an inconsistency between namespace separator '::' and ternary operator's ':' could not be solved, namespace were finally removed."<|eot|><|sol|>https://wiki.php.net/rfc/namespacecurlies<|eol|><|soopr|>It is worth noting that I found this via this RFC : https://wiki.php.net/rfc/namespaceseparator... | 6 |
lolphp | poizan42 | c920108 | <|sols|><|sot|>"Because an inconsistency between namespace separator '::' and ternary operator's ':' could not be solved, namespace were finally removed."<|eot|><|sol|>https://wiki.php.net/rfc/namespacecurlies<|eol|><|sor|>PHP parsing and lexing is just a nightmare.<|eor|><|sor|>PHP is only lexed, it's not parsed. The ... | 5 |
lolphp | ScriptFUSION | 7z5bcq | <|soss|><|sot|>"last week" relative date is special cased<|eot|><|sost|>"Last year", "last month", "last day", "last hour", etc. all take the current date and subtract the specified period. So `last year` would be February 21^st, 2017 if executed on the date of this post.
What about "last week"? Surely it would be sev... | 59 |
lolphp | ScriptFUSION | dulm5br | <|soss|><|sot|>"last week" relative date is special cased<|eot|><|sost|>"Last year", "last month", "last day", "last hour", etc. all take the current date and subtract the specified period. So `last year` would be February 21^st, 2017 if executed on the date of this post.
What about "last week"? Surely it would be sev... | 20 |
lolphp | eztab | dulyh8k | <|soss|><|sot|>"last week" relative date is special cased<|eot|><|sost|>"Last year", "last month", "last day", "last hour", etc. all take the current date and subtract the specified period. So `last year` would be February 21^st, 2017 if executed on the date of this post.
What about "last week"? Surely it would be sev... | 8 |
lolphp | jesseschalken | duzidlq | <|soss|><|sot|>"last week" relative date is special cased<|eot|><|sost|>"Last year", "last month", "last day", "last hour", etc. all take the current date and subtract the specified period. So `last year` would be February 21^st, 2017 if executed on the date of this post.
What about "last week"? Surely it would be sev... | 7 |
lolphp | ScriptFUSION | dumaelf | <|soss|><|sot|>"last week" relative date is special cased<|eot|><|sost|>"Last year", "last month", "last day", "last hour", etc. all take the current date and subtract the specified period. So `last year` would be February 21^st, 2017 if executed on the date of this post.
What about "last week"? Surely it would be sev... | 7 |
lolphp | defiante1 | 3fhpd0 | <|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|eols|><|endoftext|> | 61 |
lolphp | livid_taco | ctopd7a | <|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>PHP Quantum physics again; introspecting something changes it's value.
^(Not my joke, found it somewhere here)<|eor|><|eols|><|endoftext|> | 30 |
lolphp | midir | ctouclt | <|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>PHP Quantum physics again; introspecting something changes it's value.
^(Not my joke, found it somewhere here)<|eor|><|sor|>Your reddit account appears to be [shadowbanned](/r/shad... | 18 |
lolphp | jrh3k5 | ctot7lb | <|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>What baffles me even more is the fact that apparently there is a class `DateTimeImmutable`, which kind of implies that the "regular" date/time type is mutable. Why would one ever wa... | 15 |
lolphp | tdammers | ctosz2y | <|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>What baffles me even more is the fact that apparently there is a class `DateTimeImmutable`, which kind of implies that the "regular" date/time type is mutable. Why would one ever wa... | 14 |
lolphp | jrh3k5 | ctovayc | <|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>What baffles me even more is the fact that apparently there is a class `DateTimeImmutable`, which kind of implies that the "regular" date/time type is mutable. Why would one ever wa... | 11 |
lolphp | ThisIsADogHello | ctoyjbz | <|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>PHP Quantum physics again; introspecting something changes it's value.
^(Not my joke, found it somewhere here)<|eor|><|sor|>Your reddit account appears to be [shadowbanned](/r/shad... | 10 |
lolphp | tdammers | ctouia7 | <|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>What baffles me even more is the fact that apparently there is a class `DateTimeImmutable`, which kind of implies that the "regular" date/time type is mutable. Why would one ever wa... | 9 |
lolphp | Schmittfried | ctp7aq9 | <|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>Don't forget DateTimeImmutable.Modify(). IIRC it returns a new instance of DateTimeImmutable, and exists so the API matches DateTime (mutable), but that doesn't make it right!<|eor|... | 8 |
lolphp | greenthumble | ctp5u04 | <|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>Don't forget DateTimeImmutable.Modify(). IIRC it returns a new instance of DateTimeImmutable, and exists so the API matches DateTime (mutable), but that doesn't make it right!<|eor|... | 7 |
lolphp | poizan42 | ctpklgu | <|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>PHP Quantum physics again; introspecting something changes it's value.
^(Not my joke, found it somewhere here)<|eor|><|sor|>Your reddit account appears to be [shadowbanned](/r/shad... | 7 |
lolphp | HildartheDorf | ctot6hs | <|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>Don't forget DateTimeImmutable.Modify(). IIRC it returns a new instance of DateTimeImmutable, and exists so the API matches DateTime (mutable), but that doesn't make it right!<|eor|... | 6 |
lolphp | tdammers | ctovbxi | <|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>What baffles me even more is the fact that apparently there is a class `DateTimeImmutable`, which kind of implies that the "regular" date/time type is mutable. Why would one ever wa... | 6 |
lolphp | gearvOsh | ctp4cbx | <|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>What baffles me even more is the fact that apparently there is a class `DateTimeImmutable`, which kind of implies that the "regular" date/time type is mutable. Why would one ever wa... | 5 |
lolphp | tdammers | ctp6pa9 | <|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>What baffles me even more is the fact that apparently there is a class `DateTimeImmutable`, which kind of implies that the "regular" date/time type is mutable. Why would one ever wa... | 5 |
lolphp | andsens | 2tywp9 | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|eols|><|endoftext|> | 62 |
lolphp | callcifer | co3ocln | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|sor|>In true PHP fashion, to parse ini strings in a non-retarded way you need to do this:
parse_ini_string($str, false, INI_SCANNER_RAW);<|eor|><|eols|><|endoftext|> | 23 |
lolphp | andsens | co3v9u4 | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|sor|>Actually `"no"==false` and `"yes"==true, but "" and "1" is what you get if you convert them to strings.
php -r "var_dump(false.'');"
string(0) ""
php -r "var_dump(true.'');"
string(1) "1"
php -r "var_dump... | 19 |
lolphp | callcifer | co4efbh | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|sor|>I don't understand the problem with this one... seems fairly intuitive to me. Can someone explain what I'm missing?<|eor|><|sor|>You are reading key value pairs from an ini line where the values are country codes. This works fine fo... | 18 |
lolphp | gearvOsh | co3q1zi | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|sor|>Actually `"no"==false` and `"yes"==true, but "" and "1" is what you get if you convert them to strings.
php -r "var_dump(false.'');"
string(0) ""
php -r "var_dump(true.'');"
string(1) "1"
php -r "var_dump... | 16 |
lolphp | bart2019 | co3l4gn | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|sor|>Actually `"no"==false` and `"yes"==true, but "" and "1" is what you get if you convert them to strings.
php -r "var_dump(false.'');"
string(0) ""
php -r "var_dump(true.'');"
string(1) "1"
php -r "var_dump... | 15 |
lolphp | andsens | co3vfk8 | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|sor|>In true PHP fashion, to parse ini strings in a non-retarded way you need to do this:
parse_ini_string($str, false, INI_SCANNER_RAW);<|eor|><|soopr|>That's what I ended up doing. It's funny how whatever you think the sane defaul... | 13 |
lolphp | memoryspaceglitch | co3qn06 | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|sor|>Wait, how do you do if you're norwegian?<|eor|><|eols|><|endoftext|> | 12 |
lolphp | callcifer | co4uvue | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|sor|>In true PHP fashion, to parse ini strings in a non-retarded way you need to do this:
parse_ini_string($str, false, INI_SCANNER_RAW);<|eor|><|soopr|>That's what I ended up doing. It's funny how whatever you think the sane defaul... | 12 |
lolphp | andsens | co3uxuf | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|soopr|>I thought I was going insane, because somehow the standard language was fine with being anything else but norwegian.
When you're up to your neck in various sql statements that cannot be prepared because some string is empty, you... | 11 |
lolphp | ConcernedInScythe | co8n720 | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|sor|>In true PHP fashion, to parse ini strings in a non-retarded way you need to do this:
parse_ini_string($str, false, INI_SCANNER_RAW);<|eor|><|soopr|>That's what I ended up doing. It's funny how whatever you think the sane defaul... | 11 |
lolphp | LeartS | co3peaf | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|sor|>Actually `"no"==false` and `"yes"==true, but "" and "1" is what you get if you convert them to strings.
php -r "var_dump(false.'');"
string(0) ""
php -r "var_dump(true.'');"
string(1) "1"
php -r "var_dump... | 9 |
lolphp | andsens | co3zc4k | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|sor|>Wait, how do you do if you're norwegian?<|eor|><|sor|>There's no such thing as Norway or Norwegian language. It's all part of the Glorious Kingdom of Denmark.
Source: Rasmus Lerdorf is Danish.<|eor|><|soopr|>Yeah. We're not too pro... | 9 |
lolphp | Martin8412 | co414sc | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|sor|>Wait, how do you do if you're norwegian?<|eor|><|sor|>There's no such thing as Norway or Norwegian language. It's all part of the Glorious Kingdom of Denmark.
Source: Rasmus Lerdorf is Danish.<|eor|><|soopr|>Yeah. We're not too pro... | 9 |
lolphp | vytah | co3z0qf | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|sor|>Wait, how do you do if you're norwegian?<|eor|><|sor|>There's no such thing as Norway or Norwegian language. It's all part of the Glorious Kingdom of Denmark.
Source: Rasmus Lerdorf is Danish.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | LeartS | co3q66b | <|sols|><|sot|>'no' == ''; 'yes' == '1'<|eot|><|sol|>http://3v4l.org/8ILmg<|eol|><|sor|>Actually `"no"==false` and `"yes"==true, but "" and "1" is what you get if you convert them to strings.
php -r "var_dump(false.'');"
string(0) ""
php -r "var_dump(true.'');"
string(1) "1"
php -r "var_dump... | 5 |
lolphp | aleczapka | 2e3dxy | <|sols|><|sot|>What's the most cursed programming language?<|eot|><|sol|>https://github.com/Dobiasd/programming-language-subreddits-and-their-choice-of-words/blob/master/README.md#cursing<|eol|><|eols|><|endoftext|> | 57 |
lolphp | mrwhistler | cjvq4bq | <|sols|><|sot|>What's the most cursed programming language?<|eot|><|sol|>https://github.com/Dobiasd/programming-language-subreddits-and-their-choice-of-words/blob/master/README.md#cursing<|eol|><|sor|>Shit.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | Aerokaiser | cjvt4wl | <|sols|><|sot|>What's the most cursed programming language?<|eot|><|sol|>https://github.com/Dobiasd/programming-language-subreddits-and-their-choice-of-words/blob/master/README.md#cursing<|eol|><|sor|>Shit.<|eor|><|sor|>Crap.<|eor|><|sor|>Hate.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | polish_niceguy | cjvrybv | <|sols|><|sot|>What's the most cursed programming language?<|eot|><|sol|>https://github.com/Dobiasd/programming-language-subreddits-and-their-choice-of-words/blob/master/README.md#cursing<|eol|><|sor|>Shit.<|eor|><|sor|>Crap.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | Takeoded | ef8ob0 | <|sols|><|sot|>crc32($str) and hash("crc32",$str) use different algorithms (with different results)<|eot|><|sol|>https://3v4l.org/Ng7hi<|eol|><|eols|><|endoftext|> | 59 |
lolphp | Altreus | fc04qhx | <|sols|><|sot|>crc32($str) and hash("crc32",$str) use different algorithms (with different results)<|eot|><|sol|>https://3v4l.org/Ng7hi<|eol|><|soopr|>the crc32() function use an algorithm called "crc32b", and hash("crc32",$d) apparently use "the ITU I.363.5 algorithm" (whatever that is), and if you want crc32b from ha... | 20 |
lolphp | Takeoded | fbyyho2 | <|sols|><|sot|>crc32($str) and hash("crc32",$str) use different algorithms (with different results)<|eot|><|sol|>https://3v4l.org/Ng7hi<|eol|><|soopr|>the crc32() function use an algorithm called "crc32b", and hash("crc32",$d) apparently use "the ITU I.363.5 algorithm" (whatever that is), and if you want crc32b from ha... | 19 |
lolphp | Takeoded | fbyykws | <|sols|><|sot|>crc32($str) and hash("crc32",$str) use different algorithms (with different results)<|eot|><|sol|>https://3v4l.org/Ng7hi<|eol|><|sor|>You use the wrong algorithm. You want "crc32b" when using the hash function:
$str="Wello!";
$h1=dechex(crc32($str));
$h2=hash("crc32b",$str);
var_dump($h1... | 19 |
lolphp | AyrA_ch | fbyyiqx | <|sols|><|sot|>crc32($str) and hash("crc32",$str) use different algorithms (with different results)<|eot|><|sol|>https://3v4l.org/Ng7hi<|eol|><|sor|>You use the wrong algorithm. You want "crc32b" when using the hash function:
$str="Wello!";
$h1=dechex(crc32($str));
$h2=hash("crc32b",$str);
var_dump($h1... | 16 |
lolphp | AyrA_ch | fbyyxk0 | <|sols|><|sot|>crc32($str) and hash("crc32",$str) use different algorithms (with different results)<|eot|><|sol|>https://3v4l.org/Ng7hi<|eol|><|sor|>You use the wrong algorithm. You want "crc32b" when using the hash function:
$str="Wello!";
$h1=dechex(crc32($str));
$h2=hash("crc32b",$str);
var_dump($h1... | 15 |
lolphp | AyrA_ch | fbyyu8w | <|sols|><|sot|>crc32($str) and hash("crc32",$str) use different algorithms (with different results)<|eot|><|sol|>https://3v4l.org/Ng7hi<|eol|><|sor|>You use the wrong algorithm. You want "crc32b" when using the hash function:
$str="Wello!";
$h1=dechex(crc32($str));
$h2=hash("crc32b",$str);
var_dump($h1... | 14 |
lolphp | AyrA_ch | fbzx8nf | <|sols|><|sot|>crc32($str) and hash("crc32",$str) use different algorithms (with different results)<|eot|><|sol|>https://3v4l.org/Ng7hi<|eol|><|sor|>You use the wrong algorithm. You want "crc32b" when using the hash function:
$str="Wello!";
$h1=dechex(crc32($str));
$h2=hash("crc32b",$str);
var_dump($h1... | 11 |
lolphp | dotancohen | fc027ce | <|sols|><|sot|>crc32($str) and hash("crc32",$str) use different algorithms (with different results)<|eot|><|sol|>https://3v4l.org/Ng7hi<|eol|><|soopr|>the crc32() function use an algorithm called "crc32b", and hash("crc32",$d) apparently use "the ITU I.363.5 algorithm" (whatever that is), and if you want crc32b from ha... | 9 |
lolphp | Miserable_Fuck | fc0t6k0 | <|sols|><|sot|>crc32($str) and hash("crc32",$str) use different algorithms (with different results)<|eot|><|sol|>https://3v4l.org/Ng7hi<|eol|><|sor|>You use the wrong algorithm. You want "crc32b" when using the hash function:
$str="Wello!";
$h1=dechex(crc32($str));
$h2=hash("crc32b",$str);
var_dump($h1... | 8 |
lolphp | dotancohen | fc0c0md | <|sols|><|sot|>crc32($str) and hash("crc32",$str) use different algorithms (with different results)<|eot|><|sol|>https://3v4l.org/Ng7hi<|eol|><|soopr|>the crc32() function use an algorithm called "crc32b", and hash("crc32",$d) apparently use "the ITU I.363.5 algorithm" (whatever that is), and if you want crc32b from ha... | 5 |
lolphp | vytah | yxk0x | <|sols|><|sot|>$date->modify('+0 days') adds one hour
<|eot|><|sol|>https://bugs.php.net/bug.php?id=62896<|eol|><|eols|><|endoftext|> | 58 |
lolphp | cwmonkey | c5zsdz7 | <|sols|><|sot|>$date->modify('+0 days') adds one hour
<|eot|><|sol|>https://bugs.php.net/bug.php?id=62896<|eol|><|sor|>Can't wait to hear the reason this isn't a bug!<|eor|><|eols|><|endoftext|> | 20 |
lolphp | Andryu67 | c5zrema | <|sols|><|sot|>$date->modify('+0 days') adds one hour
<|eot|><|sol|>https://bugs.php.net/bug.php?id=62896<|eol|><|sor|>Finally, a /r/lolphp post that legitimately scares me.<|eor|><|eols|><|endoftext|> | 15 |
lolphp | Liorithiel | c5zvvl1 | <|sols|><|sot|>$date->modify('+0 days') adds one hour
<|eot|><|sol|>https://bugs.php.net/bug.php?id=62896<|eol|><|sor|>I bet someone will answer it is not a bug, because calling `modify` with `0` as parameter doesn't make sense.<|eor|><|eols|><|endoftext|> | 14 |
lolphp | vytah | c5zyqlr | <|sols|><|sot|>$date->modify('+0 days') adds one hour
<|eot|><|sol|>https://bugs.php.net/bug.php?id=62896<|eol|><|sor|>I bet someone will answer it is not a bug, because calling `modify` with `0` as parameter doesn't make sense.<|eor|><|soopr|>What do you say about this then?
$date = new DateTime('@'.strtotime('20... | 12 |
lolphp | infinull | c5ztch5 | <|sols|><|sot|>$date->modify('+0 days') adds one hour
<|eot|><|sol|>https://bugs.php.net/bug.php?id=62896<|eol|><|sor|>As far as I am concerned PHP is a hilarious spectator sport.<|eor|><|sor|>Hey man some of us have to maintain code written in PHP...
that we wrote as Freshman.
And by we, I mean me.
Me 4yrs ago was ... | 10 |
lolphp | sumdog | c5zufol | <|sols|><|sot|>$date->modify('+0 days') adds one hour
<|eot|><|sol|>https://bugs.php.net/bug.php?id=62896<|eol|><|sor|>As far as I am concerned PHP is a hilarious spectator sport.<|eor|><|sor|>Hey man some of us have to maintain code written in PHP...
that we wrote as Freshman.
And by we, I mean me.
Me 4yrs ago was ... | 9 |
lolphp | infinull | c5ztd61 | <|sols|><|sot|>$date->modify('+0 days') adds one hour
<|eot|><|sol|>https://bugs.php.net/bug.php?id=62896<|eol|><|sor|>Can't wait to hear the reason this isn't a bug!<|eor|><|sor|>Probably something about timezones (see the full example, datetime with timezone doesn't have the problem)<|eor|><|eols|><|endoftext|> | 6 |
lolphp | esquilax | c5zwvp2 | <|sols|><|sot|>$date->modify('+0 days') adds one hour
<|eot|><|sol|>https://bugs.php.net/bug.php?id=62896<|eol|><|sor|>I bet someone will answer it is not a bug, because calling `modify` with `0` as parameter doesn't make sense.<|eor|><|sor|>It does, for sufficiently large values of 0.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | vytah | c5zotn3 | <|sols|><|sot|>$date->modify('+0 days') adds one hour
<|eot|><|sol|>https://bugs.php.net/bug.php?id=62896<|eol|><|soopr|>I've reproduced the bug for following dates:
$date = new DateTime('@'.strtotime('2012-08-22 00:00:00 CEST'));
echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n";
$d... | 5 |
lolphp | ealf | kso6p | <|sols|><|sot|>If error reporting is on, htmlspecialchars() will ignore invalid strings silently. If error reporting is *off*, it will throw an error. This is not a bug, it's an intentional security feature.<|eot|><|sol|>https://bugs.php.net/bug.php?id=47494<|eol|><|eols|><|endoftext|> | 61 |
lolphp | ealf | c2o4odz | <|sols|><|sot|>If error reporting is on, htmlspecialchars() will ignore invalid strings silently. If error reporting is *off*, it will throw an error. This is not a bug, it's an intentional security feature.<|eot|><|sol|>https://bugs.php.net/bug.php?id=47494<|eol|><|sor|>I'm confused. This is supposed to be a security ... | 11 |
lolphp | Tamber-Krain | c37gcqd | <|sols|><|sot|>If error reporting is on, htmlspecialchars() will ignore invalid strings silently. If error reporting is *off*, it will throw an error. This is not a bug, it's an intentional security feature.<|eot|><|sol|>https://bugs.php.net/bug.php?id=47494<|eol|><|sor|>I'm confused. This is supposed to be a security ... | 10 |
lolphp | pinkgothic | c2njo9f | <|sols|><|sot|>If error reporting is on, htmlspecialchars() will ignore invalid strings silently. If error reporting is *off*, it will throw an error. This is not a bug, it's an intentional security feature.<|eot|><|sol|>https://bugs.php.net/bug.php?id=47494<|eol|><|sor|>It's like they never learnt from their `magic_qu... | 8 |
lolphp | quchen | 119wum2 | <|sols|><|sot|>Password_verify() always returns true with some hash<|eot|><|sol|>https://bugs.php.net/bug.php?id=81744<|eol|><|eols|><|endoftext|> | 58 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.