subreddit
stringclasses
7 values
author
stringlengths
3
20
id
stringlengths
5
7
content
stringlengths
67
30.4k
score
int64
0
140k
lolphp
datibbaw
cb28tqj
<|sols|><|sot|>NULL can't be decremented... but incrementing it is fine<|eot|><|sol|>http://stackoverflow.com/questions/17592559/why-decremented-of-null-not-negative-in-this-array#comment25601676_17592559<|eol|><|sor|>Null is amazing. * NULL == 0 * NULL < -INF * NULL == an empty array * (NULL++) == 1 * (NULL--) == NULL * (NULL -= 1) == -1 * (NULL - 1) == -1 <|eor|><|sor|>Have you tried incrementing booleans? ;-) $a = true; var_dump(--$a); // true var_dump(++$a); // true var_dump($a = $a + 1); // int(2)<|eor|><|eols|><|endoftext|>
8
lolphp
idontlikethisname
cb0hr1v
<|sols|><|sot|>NULL can't be decremented... but incrementing it is fine<|eot|><|sol|>http://stackoverflow.com/questions/17592559/why-decremented-of-null-not-negative-in-this-array#comment25601676_17592559<|eol|><|sor|>take one out of the empty set, get the empty set put one in the empty set, get one <|eor|><|sor|>feasible but that's not what is implied, I'd say. Consider this: $x = NULL; // empty set $x--; // substract one, empty set var_dump($x); // NULL $x++; // add one, get one var_dump($x); // int(1) $x--; // substract one, empty set again? var_dump($x); // int(0) $x--; // following previous logic, should still be empty set var_dump($x) // int(-1)<|eor|><|eols|><|endoftext|>
8
lolphp
h0rst_
cb0nmzr
<|sols|><|sot|>NULL can't be decremented... but incrementing it is fine<|eot|><|sol|>http://stackoverflow.com/questions/17592559/why-decremented-of-null-not-negative-in-this-array#comment25601676_17592559<|eol|><|sor|>As someone accustomed to php's quirks, I don't really see anything wrong here<|eor|><|sor|>"As someone used to stepping in dog poo, I don't see the problem with dog poo on the street"<|eor|><|eols|><|endoftext|>
7
lolphp
nahguri
cb0lr40
<|sols|><|sot|>NULL can't be decremented... but incrementing it is fine<|eot|><|sol|>http://stackoverflow.com/questions/17592559/why-decremented-of-null-not-negative-in-this-array#comment25601676_17592559<|eol|><|sor|>As someone accustomed to php's quirks, I don't really see anything wrong here<|eor|><|sor|>What you call a 'quirk' is astonishing retardation in any other context.<|eor|><|eols|><|endoftext|>
7
lolphp
jamwaffles
cb1fncx
<|sols|><|sot|>NULL can't be decremented... but incrementing it is fine<|eot|><|sol|>http://stackoverflow.com/questions/17592559/why-decremented-of-null-not-negative-in-this-array#comment25601676_17592559<|eol|><|sor|>As someone accustomed to php's quirks, I don't really see anything wrong here<|eor|><|soopr|>> As someone accustomed to php's quirks There's your issue. Every language has it's quirks, but PHP takes a pretty unique stance on "quirks".<|eoopr|><|sor|>I've just realized your reddit account appears to have been [shadow banned](/r/ShadowBan) by the Reddit admins. Both this submission and your comment were in the spam bin. Unless someone fishes them out every time, no-one can see any of your posts. You could try contacting the Reddit admins for help but you might need to create a new account.<|eor|><|soopr|>Thanks for alerting me. Apparently now I've been un-banned. Now I just need to find more lolphps to submit. Give me 5 minutes...<|eoopr|><|eols|><|endoftext|>
6
lolphp
shitcanz
8luef9
<|sols|><|sot|>PHP: When side-effects are a core feature<|eot|><|sol|>https://bugs.php.net/bug.php?id=75232<|eol|><|eols|><|endoftext|>
81
lolphp
maweki
dzillel
<|sols|><|sot|>PHP: When side-effects are a core feature<|eot|><|sol|>https://bugs.php.net/bug.php?id=75232<|eol|><|sor|>Let me get this straight: So someone actually wanted to access it at any time and opened a feature request (it's available via reflection, why not at any time?). Then someone sees that accessing it via reflection using print_r, makes it generally available and files it as a bug. Which is then marked duplicate of the feature request... I'd say the bug report is the legitimate one, but this is php we're speaking of...<|eor|><|eols|><|endoftext|>
37
lolphp
jdickey
dzjjyi1
<|sols|><|sot|>PHP: When side-effects are a core feature<|eot|><|sol|>https://bugs.php.net/bug.php?id=75232<|eol|><|sor|>Once again reminding people that [*PHP is a low-level programming language at the WRONG LEVEL*](https://two-pi-r.livejournal.com/622760.html). I spent well over 10 years working in (and actively defending the OCD required to work in) PHP, after some 20 years in software development. I can look at code that I wrote before PHP (in C, C++, Delphi, Smalltalk, Lisp, and over 25 other languages) and see much cleaner, better-thought-out and -through code than any of my PHP work. I've spent eight years in recovery from PHP (Ruby, Elixir, ES6+) and am only now beginning to approach the elegance, effectiveness, and productive development of my BPHP work. I keep being told that PHP 7+ is a far better language; that it's actually possible to write good software well in PHP now. And then I see things like this OP, and realise that (as a recent episode of *Legion* put it brilliantly) delusion can be highly contagious, and even more highly damaging.<|eor|><|eols|><|endoftext|>
24
lolphp
shitcanz
dzjkthg
<|sols|><|sot|>PHP: When side-effects are a core feature<|eot|><|sol|>https://bugs.php.net/bug.php?id=75232<|eol|><|sor|>Once again reminding people that [*PHP is a low-level programming language at the WRONG LEVEL*](https://two-pi-r.livejournal.com/622760.html). I spent well over 10 years working in (and actively defending the OCD required to work in) PHP, after some 20 years in software development. I can look at code that I wrote before PHP (in C, C++, Delphi, Smalltalk, Lisp, and over 25 other languages) and see much cleaner, better-thought-out and -through code than any of my PHP work. I've spent eight years in recovery from PHP (Ruby, Elixir, ES6+) and am only now beginning to approach the elegance, effectiveness, and productive development of my BPHP work. I keep being told that PHP 7+ is a far better language; that it's actually possible to write good software well in PHP now. And then I see things like this OP, and realise that (as a recent episode of *Legion* put it brilliantly) delusion can be highly contagious, and even more highly damaging.<|eor|><|soopr|>I get told that all the time. The truth is PHP7 is just more lipstick on the pig (sorry elephpant) that is PHP. All the same madness is still there, buried deep in the core language. Language design decisions are made half-assed and never with any regard how the language operates in a greater respect. There so much weird and inconsistent behaviour that there is no way you can trust the language. Like this bug, its literally impossible to account for in a test. And who know what will happen in the future with some new real_print_and_hold_beer function is introduced? PHP codebases as ive seen them are always a mess. Even if the team is a good one, its always almost impossible to have a elegant codebase because all weird shit can creep up when you least expect it. Probably the most mindbending feature is the Date class. Its so full of quirks, bugs and inconsistent behaviour its almost unreal. <|eoopr|><|eols|><|endoftext|>
13
lolphp
slikts
dzlqjsh
<|sols|><|sot|>PHP: When side-effects are a core feature<|eot|><|sol|>https://bugs.php.net/bug.php?id=75232<|eol|><|sor|>Once again reminding people that [*PHP is a low-level programming language at the WRONG LEVEL*](https://two-pi-r.livejournal.com/622760.html). I spent well over 10 years working in (and actively defending the OCD required to work in) PHP, after some 20 years in software development. I can look at code that I wrote before PHP (in C, C++, Delphi, Smalltalk, Lisp, and over 25 other languages) and see much cleaner, better-thought-out and -through code than any of my PHP work. I've spent eight years in recovery from PHP (Ruby, Elixir, ES6+) and am only now beginning to approach the elegance, effectiveness, and productive development of my BPHP work. I keep being told that PHP 7+ is a far better language; that it's actually possible to write good software well in PHP now. And then I see things like this OP, and realise that (as a recent episode of *Legion* put it brilliantly) delusion can be highly contagious, and even more highly damaging.<|eor|><|soopr|>I get told that all the time. The truth is PHP7 is just more lipstick on the pig (sorry elephpant) that is PHP. All the same madness is still there, buried deep in the core language. Language design decisions are made half-assed and never with any regard how the language operates in a greater respect. There so much weird and inconsistent behaviour that there is no way you can trust the language. Like this bug, its literally impossible to account for in a test. And who know what will happen in the future with some new real_print_and_hold_beer function is introduced? PHP codebases as ive seen them are always a mess. Even if the team is a good one, its always almost impossible to have a elegant codebase because all weird shit can creep up when you least expect it. Probably the most mindbending feature is the Date class. Its so full of quirks, bugs and inconsistent behaviour its almost unreal. <|eoopr|><|sor|>They should really break compatibility in PHP 8, and tossing all the legacy shit away.<|eor|><|sor|>Backward compatibility is the feature that's keeping PHP afloat and the core devs know it; old code doesn't break and users aren't forced to learn, and that's how they generally like it and are used to, and I wouldn't even particularly fault them for it. PHP users also don't see that much wrong with the language, so there isn't a push to make breaking changes. Given this, changing the language too much would be protested and splinter the community worse than Python 3 did. Then there's the factor that fixing PHP would take a monumental effort, and the language developers are self-selected for tolerance of PHP's faults in the first place. There's been at least one somewhat visible case of a core dev quitting because of being frustrated with the stagnant mindset. It's just not realistic to expect PHP to change too much. It's just going to keep deprecating some bits, poorly copy random features from Java or C++, and improve performance. The point where you'd consider the language being bad enough to require a major rework is also where you realize that it's probably more reasonable just to switch to a different language.<|eor|><|eols|><|endoftext|>
7
lolphp
the_alias_of_andrea
477fx9
<|sols|><|sot|>/r/lolmysql/ - for the PHP of databases<|eot|><|sol|>https://www.reddit.com/r/lolmysql/<|eol|><|eols|><|endoftext|>
84
lolphp
tapesmith
d0b502m
<|sols|><|sot|>/r/lolmysql/ - for the PHP of databases<|eot|><|sol|>https://www.reddit.com/r/lolmysql/<|eol|><|sor|>MySQL may be the PHP of RDBMSes, but MongoDB is the PHP of databases. Fire-and-forget writes, nothing even *attempting* to resemble ACID compliance, multiple different incomparable date types, multiple *inconsistent* incomparable numeric types, and the query language is a combination of hideous, constantly-changing JSON structures and partial-ES5 JavaScript. And that's not even mentioning the abysmal drivers that randomly swallow exceptions and completely fail to be idiomatic in any language except JavaScript. All so that you can have a database without reliable schema. <|eor|><|eols|><|endoftext|>
66
lolphp
the_alias_of_andrea
d0aqhmy
<|sols|><|sot|>/r/lolmysql/ - for the PHP of databases<|eot|><|sol|>https://www.reddit.com/r/lolmysql/<|eol|><|soopr|>When I say "PHP of databases", I mean it. MySQL is awful in all the same kinds of ways PHP is awful. No wonder they're used together so often. So I felt I'd submit a link to the subreddit here, it needs more attention. (And posts.)<|eoopr|><|eols|><|endoftext|>
27
lolphp
cbraga
d0b4m5o
<|sols|><|sot|>/r/lolmysql/ - for the PHP of databases<|eot|><|sol|>https://www.reddit.com/r/lolmysql/<|eol|><|soopr|>When I say "PHP of databases", I mean it. MySQL is awful in all the same kinds of ways PHP is awful. No wonder they're used together so often. So I felt I'd submit a link to the subreddit here, it needs more attention. (And posts.)<|eoopr|><|sor|>All my experience with Mysql predates InnoDB and ACID compliance so at first I was kind of "meh, surely it was bad once but it's got better right?" Then I clicked the link titled "Terrible choices: MySQL" from merely a year ago with, among other gems, this one: > Inserting invalid data. Larger strings get truncated to the maximum length. Larger integers get truncated to the maximum. Other things get converted to NULL if the column allows that. All silently HOLY. FUCKING. SHIT.<|eor|><|eols|><|endoftext|>
27
lolphp
redwall_hp
d0blqa9
<|sols|><|sot|>/r/lolmysql/ - for the PHP of databases<|eot|><|sol|>https://www.reddit.com/r/lolmysql/<|eol|><|sor|>MySQL may be the PHP of RDBMSes, but MongoDB is the PHP of databases. Fire-and-forget writes, nothing even *attempting* to resemble ACID compliance, multiple different incomparable date types, multiple *inconsistent* incomparable numeric types, and the query language is a combination of hideous, constantly-changing JSON structures and partial-ES5 JavaScript. And that's not even mentioning the abysmal drivers that randomly swallow exceptions and completely fail to be idiomatic in any language except JavaScript. All so that you can have a database without reliable schema. <|eor|><|sor|>[deleted]<|eor|><|sor|>Seems like SQLite would be better for that. No daemon, and it's literally battle tested. (The US navy uses it for systems on destroyers, supposedly.)<|eor|><|eols|><|endoftext|>
23
lolphp
the_alias_of_andrea
d0b6e6h
<|sols|><|sot|>/r/lolmysql/ - for the PHP of databases<|eot|><|sol|>https://www.reddit.com/r/lolmysql/<|eol|><|soopr|>When I say "PHP of databases", I mean it. MySQL is awful in all the same kinds of ways PHP is awful. No wonder they're used together so often. So I felt I'd submit a link to the subreddit here, it needs more attention. (And posts.)<|eoopr|><|sor|>All my experience with Mysql predates InnoDB and ACID compliance so at first I was kind of "meh, surely it was bad once but it's got better right?" Then I clicked the link titled "Terrible choices: MySQL" from merely a year ago with, among other gems, this one: > Inserting invalid data. Larger strings get truncated to the maximum length. Larger integers get truncated to the maximum. Other things get converted to NULL if the column allows that. All silently HOLY. FUCKING. SHIT.<|eor|><|soopr|>[Even PHP is reasonable here](https://wiki.php.net/rfc/zpp_fail_on_overflow) (though I should point out that change was made by me, so I'm biased :p)<|eoopr|><|eols|><|endoftext|>
14
lolphp
TomWis97
d0b2u0g
<|sols|><|sot|>/r/lolmysql/ - for the PHP of databases<|eot|><|sol|>https://www.reddit.com/r/lolmysql/<|eol|><|sor|>Clickable link for mobile users: /r/lolmysql<|eor|><|eols|><|endoftext|>
11
lolphp
skeeto
d0b206h
<|sols|><|sot|>/r/lolmysql/ - for the PHP of databases<|eot|><|sol|>https://www.reddit.com/r/lolmysql/<|eol|><|sor|>It drives me nuts when data is shared as a MySQL dump with all the proprietary MySQL bells and whistles (the default), rather than something ANSI conforming. The only way to process these is to load it into MySQL before moving further. <|eor|><|eols|><|endoftext|>
10
lolphp
crankybadger
d0bhsvd
<|sols|><|sot|>/r/lolmysql/ - for the PHP of databases<|eot|><|sol|>https://www.reddit.com/r/lolmysql/<|eol|><|soopr|>When I say "PHP of databases", I mean it. MySQL is awful in all the same kinds of ways PHP is awful. No wonder they're used together so often. So I felt I'd submit a link to the subreddit here, it needs more attention. (And posts.)<|eoopr|><|sor|>All my experience with Mysql predates InnoDB and ACID compliance so at first I was kind of "meh, surely it was bad once but it's got better right?" Then I clicked the link titled "Terrible choices: MySQL" from merely a year ago with, among other gems, this one: > Inserting invalid data. Larger strings get truncated to the maximum length. Larger integers get truncated to the maximum. Other things get converted to NULL if the column allows that. All silently HOLY. FUCKING. SHIT.<|eor|><|sor|>It's not quite as YOLO as things like MongoDB, but it can take certain *liberties* with your data that you might not want it to. Makes it easy for any monkey with a pirated copy of Dreamweaver and some FTP creds to make a site without having to worry about things like "consistency" or "data integrity". <|eor|><|eols|><|endoftext|>
9
lolphp
McGlockenshire
d0bqh4q
<|sols|><|sot|>/r/lolmysql/ - for the PHP of databases<|eot|><|sol|>https://www.reddit.com/r/lolmysql/<|eol|><|sor|>MySQL may be the PHP of RDBMSes, but MongoDB is the PHP of databases. Fire-and-forget writes, nothing even *attempting* to resemble ACID compliance, multiple different incomparable date types, multiple *inconsistent* incomparable numeric types, and the query language is a combination of hideous, constantly-changing JSON structures and partial-ES5 JavaScript. And that's not even mentioning the abysmal drivers that randomly swallow exceptions and completely fail to be idiomatic in any language except JavaScript. All so that you can have a database without reliable schema. <|eor|><|sor|>And of course, there's [it being the wrong database choice if you ever need joins](http://www.sarahmei.com/blog/2013/11/11/why-you-should-never-use-mongodb/).<|eor|><|eols|><|endoftext|>
7
lolphp
the_alias_of_andrea
d0bsqwo
<|sols|><|sot|>/r/lolmysql/ - for the PHP of databases<|eot|><|sol|>https://www.reddit.com/r/lolmysql/<|eol|><|soopr|>When I say "PHP of databases", I mean it. MySQL is awful in all the same kinds of ways PHP is awful. No wonder they're used together so often. So I felt I'd submit a link to the subreddit here, it needs more attention. (And posts.)<|eoopr|><|sor|>I'm just saying, but last I heard Uber is migrating to PGSQL to MySQL, because it has a non-sucky sharding implementation. So, it's probably not as bad as you think.<|eor|><|soopr|>I'd say data integrity matters more.<|eoopr|><|eols|><|endoftext|>
7
lolphp
the_alias_of_andrea
d0d32cs
<|sols|><|sot|>/r/lolmysql/ - for the PHP of databases<|eot|><|sol|>https://www.reddit.com/r/lolmysql/<|eol|><|soopr|>When I say "PHP of databases", I mean it. MySQL is awful in all the same kinds of ways PHP is awful. No wonder they're used together so often. So I felt I'd submit a link to the subreddit here, it needs more attention. (And posts.)<|eoopr|><|sor|>I'm just saying, but last I heard Uber is migrating to PGSQL to MySQL, because it has a non-sucky sharding implementation. So, it's probably not as bad as you think.<|eor|><|soopr|>I'd say data integrity matters more.<|eoopr|><|sor|>Care to explain, or just to spout random indefensible things?<|eor|><|soopr|>Look at some of the items in the subreddit. MySQL loves turning your data into garbage.<|eoopr|><|eols|><|endoftext|>
5
lolphp
cube-drone
3sti35
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|eols|><|endoftext|>
82
lolphp
smog_alado
cx0dh08
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>Could anyone please explain what the flying fuck is going on here?<|eor|><|eols|><|endoftext|>
63
lolphp
cube-drone
cx0gk3r
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>TIL Luxembourg is a gender <|eor|><|soopr|>NORWAY IN THE STREETS BUT MALTA IN THE SHEETS<|eoopr|><|eols|><|endoftext|>
46
lolphp
infinull
cx0f450
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>Could anyone please explain what the flying fuck is going on here?<|eor|><|sor|>It's a third party library for determining the gender of a given name. The nationality is because worldwide a name can be mostly one gender, but in another country mostly another.<|eor|><|eols|><|endoftext|>
42
lolphp
papers_
cx09s08
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>~~const integer USA = 3 ;~~ `const integer USA = 1 ;` FTFY. /r/MURICA <|eor|><|eols|><|endoftext|>
36
lolphp
the_alias_of_andrea
cx0minh
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>It seems absurd until you realise it detects the gender of a name. But why would you ever do that? Guessing name gender is a bad idea, just ask for it. Heck, why do you care what gender someone is anyway?<|eor|><|eols|><|endoftext|>
29
lolphp
mort96
cx0idpr
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>Should account for third gender / non binary. <|eor|><|sor|>What do you mean? It has mostly female, ireland, unisex, female, couple, mostly male, error, etc. Seems to be pretty open to non-binary genders.<|eor|><|eols|><|endoftext|>
25
lolphp
merreborn
cx0ofrb
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>Huh, this is pretty useful. It probably doesn't need to be an extension but the C code was already there.. so.. The API is sub-optimal, but that's because it seems to be a pretty thin wrapper around the underlying library. You can find similar detectors in [Ruby](https://github.com/bmuller/gender_detector) and [Python](https://pypi.python.org/pypi/SexMachine/) - they use the same data set. You'd think this would be implemented in standard PHP somewhere but I don't see it on Packagist.<|eor|><|sor|>> The API is sub-optimal, but that's because it seems to be a pretty thin wrapper around the underlying library. > PHP in a nutshell<|eor|><|eols|><|endoftext|>
24
lolphp
cube-drone
cx0p9uo
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>It seems absurd until you realise it detects the gender of a name. But why would you ever do that? Guessing name gender is a bad idea, just ask for it. Heck, why do you care what gender someone is anyway?<|eor|><|soopr|>Yeah, my rules have always been A) If you need gender, just ask for it. B) Female, Male, or [ Text Box ] C) Why do you need gender? D) You don't need gender.<|eoopr|><|eols|><|endoftext|>
23
lolphp
edwardly
cx0bsky
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>Huh, this is pretty useful. It probably doesn't need to be an extension but the C code was already there.. so.. The API is sub-optimal, but that's because it seems to be a pretty thin wrapper around the underlying library. You can find similar detectors in [Ruby](https://github.com/bmuller/gender_detector) and [Python](https://pypi.python.org/pypi/SexMachine/) - they use the same data set. You'd think this would be implemented in standard PHP somewhere but I don't see it on Packagist.<|eor|><|eols|><|endoftext|>
19
lolphp
merreborn
cx0odtv
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>Could anyone please explain what the flying fuck is going on here?<|eor|><|sor|>See the intro and example pages https://secure.php.net/manual/en/intro.gender.php https://secure.php.net/manual/en/gender.example.admin.php > Gender PHP extension is a port of the gender.c program originally written by Joerg Michael. The main purpose is to find out the gender of firstnames. The current database contains >40000 firstnames from 54 countries.<|eor|><|eols|><|endoftext|>
18
lolphp
shillbert
cx0j2gt
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>Should account for third gender / non binary. <|eor|><|sor|>What do you mean? It has mostly female, ireland, unisex, female, couple, mostly male, error, etc. Seems to be pretty open to non-binary genders.<|eor|><|sor|>I AM ERROR<|eor|><|eols|><|endoftext|>
18
lolphp
Neckbeard_Prime
cx0s19o
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>Should account for third gender / non binary. <|eor|><|sor|>It doesn't report the gender of people, it reports the gender of names. In the sense that "alice" is a "girl's name" and "stephen" is a "boy's name"... are there any names used exclusively by "third gender / non binary" people?<|eor|><|sor|>Ask the user for its gender instead of trying to figure it out. Gender is very important to get right. I wouldn't want a system that guessed my name based on height for instance.<|eor|><|sor|>Based on your height, your name is Engelbert Humperdinck.<|eor|><|eols|><|endoftext|>
18
lolphp
scshunt
cx08q86
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>Not part of the standard library, but oh my... This is pretty amazing.<|eor|><|eols|><|endoftext|>
17
lolphp
headzoo
cx0x4oc
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>Not a PHP programmer - why not use an enum? This counting is ridiculous.<|eor|><|sor|>PHP doesn't have enums.<|eor|><|eols|><|endoftext|>
16
lolphp
josefx
cx0t1sa
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>It seems absurd until you realise it detects the gender of a name. But why would you ever do that? Guessing name gender is a bad idea, just ask for it. Heck, why do you care what gender someone is anyway?<|eor|><|sor|>It would not be too bad for user statistics if registration only requires a name or email. Statistics don't have to be 100% correct.<|eor|><|eols|><|endoftext|>
15
lolphp
merreborn
cx0pmrc
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>It seems absurd until you realise it detects the gender of a name. But why would you ever do that? Guessing name gender is a bad idea, just ask for it. Heck, why do you care what gender someone is anyway?<|eor|><|soopr|>Yeah, my rules have always been A) If you need gender, just ask for it. B) Female, Male, or [ Text Box ] C) Why do you need gender? D) You don't need gender.<|eoopr|><|sor|>Along those lines: [falsehoods programmers believe about gender](https://web.archive.org/web/20150905094026/http://www.cscyphers.com/blog/2012/06/28/falsehoods-programmers-believe-about-gender/)<|eor|><|eols|><|endoftext|>
15
lolphp
bart2019
cx0wcq3
<|sols|><|sot|>Gender/Gender<|eot|><|sol|>https://secure.php.net/manual/en/class.gender.php<|eol|><|sor|>No, Patrick. Belgium is not a gender.<|eor|><|sor|>It's not even a language (more than half of the population speak Dutch, almost all the rest speak French) so you can't use it to guess a gender from a first name. <|eor|><|eols|><|endoftext|>
14
lolphp
SockPants
3pgtht
<|sols|><|sot|>On using 'do {} while(0)' with breaks: "Since PHP 5.3.0, it is possible to use goto operator instead of this hack."<|eot|><|sol|>http://php.net/manual/en/control-structures.do.while.php<|eol|><|eols|><|endoftext|>
83
lolphp
leedavis81
cw66qww
<|sols|><|sot|>On using 'do {} while(0)' with breaks: "Since PHP 5.3.0, it is possible to use goto operator instead of this hack."<|eot|><|sol|>http://php.net/manual/en/control-structures.do.while.php<|eol|><|sor|>God bless goto: https://github.com/igorw/retry/issues/3<|eor|><|eols|><|endoftext|>
63
lolphp
nahguri
cw6djof
<|sols|><|sot|>On using 'do {} while(0)' with breaks: "Since PHP 5.3.0, it is possible to use goto operator instead of this hack."<|eot|><|sol|>http://php.net/manual/en/control-structures.do.while.php<|eol|><|sor|>>You can still write scripts, even powerful scripts lol<|eor|><|sor|>That line is gloriously retarded.<|eor|><|eols|><|endoftext|>
26
lolphp
hey_aaapple
cw6kfej
<|sols|><|sot|>On using 'do {} while(0)' with breaks: "Since PHP 5.3.0, it is possible to use goto operator instead of this hack."<|eot|><|sol|>http://php.net/manual/en/control-structures.do.while.php<|eol|><|sor|>God bless goto: https://github.com/igorw/retry/issues/3<|eor|><|sor|>Mother of all premature optimizations<|eor|><|eols|><|endoftext|>
24
lolphp
sickofthisshit
cw68hqj
<|sols|><|sot|>On using 'do {} while(0)' with breaks: "Since PHP 5.3.0, it is possible to use goto operator instead of this hack."<|eot|><|sol|>http://php.net/manual/en/control-structures.do.while.php<|eol|><|soopr|>I thought we all agreed that it was good that we finally got rid of GOTO as a programming construct.<|eoopr|><|sor|>No. I'm sure there are still perfectly reasonable uses for goto. I know a looong time back I found a specific situation that was sorted with a goto. I'm sure I could have done it another way, if I cared to sit there and think it through, but I doubt it would have been quite as efficient as a simple jump. I think it can be a nice compromise between trying to be a little bit efficient without dropping back to using pure asm. Not really php-relevant, but you can't take my goto from meeeee. Plus, goto reminds me of the game Gato, and nobody can hate on some serious submarine time.<|eor|><|sor|>There is mathematically\* no reason whatsoever to use goto in place of the structured form - the only possible reason is to save developer time right now. All you are doing is taking out a time loan from the next person to deal with that code, and whoever that is will have to pay it back with interest. It's lazy, irresponsible, shows a lack of either training or ability and in any decent shop will see you shown the door. \*unless you happen to be a compiler optimising code into a non-human-readable format<|eor|><|sor|>You forget that code is not just meant to be analyzed mathematically or by compilers but also by humans reading the code. If a goto is clearer to a human than the alternative, use it.<|eor|><|eols|><|endoftext|>
24
lolphp
ioctl79
cw6kbgi
<|sols|><|sot|>On using 'do {} while(0)' with breaks: "Since PHP 5.3.0, it is possible to use goto operator instead of this hack."<|eot|><|sol|>http://php.net/manual/en/control-structures.do.while.php<|eol|><|sor|>I think it is super important that language documentation is accessible to beginners. Maybe it shouldn't be written by beginners, though?<|eor|><|eols|><|endoftext|>
17
lolphp
DCoder1337
cw68zzj
<|sols|><|sot|>On using 'do {} while(0)' with breaks: "Since PHP 5.3.0, it is possible to use goto operator instead of this hack."<|eot|><|sol|>http://php.net/manual/en/control-structures.do.while.php<|eol|><|sor|>God bless goto: https://github.com/igorw/retry/issues/3<|eor|><|sor|>The level of stupidity in that thread is staggering. Thank you for sharing that.<|eor|><|eols|><|endoftext|>
17
lolphp
smog_alado
cw6ej6k
<|sols|><|sot|>On using 'do {} while(0)' with breaks: "Since PHP 5.3.0, it is possible to use goto operator instead of this hack."<|eot|><|sol|>http://php.net/manual/en/control-structures.do.while.php<|eol|><|soopr|>I thought we all agreed that it was good that we finally got rid of GOTO as a programming construct.<|eoopr|><|sor|>You should go back and read Dijkstra's original Goto Considered Harmful letter. (Its just a couple of pages and reads almost like a blog post). Goto is bad when its used to write unstructured programs that are hard to reason about. However, there are some kinds of gotos that don't make things harder to understand so goto isn't universally a bad thing. For example, break and continue are just goto under a different name and they often are more readable than the alternative, IMO.<|eor|><|eols|><|endoftext|>
17
lolphp
PGLubricants
cw67drr
<|sols|><|sot|>On using 'do {} while(0)' with breaks: "Since PHP 5.3.0, it is possible to use goto operator instead of this hack."<|eot|><|sol|>http://php.net/manual/en/control-structures.do.while.php<|eol|><|sor|>God bless goto: https://github.com/igorw/retry/issues/3<|eor|><|sor|>Wait, is he actually seriouse? That is the most ridiculous thing I have read in a long time.<|eor|><|eols|><|endoftext|>
16
lolphp
sickofthisshit
cw6dvww
<|sols|><|sot|>On using 'do {} while(0)' with breaks: "Since PHP 5.3.0, it is possible to use goto operator instead of this hack."<|eot|><|sol|>http://php.net/manual/en/control-structures.do.while.php<|eol|><|sor|>There is mathematically\* no reason whatsoever to use goto in place of the structured form - the only possible reason is to save developer time right now. All you are doing is taking out a time loan from the next person to deal with that code, and whoever that is will have to pay it back with interest. It's lazy, irresponsible, shows a lack of either training or ability and in any decent shop will see you shown the door. \*unless you happen to be a compiler optimising code into a non-human-readable format<|eor|><|sor|>You forget that code is not just meant to be analyzed mathematically or by compilers but also by humans reading the code. If a goto is clearer to a human than the alternative, use it.<|eor|><|sor|>No, I didn't. Goto statements are inherently harder to read, and their use has historically been justified by people complaining that using the standard structured programming constructs of sequence, selection and repetition is too slow. Mathematically, anything you can do with a goto, you can do with ssr, so that argument is pure bullshit. In the rare cases where code is poorly written and too complex for the compiler to optimise you can use break or continue to get the speed you need. If you have code which uses only ssr, and then uses only procedural, OO or functional paradigms, it is immediately apparent what, where and when the executing statement flow is going. With a goto that immediate comprehension is lost. In short there is absolutely zero need to *ever* use a goto statement except as a bandaid for a bigger problem. If you >found a specific situation that was sorted with a goto then what you actually found was a steaming pile of crap that you slapped a goto statement on and called it a day. Goto is never clearer to a human than properly written structured code.<|eor|><|sor|>> No, I didn't. Goto statements are inherently harder to read, It depends. Sometimes goto is the natural fit and the alternatives are just hacks to simulate goto. It's rare but it happens.<|eor|><|sor|>I see claims like that all over the place, but whenever somebody posts code they claim proves it a rewrite without it serves the same, more easily maintainable purpose. Then it's all 'oh that was only a trivial example' 'workplace security stops me from making actual code public' yada yada and bad coders continue to use crutches.<|eor|><|sor|>The canonical example is things like common cleanup, particularly with nested loops or other complex iteration; this is common in the Linux kernel, which you can read. <initialization 1> for (i = ...) for (j = ...) ... if error or done goto cleanup1; <initialization 2> for (... while if error or done goto cleanup2 cleanup2: <clean up anything left from initialization 2> cleanup1: <clean up anything left from initialization 1> return [Kernel coding style: see "Chapter 7"](https://www.kernel.org/doc/Documentation/CodingStyle) The fact that this can be mathematically transformed into some other form is completely irrelevant and not actually an argument against it. Every program can be mathematically transformed into a single while loop, but we would *never* write a program that way because we would not be able to do it correctly. The "structured" alternative of "maintain boolean 'early exit' flags and check them everywhere" is *more* error-prone and hard to read and maintain. If you want to see what Dijkstra was complaining about, find some old Fortran 77 code designed for good numerical performance over a wide range of inputs, and you'll go crazy trying to follow the gotos.<|eor|><|sor|>That is merely a hack (and a poor if functional one at that) for a missing feature in C - try-catch. You can even use macros which turn it into a throw and catch syntax to abstract out the gotos if you were totally averse to making the switch to C++, which obviously the kernel team would be. As I said, "except as a bandaid for a bigger problem".<|eor|><|sor|>All things are hacks if your proposed alternative is "use a better language." And you have shifted the goal posts from "mathematically equivalent" to "rewrite in a new language." The Linux kernel is in C. You don't have throw and catch. Gotos are more readable than the "nested loop with early exit flag." That's why the Linux kernel uses gotos.<|eor|><|eols|><|endoftext|>
16
lolphp
Scaliwag
cw6v114
<|sols|><|sot|>On using 'do {} while(0)' with breaks: "Since PHP 5.3.0, it is possible to use goto operator instead of this hack."<|eot|><|sol|>http://php.net/manual/en/control-structures.do.while.php<|eol|><|sor|>God bless goto: https://github.com/igorw/retry/issues/3<|eor|><|sor|>The level of stupidity in that thread is staggering. Thank you for sharing that.<|eor|><|sor|>[deleted]<|eor|><|sor|>The goto alonside the waste of time analyzing the opcodes is kinda irrelevant, except if you want to do that for the sake of it. If he answered that he just felt like it or that it was the first thing to come to his mind, instead of saying it was because of performance, then it would have made much more sense. Using goto btw is a good practice in some cases, like some exception handling in C code and things like that.<|eor|><|eols|><|endoftext|>
11
lolphp
AcellOfllSpades
cw6cgxj
<|sols|><|sot|>On using 'do {} while(0)' with breaks: "Since PHP 5.3.0, it is possible to use goto operator instead of this hack."<|eot|><|sol|>http://php.net/manual/en/control-structures.do.while.php<|eol|><|soopr|>I thought we all agreed that it was good that we finally got rid of GOTO as a programming construct.<|eoopr|><|sor|>No. I'm sure there are still perfectly reasonable uses for goto. I know a looong time back I found a specific situation that was sorted with a goto. I'm sure I could have done it another way, if I cared to sit there and think it through, but I doubt it would have been quite as efficient as a simple jump. I think it can be a nice compromise between trying to be a little bit efficient without dropping back to using pure asm. Not really php-relevant, but you can't take my goto from meeeee. Plus, goto reminds me of the game Gato, and nobody can hate on some serious submarine time.<|eor|><|sor|>There is mathematically\* no reason whatsoever to use goto in place of the structured form - the only possible reason is to save developer time right now. All you are doing is taking out a time loan from the next person to deal with that code, and whoever that is will have to pay it back with interest. It's lazy, irresponsible, shows a lack of either training or ability and in any decent shop will see you shown the door. \*unless you happen to be a compiler optimising code into a non-human-readable format<|eor|><|sor|>You forget that code is not just meant to be analyzed mathematically or by compilers but also by humans reading the code. If a goto is clearer to a human than the alternative, use it.<|eor|><|sor|>No, I didn't. Goto statements are inherently harder to read, and their use has historically been justified by people complaining that using the standard structured programming constructs of sequence, selection and repetition is too slow. Mathematically, anything you can do with a goto, you can do with ssr, so that argument is pure bullshit. In the rare cases where code is poorly written and too complex for the compiler to optimise you can use break or continue to get the speed you need. If you have code which uses only ssr, and then uses only procedural, OO or functional paradigms, it is immediately apparent what, where and when the executing statement flow is going. With a goto that immediate comprehension is lost. In short there is absolutely zero need to *ever* use a goto statement except as a bandaid for a bigger problem. If you >found a specific situation that was sorted with a goto then what you actually found was a steaming pile of crap that you slapped a goto statement on and called it a day. Goto is never clearer to a human than properly written structured code.<|eor|><|sor|>> No, I didn't. Goto statements are inherently harder to read, It depends. Sometimes goto is the natural fit and the alternatives are just hacks to simulate goto. It's rare but it happens.<|eor|><|sor|>Come on, everyone knows we all should use Intercal's COME FROM.<|eor|><|eols|><|endoftext|>
10
lolphp
bart2019
cw69wcw
<|sols|><|sot|>On using 'do {} while(0)' with breaks: "Since PHP 5.3.0, it is possible to use goto operator instead of this hack."<|eot|><|sol|>http://php.net/manual/en/control-structures.do.while.php<|eol|><|sor|>Perl has bare blocks for this purpose, i.e. just the braces. They act like loop bodies that are executed exactly once, and you can break out of them (using `last`, the Perl equivalent of `break). OTOH, in Perl you cannot use `last` to break out of `do { ... } while`loops. See [SO post](http://stackoverflow.com/a/7899066) explaining the situation (AKA "mess"). <|eor|><|eols|><|endoftext|>
9
lolphp
sickofthisshit
cw6ayia
<|sols|><|sot|>On using 'do {} while(0)' with breaks: "Since PHP 5.3.0, it is possible to use goto operator instead of this hack."<|eot|><|sol|>http://php.net/manual/en/control-structures.do.while.php<|eol|><|soopr|>I thought we all agreed that it was good that we finally got rid of GOTO as a programming construct.<|eoopr|><|sor|>No. I'm sure there are still perfectly reasonable uses for goto. I know a looong time back I found a specific situation that was sorted with a goto. I'm sure I could have done it another way, if I cared to sit there and think it through, but I doubt it would have been quite as efficient as a simple jump. I think it can be a nice compromise between trying to be a little bit efficient without dropping back to using pure asm. Not really php-relevant, but you can't take my goto from meeeee. Plus, goto reminds me of the game Gato, and nobody can hate on some serious submarine time.<|eor|><|sor|>There is mathematically\* no reason whatsoever to use goto in place of the structured form - the only possible reason is to save developer time right now. All you are doing is taking out a time loan from the next person to deal with that code, and whoever that is will have to pay it back with interest. It's lazy, irresponsible, shows a lack of either training or ability and in any decent shop will see you shown the door. \*unless you happen to be a compiler optimising code into a non-human-readable format<|eor|><|sor|>You forget that code is not just meant to be analyzed mathematically or by compilers but also by humans reading the code. If a goto is clearer to a human than the alternative, use it.<|eor|><|sor|>No, I didn't. Goto statements are inherently harder to read, and their use has historically been justified by people complaining that using the standard structured programming constructs of sequence, selection and repetition is too slow. Mathematically, anything you can do with a goto, you can do with ssr, so that argument is pure bullshit. In the rare cases where code is poorly written and too complex for the compiler to optimise you can use break or continue to get the speed you need. If you have code which uses only ssr, and then uses only procedural, OO or functional paradigms, it is immediately apparent what, where and when the executing statement flow is going. With a goto that immediate comprehension is lost. In short there is absolutely zero need to *ever* use a goto statement except as a bandaid for a bigger problem. If you >found a specific situation that was sorted with a goto then what you actually found was a steaming pile of crap that you slapped a goto statement on and called it a day. Goto is never clearer to a human than properly written structured code.<|eor|><|sor|>> No, I didn't. Goto statements are inherently harder to read, It depends. Sometimes goto is the natural fit and the alternatives are just hacks to simulate goto. It's rare but it happens.<|eor|><|sor|>I see claims like that all over the place, but whenever somebody posts code they claim proves it a rewrite without it serves the same, more easily maintainable purpose. Then it's all 'oh that was only a trivial example' 'workplace security stops me from making actual code public' yada yada and bad coders continue to use crutches.<|eor|><|sor|>The canonical example is things like common cleanup, particularly with nested loops or other complex iteration; this is common in the Linux kernel, which you can read. <initialization 1> for (i = ...) for (j = ...) ... if error or done goto cleanup1; <initialization 2> for (... while if error or done goto cleanup2 cleanup2: <clean up anything left from initialization 2> cleanup1: <clean up anything left from initialization 1> return [Kernel coding style: see "Chapter 7"](https://www.kernel.org/doc/Documentation/CodingStyle) The fact that this can be mathematically transformed into some other form is completely irrelevant and not actually an argument against it. Every program can be mathematically transformed into a single while loop, but we would *never* write a program that way because we would not be able to do it correctly. The "structured" alternative of "maintain boolean 'early exit' flags and check them everywhere" is *more* error-prone and hard to read and maintain. If you want to see what Dijkstra was complaining about, find some old Fortran 77 code designed for good numerical performance over a wide range of inputs, and you'll go crazy trying to follow the gotos.<|eor|><|eols|><|endoftext|>
9
lolphp
outadoc
cw7af5i
<|sols|><|sot|>On using 'do {} while(0)' with breaks: "Since PHP 5.3.0, it is possible to use goto operator instead of this hack."<|eot|><|sol|>http://php.net/manual/en/control-structures.do.while.php<|eol|><|sor|>God bless goto: https://github.com/igorw/retry/issues/3<|eor|><|sor|>> will then be executed by the Zend (tm) (r) Engine Oh god I hate this person <|eor|><|eols|><|endoftext|>
8
lolphp
vytah
3nc5s7
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|eols|><|endoftext|>
85
lolphp
ZugNachPankow
cvmqr59
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>PHP keeps features around "for backwards compatibility", except when it doesn't.<|eor|><|eols|><|endoftext|>
41
lolphp
vytah
cvmt9nk
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>Shouldn't this be false though? I mean, couldn't you argue any bug fix is breaking backward compatibility? (though maybe that wasn't what happened in this exact instance.)<|eor|><|soopr|>Given that they "fixed" it in 4.3.10, "broke" it in 5.0.0, "fixed" it again in 5.0.3, "broke" it again in 5.2.1, and "fixed" it again in 7.0, this doesn't look like deliberate bug fixing, more like "keep hitting it with a spanner until it works".<|eoopr|><|eols|><|endoftext|>
35
lolphp
_vec_
cvnd7p2
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>So they have a unit test suite right? Put this sucker in there as a test and don't push out releases if the test fails. Whether it should be true or false is another discussion, but in a sane project this would be an easy "don't regress" thing.<|eor|><|sor|>https://www.reddit.com/r/lolphp/comments/qeq7k/php_540_ships_with_82_failing_tests_in_the_suite/<|eor|><|eols|><|endoftext|>
26
lolphp
outadoc
cvn4ksf
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>PHP keeps features around "for backwards compatibility", except when it doesn't.<|eor|><|sor|>They only keep backwards compatibility for crappy reasons: that's what makes PHP, after all. <|eor|><|eols|><|endoftext|>
20
lolphp
vytah
cvn52ki
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>Shouldn't this be false though? I mean, couldn't you argue any bug fix is breaking backward compatibility? (though maybe that wasn't what happened in this exact instance.)<|eor|><|soopr|>Given that they "fixed" it in 4.3.10, "broke" it in 5.0.0, "fixed" it again in 5.0.3, "broke" it again in 5.2.1, and "fixed" it again in 7.0, this doesn't look like deliberate bug fixing, more like "keep hitting it with a spanner until it works".<|eoopr|><|sor|>Seems more like it's being fixed in various release versions at the same time?<|eor|><|soopr|>Good suggestion. Here's the timeline: * 13 Jul 2004 5.0.0 both 4.3 and 5.0 branches return `true`at this point * 15 Dec 2004 4.3.10 and 5.0.3 switching to `false` in both 4.3 and 5.0 branches * 8 Feb 2007 5.2.1 switching to `true` in 5.2 branch * 11 Jun 2015 7.0.0-alpha1 switching to `false` in php7 branch So: initially returning `true`, then a bit over 2 years of `false`, then 8 years of `true`, and then `false` again. <|eoopr|><|eols|><|endoftext|>
20
lolphp
thelordofcheese
cvmpbyg
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>goddammit<|eor|><|eols|><|endoftext|>
18
lolphp
DoctorWaluigiTime
cvnc3ah
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>So they have a unit test suite right? Put this sucker in there as a test and don't push out releases if the test fails. Whether it should be true or false is another discussion, but in a sane project this would be an easy "don't regress" thing.<|eor|><|eols|><|endoftext|>
17
lolphp
DCoder1337
cvnnzkh
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>So they have a unit test suite right? Put this sucker in there as a test and don't push out releases if the test fails. Whether it should be true or false is another discussion, but in a sane project this would be an easy "don't regress" thing.<|eor|><|sor|>See also the infamous ["Rasmus makes a change and releases it without running the tests, `crypt` breaks completely"](https://www.reddit.com/r/programming/comments/jsudd/you_see_rasmus_lerdorf_creator_of_php_wrecking/c2eu1bm) incident.<|eor|><|eols|><|endoftext|>
14
lolphp
nikic
cvnmpxh
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>RFC introducing this intentional backwards compatibility break in PHP 7: https://wiki.php.net/rfc/remove_hex_support_in_numeric_strings The back and forth before that is funny though \^\^<|eor|><|eols|><|endoftext|>
13
lolphp
ZugNachPankow
cvn07mg
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>Shouldn't this be false though? I mean, couldn't you argue any bug fix is breaking backward compatibility? (though maybe that wasn't what happened in this exact instance.)<|eor|><|soopr|>Given that they "fixed" it in 4.3.10, "broke" it in 5.0.0, "fixed" it again in 5.0.3, "broke" it again in 5.2.1, and "fixed" it again in 7.0, this doesn't look like deliberate bug fixing, more like "keep hitting it with a spanner until it works".<|eoopr|><|sor|>True backwards compatibility. You don't simply break compatibility once, you do it five times.<|eor|><|eols|><|endoftext|>
13
lolphp
DoctorWaluigiTime
cvndb5l
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>So they have a unit test suite right? Put this sucker in there as a test and don't push out releases if the test fails. Whether it should be true or false is another discussion, but in a sane project this would be an easy "don't regress" thing.<|eor|><|sor|>https://www.reddit.com/r/lolphp/comments/qeq7k/php_540_ships_with_82_failing_tests_in_the_suite/<|eor|><|sor|>You know, I should be surprised, but I'm not. It's not just PHP that does this either. Worked on other projects where more than 0% failure rate was "acceptable." It is sad.<|eor|><|eols|><|endoftext|>
12
lolphp
xrogaan
cvoswwc
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>So they have a unit test suite right? Put this sucker in there as a test and don't push out releases if the test fails. Whether it should be true or false is another discussion, but in a sane project this would be an easy "don't regress" thing.<|eor|><|sor|>https://www.reddit.com/r/lolphp/comments/qeq7k/php_540_ships_with_82_failing_tests_in_the_suite/<|eor|><|sor|>You know, I should be surprised, but I'm not. It's not just PHP that does this either. Worked on other projects where more than 0% failure rate was "acceptable." It is sad.<|eor|><|sor|>What's the point in implementing tests if you're going to ignore them then?<|eor|><|eols|><|endoftext|>
10
lolphp
profmonocle
cvnkx1k
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>Shouldn't this be false though? I mean, couldn't you argue any bug fix is breaking backward compatibility? (though maybe that wasn't what happened in this exact instance.)<|eor|><|soopr|>Given that they "fixed" it in 4.3.10, "broke" it in 5.0.0, "fixed" it again in 5.0.3, "broke" it again in 5.2.1, and "fixed" it again in 7.0, this doesn't look like deliberate bug fixing, more like "keep hitting it with a spanner until it works".<|eoopr|><|sor|>> 4.3.10, 5.0.3, 5.2.1 The fact that they're making compatibility-affecting changes like this in point releases is even worse.<|eor|><|eols|><|endoftext|>
8
lolphp
Grimy_
cvoyi8x
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>So they have a unit test suite right? Put this sucker in there as a test and don't push out releases if the test fails. Whether it should be true or false is another discussion, but in a sane project this would be an easy "don't regress" thing.<|eor|><|sor|>https://www.reddit.com/r/lolphp/comments/qeq7k/php_540_ships_with_82_failing_tests_in_the_suite/<|eor|><|sor|>You know, I should be surprised, but I'm not. It's not just PHP that does this either. Worked on other projects where more than 0% failure rate was "acceptable." It is sad.<|eor|><|sor|>What's the point in implementing tests if you're going to ignore them then?<|eor|><|sor|>As long as more than 50% of the tests pass, its okay to ship. Were in a democracy, after all.<|eor|><|eols|><|endoftext|>
8
lolphp
Schmittfried
cvn80xm
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>Shouldn't this be false though? I mean, couldn't you argue any bug fix is breaking backward compatibility? (though maybe that wasn't what happened in this exact instance.)<|eor|><|sor|>Given that the PHP devs usually defend odd behavior with "muh backwards compatibility" those fixes seem rather strange to me.<|eor|><|eols|><|endoftext|>
7
lolphp
vytah
cvoz5ue
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>PHP maintains compatibility, everybody complains and a subreddit is created. PHP documents a backwards incompatibility for a new version, and people exclaim: how they dare! https://wiki.php.net/rfc/remove_hex_support_in_numeric_strings<|eor|><|soopr|>It's not a one-time compatibility breakage. It happened 3 times, two of which *in a point release*.<|eoopr|><|eols|><|endoftext|>
6
lolphp
rinyre
cvn3z80
<|sols|><|sot|>Backwards compatibility? What is that?<|eot|><|sol|>https://3v4l.org/nneXO<|eol|><|sor|>Shouldn't this be false though? I mean, couldn't you argue any bug fix is breaking backward compatibility? (though maybe that wasn't what happened in this exact instance.)<|eor|><|soopr|>Given that they "fixed" it in 4.3.10, "broke" it in 5.0.0, "fixed" it again in 5.0.3, "broke" it again in 5.2.1, and "fixed" it again in 7.0, this doesn't look like deliberate bug fixing, more like "keep hitting it with a spanner until it works".<|eoopr|><|sor|>Seems more like it's being fixed in various release versions at the same time?<|eor|><|eols|><|endoftext|>
5
lolphp
phplovesong
bmvrn9
<|soss|><|sot|>PHP: When printing causes side-effects<|eot|><|sost|>So when you have two DateInterval objects, that are equal you can compare them with PHP loose comparison (==). But after you print one (say for logging purposes) it gets internally modified and the two objects are no longer equal. The same happens when you call var\_export. It amazes me how primitive bugs PHP has, given its lifespan begun in 1995. [https://repl.it/repls/ForcefulEachAgents](https://repl.it/repls/ForcefulEachAgents)<|eost|><|eoss|><|endoftext|>
80
lolphp
nikic
en0exdj
<|soss|><|sot|>PHP: When printing causes side-effects<|eot|><|sost|>So when you have two DateInterval objects, that are equal you can compare them with PHP loose comparison (==). But after you print one (say for logging purposes) it gets internally modified and the two objects are no longer equal. The same happens when you call var\_export. It amazes me how primitive bugs PHP has, given its lifespan begun in 1995. [https://repl.it/repls/ForcefulEachAgents](https://repl.it/repls/ForcefulEachAgents)<|eost|><|sor|>You'll be happy to know that the output on PHP 7.4 will be: Warning: Cannot compare DateInterval objects in /home/nikic/php-7.4/test.php on line 6 bool(false) Warning: Cannot compare DateInterval objects in /home/nikic/php-7.4/test.php on line 10 bool(false) I also have a pending PR to add limited comparison support for a subset of DateInterval objects in https://github.com/php/php-src/pull/4063.<|eor|><|eoss|><|endoftext|>
15
lolphp
nikic
en1mav1
<|soss|><|sot|>PHP: When printing causes side-effects<|eot|><|sost|>So when you have two DateInterval objects, that are equal you can compare them with PHP loose comparison (==). But after you print one (say for logging purposes) it gets internally modified and the two objects are no longer equal. The same happens when you call var\_export. It amazes me how primitive bugs PHP has, given its lifespan begun in 1995. [https://repl.it/repls/ForcefulEachAgents](https://repl.it/repls/ForcefulEachAgents)<|eost|><|sor|>You'll be happy to know that the output on PHP 7.4 will be: Warning: Cannot compare DateInterval objects in /home/nikic/php-7.4/test.php on line 6 bool(false) Warning: Cannot compare DateInterval objects in /home/nikic/php-7.4/test.php on line 10 bool(false) I also have a pending PR to add limited comparison support for a subset of DateInterval objects in https://github.com/php/php-src/pull/4063.<|eor|><|sor|>Why tho? Comparing them can be usefull, this seems like a fix, but for the wrong reasons, and with the wrong intentions. Should not the print function be fixed instead?<|eor|><|sor|>See https://github.com/php/php-src/pull/4039 for context. To be clear: Comparison of DateInterval never actually worked. OP makes it look like it did, but in reality *any* DateInterval objects would have been considered equal.<|eor|><|eoss|><|endoftext|>
15
lolphp
phplovesong
enbkbue
<|soss|><|sot|>PHP: When printing causes side-effects<|eot|><|sost|>So when you have two DateInterval objects, that are equal you can compare them with PHP loose comparison (==). But after you print one (say for logging purposes) it gets internally modified and the two objects are no longer equal. The same happens when you call var\_export. It amazes me how primitive bugs PHP has, given its lifespan begun in 1995. [https://repl.it/repls/ForcefulEachAgents](https://repl.it/repls/ForcefulEachAgents)<|eost|><|sor|>You'll be happy to know that the output on PHP 7.4 will be: Warning: Cannot compare DateInterval objects in /home/nikic/php-7.4/test.php on line 6 bool(false) Warning: Cannot compare DateInterval objects in /home/nikic/php-7.4/test.php on line 10 bool(false) I also have a pending PR to add limited comparison support for a subset of DateInterval objects in https://github.com/php/php-src/pull/4063.<|eor|><|sor|>Why tho? Comparing them can be usefull, this seems like a fix, but for the wrong reasons, and with the wrong intentions. Should not the print function be fixed instead?<|eor|><|sor|>See https://github.com/php/php-src/pull/4039 for context. To be clear: Comparison of DateInterval never actually worked. OP makes it look like it did, but in reality *any* DateInterval objects would have been considered equal.<|eor|><|soopr|>`OP makes it look like it did` &#x200B; FTFY PHP makes it look like it did.<|eoopr|><|eoss|><|endoftext|>
7
lolphp
the_satch
ephjg15
<|soss|><|sot|>PHP: When printing causes side-effects<|eot|><|sost|>So when you have two DateInterval objects, that are equal you can compare them with PHP loose comparison (==). But after you print one (say for logging purposes) it gets internally modified and the two objects are no longer equal. The same happens when you call var\_export. It amazes me how primitive bugs PHP has, given its lifespan begun in 1995. [https://repl.it/repls/ForcefulEachAgents](https://repl.it/repls/ForcefulEachAgents)<|eost|><|sor|>[deleted]<|eor|><|sor|>The author/maintainer of PHP's time related stuff seems especially quick to close stuff as "not a bug" without any discussion. This argument in particular is just silly. If I insert a `print_r` or `var_dump` *for debugging* then I still expect my code to behave the same.<|eor|><|sor|>You don't have to fix bugs if you claim *everything* is working as intended. eddiemurphy.jpg<|eor|><|eoss|><|endoftext|>
6
lolphp
timw4mail
en0uz70
<|soss|><|sot|>PHP: When printing causes side-effects<|eot|><|sost|>So when you have two DateInterval objects, that are equal you can compare them with PHP loose comparison (==). But after you print one (say for logging purposes) it gets internally modified and the two objects are no longer equal. The same happens when you call var\_export. It amazes me how primitive bugs PHP has, given its lifespan begun in 1995. [https://repl.it/repls/ForcefulEachAgents](https://repl.it/repls/ForcefulEachAgents)<|eost|><|sor|>Printing technically is a side-effect... Wait...what does a comparision of two date intervals mean? The same length of time (with possibly different start/end), or the same start and end dates?<|eor|><|eoss|><|endoftext|>
5
lolphp
nikic
en0o31j
<|soss|><|sot|>PHP: When printing causes side-effects<|eot|><|sost|>So when you have two DateInterval objects, that are equal you can compare them with PHP loose comparison (==). But after you print one (say for logging purposes) it gets internally modified and the two objects are no longer equal. The same happens when you call var\_export. It amazes me how primitive bugs PHP has, given its lifespan begun in 1995. [https://repl.it/repls/ForcefulEachAgents](https://repl.it/repls/ForcefulEachAgents)<|eost|><|sor|>The real tragedy is you have to do this because there is no `equals` method.<|eor|><|sor|>Unfortunately date intervals have no well-defined notion of equality unless they are combined with a starting point in time (or a canonicalized day representation derived therefrom).<|eor|><|eoss|><|endoftext|>
5
lolphp
naveen17797
9vh2z7
<|sols|><|sot|>When they are looking for rasmus lerdorf<|eot|><|sol|>https://i.redd.it/ej4djxnp78x11.png<|eol|><|eols|><|endoftext|>
82
lolphp
horstenkoetter
e9cenhk
<|sols|><|sot|>When they are looking for rasmus lerdorf<|eot|><|sol|>https://i.redd.it/ej4djxnp78x11.png<|eol|><|sor|>Missing a hyphen, Id guess.<|eor|><|eols|><|endoftext|>
27
lolphp
myaut
e9dgtfz
<|sols|><|sot|>When they are looking for rasmus lerdorf<|eot|><|sol|>https://i.redd.it/ej4djxnp78x11.png<|eol|><|sor|>> Familiarity with the limitations of PHP as a platform and its workarounds The real lol here.<|eor|><|eols|><|endoftext|>
26
lolphp
the_alias_of_andrea
e9cbgdf
<|sols|><|sot|>When they are looking for rasmus lerdorf<|eot|><|sol|>https://i.redd.it/ej4djxnp78x11.png<|eol|><|sor|>I'm impressed they bothered to get the date accurate and not just ask for 30 years!<|eor|><|eols|><|endoftext|>
17
lolphp
wafflePower1
e9cey7r
<|sols|><|sot|>When they are looking for rasmus lerdorf<|eot|><|sol|>https://i.redd.it/ej4djxnp78x11.png<|eol|><|sor|>Missing a hyphen, Id guess.<|eor|><|sor|>Yep, not really that interesting :(<|eor|><|eols|><|endoftext|>
12
lolphp
sinking_Time
e9e1xwj
<|sols|><|sot|>When they are looking for rasmus lerdorf<|eot|><|sol|>https://i.redd.it/ej4djxnp78x11.png<|eol|><|sor|>Missing a hyphen, Id guess.<|eor|><|sor|>Wow. That was reasonable. Smart. <|eor|><|eols|><|endoftext|>
8
lolphp
barubary
467ykt
<|sols|><|sot|>Oops, there's a typo in the Mersenne twister RNG code<|eot|><|sol|>http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51<|eol|><|eols|><|endoftext|>
83
lolphp
midir
d03arpm
<|sols|><|sot|>Oops, there's a typo in the Mersenne twister RNG code<|eot|><|sol|>http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51<|eol|><|sor|>That's absolutely ridiculous. The originally published MT code includes a file of the expected output for a sample loop. It's very easy to use that to run a quick test that it's implemented correctly. Given how subtle and insidious errors in RNGs can otherwise be, why would anyone implementing MT not bother to test it? Lazy brainless twats.<|eor|><|eols|><|endoftext|>
33
lolphp
barubary
d03f1o3
<|sols|><|sot|>Oops, there's a typo in the Mersenne twister RNG code<|eot|><|sol|>http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51<|eol|><|sor|>Has it been wrong all these years, or just recently?<|eor|><|soopr|>That code was introduced in http://git.php.net/?p=php-src.git;a=commitdiff;h=a930751112cc35cd6a4aa30a987dfa1de3bb3c18 back in Nov 2006. According to https://3v4l.org/kLE5i it's been this wrong since 5.2.1. Versions 4.3.0 .. 5.2.0 were differently wrong.<|eoopr|><|eols|><|endoftext|>
31
lolphp
tdammers
d03429x
<|sols|><|sot|>Oops, there's a typo in the Mersenne twister RNG code<|eot|><|sol|>http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51<|eol|><|sor|>This is why we have unit tests, kids. <|eor|><|sor|>Except that [they didn't](http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51#patch2)<|eor|><|eols|><|endoftext|>
23
lolphp
HiddenKrypt
d033x2z
<|sols|><|sot|>Oops, there's a typo in the Mersenne twister RNG code<|eot|><|sol|>http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51<|eol|><|sor|>This is why we have unit tests, kids. <|eor|><|eols|><|endoftext|>
21
lolphp
barubary
d04f95o
<|sols|><|sot|>Oops, there's a typo in the Mersenne twister RNG code<|eot|><|sol|>http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51<|eol|><|soopr|>Now reverted for backwards compatibility reasons: https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80 (Never mind that when it was introduced in a point release (5.2.0 -> 5.2.1), no one seems to have noticed.)<|eoopr|><|eols|><|endoftext|>
21
lolphp
the_alias_of_andrea
d03r1a2
<|sols|><|sot|>Oops, there's a typo in the Mersenne twister RNG code<|eot|><|sol|>http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51<|eol|><|sor|>Huh, I would've thought that PHP would import the code wholesale. I wonder how this error could have been introduced. Also, wow, that's probably a pretty bad backwards-compatibility break.<|eor|><|sor|>How exactly is it a BC break? Doesn't the function go from returning randomish data to returning randomish data?<|eor|><|sor|>Because you can seed the random number generator, and some applications require reproducibility of a pseudo-random sequence from a given seed.<|eor|><|eols|><|endoftext|>
14
lolphp
flying-sheep
d05z60w
<|sols|><|sot|>Oops, there's a typo in the Mersenne twister RNG code<|eot|><|sol|>http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51<|eol|><|sor|>Well, we do now: https://github.com/php/php-src/commit/a50c31da1917bb07b3c11f229125ab8d1f0b9b70<|eor|><|sor|>dafuq, how is this desirable?<|eor|><|sor|>Er, because now we know if we break it?<|eor|><|sor|>no, i meant to make sure to have this behavior. they removed a test that tested for correct behavior and added one that tested for wrong one.<|eor|><|sor|>> no, i meant to make sure to have this behavior. Because existing applications might rely on it. And while we may correct our Mersenne Twister implementation in future, while it's broken we need to check we don't break it further.<|eor|><|sor|>thats OK if you have the correct fix in an inbound branch for the next release. its not OK to say well, this is our life now, gotta live with it<|eor|><|sor|>Well, we *could* just live with it and update the documentation. If anyone expected it to behave the same as other MT implementations, they're long since disappointed, and the code with the bug doesn't seem to produce inferior output.<|eor|><|sor|>> the code with the bug doesn't seem to produce inferior output [citation needed]<|eor|><|eols|><|endoftext|>
14
lolphp
the_alias_of_andrea
d038vuh
<|sols|><|sot|>Oops, there's a typo in the Mersenne twister RNG code<|eot|><|sol|>http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51<|eol|><|sor|>Huh, I would've thought that PHP would import the code wholesale. I wonder how this error could have been introduced. Also, wow, that's probably a pretty bad backwards-compatibility break.<|eor|><|eols|><|endoftext|>
12
lolphp
dtfinch
d03cjpp
<|sols|><|sot|>Oops, there's a typo in the Mersenne twister RNG code<|eot|><|sol|>http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51<|eol|><|sor|>Has it been wrong all these years, or just recently?<|eor|><|eols|><|endoftext|>
12
lolphp
bladder-rinse-repeat
d03qpli
<|sols|><|sot|>Oops, there's a typo in the Mersenne twister RNG code<|eot|><|sol|>http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51<|eol|><|sor|>Huh, I would've thought that PHP would import the code wholesale. I wonder how this error could have been introduced. Also, wow, that's probably a pretty bad backwards-compatibility break.<|eor|><|sor|>How exactly is it a BC break? Doesn't the function go from returning randomish data to returning randomish data?<|eor|><|eols|><|endoftext|>
10
lolphp
Deranged40
d03i04c
<|sols|><|sot|>Oops, there's a typo in the Mersenne twister RNG code<|eot|><|sol|>http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51<|eol|><|sor|>https://www.xkcd.com/221/ As always, a relevant xkcd<|eor|><|eols|><|endoftext|>
9
lolphp
the_alias_of_andrea
d054emp
<|sols|><|sot|>Oops, there's a typo in the Mersenne twister RNG code<|eot|><|sol|>http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51<|eol|><|sor|>This is why we have unit tests, kids. <|eor|><|sor|>Except that [they didn't](http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51#patch2)<|eor|><|sor|>Well, we do now: https://github.com/php/php-src/commit/a50c31da1917bb07b3c11f229125ab8d1f0b9b70<|eor|><|eols|><|endoftext|>
9
lolphp
hey_aaapple
d05r1b9
<|sols|><|sot|>Oops, there's a typo in the Mersenne twister RNG code<|eot|><|sol|>http://git.php.net/?p=php-src.git;a=commitdiff;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51<|eol|><|sor|>Has it been wrong all these years, or just recently?<|eor|><|soopr|>That code was introduced in http://git.php.net/?p=php-src.git;a=commitdiff;h=a930751112cc35cd6a4aa30a987dfa1de3bb3c18 back in Nov 2006. According to https://3v4l.org/kLE5i it's been this wrong since 5.2.1. Versions 4.3.0 .. 5.2.0 were differently wrong.<|eoopr|><|sor|>10 years with a broken PRNG. Only in PHP<|eor|><|eols|><|endoftext|>
8