subreddit
stringclasses
7 values
author
stringlengths
3
20
id
stringlengths
5
7
content
stringlengths
67
30.4k
score
int64
0
140k
lolphp
tdammers
cb7pyjs
<|sols|><|sot|>echo ++$a + $a++; // may print 4 or 5<|eot|><|sol|>http://php.net/manual/en/language.operators.precedence.php#example-114<|eol|><|sor|>This is something PHP more or less inherits directly from C, where the following is undefined as well: int i = 1; i = ++i + i++; printf("%i\n", i);<|eor|><|sor|>The difference is that apparently in PHP the result is restricted to 4 or 5. In C, you don't just get an unspecified number, you get completely undefined behavior, i.e. according to the C standard the code is literally meaningless and any behavior is "correct". So the code could: * output 4 * output 5 * output "hello, world" * run minesweeper * crash * delete random files * make demons fly out of your nose Optimizers will often assume that undefined behavior can't happen and therefore eliminate all code that could only lead to undefined behavior. TL;DR: C compilers are in fact out to get you.<|eor|><|sor|>In that case, the WTF in the PHP case is probably that the possible implementations of undefined behavior are somewhat documented.<|eor|><|eols|><|endoftext|>
12
lolphp
nikic
cb7prtt
<|sols|><|sot|>echo ++$a + $a++; // may print 4 or 5<|eot|><|sol|>http://php.net/manual/en/language.operators.precedence.php#example-114<|eol|><|sor|>This is something PHP more or less inherits directly from C, where the following is undefined as well: int i = 1; i = ++i + i++; printf("%i\n", i);<|eor|><|sor|>[deleted]<|eor|><|sor|>No, that's not true. Parentheses do not introduce a sequence point.<|eor|><|eols|><|endoftext|>
9
lolphp
smog_alado
cbi07a9
<|sols|><|sot|>echo ++$a + $a++; // may print 4 or 5<|eot|><|sol|>http://php.net/manual/en/language.operators.precedence.php#example-114<|eol|><|sor|>Lots of people talk about how it's inherited from C, but for me, that's the lol here. I'm also sick of how many places in PHP the underlying C implementations get exposed. The whole point of higher managed languages, is to get away from 'lower' languages like C. Otherwise I'd just use that instead. Plenty of other languages also add a rule, to prevent this from being ambiguous.<|eor|><|sor|>The thing that boggles me the most about this one is that it doesnt even seem like the sort of thing that would reasonably get exposed to C. Its not like they are using regular expressions and string replacement to compile PHP down to C and passing it over to gcc (is it???)<|eor|><|eols|><|endoftext|>
8
lolphp
InconsiderateBastard
cb7u1qg
<|sols|><|sot|>echo ++$a + $a++; // may print 4 or 5<|eot|><|sol|>http://php.net/manual/en/language.operators.precedence.php#example-114<|eol|><|soopr|>Discussion on the php internals mailing list: http://thread.gmane.org/gmane.comp.php.devel/81125<|eoopr|><|sor|>Sara's got her work cut out for her. I feel bad that she is stuck fighting with people that clearly don't understand what undefined behavior is. <|eor|><|eols|><|endoftext|>
8
lolphp
djsumdog
cb7pru4
<|sols|><|sot|>echo ++$a + $a++; // may print 4 or 5<|eot|><|sol|>http://php.net/manual/en/language.operators.precedence.php#example-114<|eol|><|sor|>This is something PHP more or less inherits directly from C, where the following is undefined as well: int i = 1; i = ++i + i++; printf("%i\n", i);<|eor|><|sor|>Yep, same with stuff like: a[i] = ++i; Any time you assign something and modify it within the same statement, the results in C are totally dependent on that compiler's particular parse tree and the ANSI specs typically say the results are undefined. <|eor|><|eols|><|endoftext|>
7
lolphp
nikic
cb7pqv6
<|sols|><|sot|>echo ++$a + $a++; // may print 4 or 5<|eot|><|sol|>http://php.net/manual/en/language.operators.precedence.php#example-114<|eol|><|soopr|>Discussion on the php internals mailing list: http://thread.gmane.org/gmane.comp.php.devel/81125<|eoopr|><|sor|>In particular quoting Sara's first post: > If run [the code] right now, it will always produce the same value (4), but it isn't *defined* to do so. What that means is that behavior is subject to change without notice, warning, or justification. This is a somewhat harsh way of saying "Don't write expressions with ambiguous evaluations, that's clowny."<|eor|><|eols|><|endoftext|>
7
lolphp
mirhagk
cb7ugr5
<|sols|><|sot|>echo ++$a + $a++; // may print 4 or 5<|eot|><|sol|>http://php.net/manual/en/language.operators.precedence.php#example-114<|eol|><|sor|>Wait, why would that output 5? $b = ++$a; echo $b + $a++; --> 2 + 2 = 4 $b = $a++; echo ++$a + $b; --> 3 + 1 = 4<|eor|><|sor|>It could return 5 because it could choose to do the ++ after the assignment or before the assignment. It could also choose to do the post-increment after the ++, and go right to left, making it equal 3. It can equal pretty much whatever it wants, because C cares about the compiler more than the programmer (to get super speed), and PHP designers don't know how compilers work.<|eor|><|eols|><|endoftext|>
6
lolphp
tdammers
cb7pznz
<|sols|><|sot|>echo ++$a + $a++; // may print 4 or 5<|eot|><|sol|>http://php.net/manual/en/language.operators.precedence.php#example-114<|eol|><|sor|>This is something PHP more or less inherits directly from C, where the following is undefined as well: int i = 1; i = ++i + i++; printf("%i\n", i);<|eor|><|sor|>Yep, same with stuff like: a[i] = ++i; Any time you assign something and modify it within the same statement, the results in C are totally dependent on that compiler's particular parse tree and the ANSI specs typically say the results are undefined. <|eor|><|sor|>Yep. More specifically, the standard defines "sequence points"; anything between sequence points may be evaluated in any order the implementation sees fit, and the behavior of any code that relies on execution order within a sequence point is undefined.<|eor|><|eols|><|endoftext|>
6
lolphp
NotSantaAtAll
cb7ovhv
<|sols|><|sot|>echo ++$a + $a++; // may print 4 or 5<|eot|><|sol|>http://php.net/manual/en/language.operators.precedence.php#example-114<|eol|><|soopr|>Discussion on the php internals mailing list: http://thread.gmane.org/gmane.comp.php.devel/81125<|eoopr|><|eols|><|endoftext|>
5
lolphp
josefx
cbq5x8o
<|sols|><|sot|>echo ++$a + $a++; // may print 4 or 5<|eot|><|sol|>http://php.net/manual/en/language.operators.precedence.php#example-114<|eol|><|sor|>Lots of people talk about how it's inherited from C, but for me, that's the lol here. I'm also sick of how many places in PHP the underlying C implementations get exposed. The whole point of higher managed languages, is to get away from 'lower' languages like C. Otherwise I'd just use that instead. Plenty of other languages also add a rule, to prevent this from being ambiguous.<|eor|><|sor|>Actually the joke is the comment: The undefined behaviour is unrelated to '+' and '++', it is caused by modifying an reading the same variable without a clear happens before relationship. > Plenty of other languages also add a rule, to prevent this from being ambiguous. That rule is unnecessary once you consider that any code written this way is unreadable and could be split into two or three lines of readable code. In other words: such code should not exist at all unless it is used to point out edge cases in the language grammar.<|eor|><|eols|><|endoftext|>
5
lolphp
InconsiderateBastard
cb7u4h6
<|sols|><|sot|>echo ++$a + $a++; // may print 4 or 5<|eot|><|sol|>http://php.net/manual/en/language.operators.precedence.php#example-114<|eol|><|sor|>Just for kicks, is 4 correct? The $i++ would return 2 to the equation before incrementing, right? <|eor|><|sor|>The behavior is undefined. Anything it outputs is correct.<|eor|><|eols|><|endoftext|>
5
lolphp
hashkitten
jmi7ng
<|sols|><|sot|>Syntax error, unexpected ')', expecting ')'<|eot|><|sol|>https://tio.run/##K8go@P/fxr4go0AhLb9Iw9rQ3k7z/38A<|eol|><|eols|><|endoftext|>
52
lolphp
barubary
gavj1by
<|sols|><|sot|>Syntax error, unexpected ')', expecting ')'<|eot|><|sol|>https://tio.run/##K8go@P/fxr4go0AhLb9Iw9rQ3k7z/38A<|eol|><|sor|>> <?php for(;1?>) PHP Parse error: syntax error, unexpected ')', expecting ')' That's a fun one. Not only does the error message contradict itself, it's also wrong in general. Watch what happens if you actually give it the `)` it's asking for: > <?php for(;1)?>asdf PHP Parse error: syntax error, unexpected ')', expecting ';'<|eor|><|eols|><|endoftext|>
18
lolphp
Miserable_Fuck
gaxeoi3
<|sols|><|sot|>Syntax error, unexpected ')', expecting ')'<|eot|><|sol|>https://tio.run/##K8go@P/fxr4go0AhLb9Iw9rQ3k7z/38A<|eol|><|sor|>Did you file a bug report?<|eor|><|sor|>the real lolphp is always in the comments<|eor|><|eols|><|endoftext|>
16
lolphp
modestlife
gaxwahr
<|sols|><|sot|>Syntax error, unexpected ')', expecting ')'<|eot|><|sol|>https://tio.run/##K8go@P/fxr4go0AhLb9Iw9rQ3k7z/38A<|eol|><|sor|>The first `)` in your error message is parsed by PHP as T_INLINE_HTML because `?>` ends a PHP part (`<?php ... ?>`) within the file. <?php for(;1?>) PHP Parse error: syntax error, unexpected ')', expecting ')' in /home/runner/.code.tio on line 1 <?php for(;1?>foo PHP Parse error: syntax error, unexpected 'foo', expecting ')' in /home/runner/.code.tio on line 1<|eor|><|eols|><|endoftext|>
7
lolphp
HenkPoley
gavhnvc
<|sols|><|sot|>Syntax error, unexpected ')', expecting ')'<|eot|><|sol|>https://tio.run/##K8go@P/fxr4go0AhLb9Iw9rQ3k7z/38A<|eol|><|sor|>Is that a valid syntax in PHP?<|eor|><|sor|>No, basically it says `for(;1`, with some noise around it. Btw, link for Apollo (also confused) https://tio.run/##K8go@P/fxr4go0AhLb9Iw9rQ3k7z/38A The PHP 8 error additionally says it unexpectedly encountered a T_INLINE_HTML (html token), e.g. instead of more PHP tokens. https://3v4l.org/DH5bn<|eor|><|eols|><|endoftext|>
7
lolphp
maweki
9mpzwb
<|sols|><|sot|>Class autoloader throws an exception: the class is ... partially loaded<|eot|><|sol|>https://bugs.php.net/bug.php?id=76980<|eol|><|eols|><|endoftext|>
52
lolphp
maweki
e7geedv
<|sols|><|sot|>Class autoloader throws an exception: the class is ... partially loaded<|eot|><|sol|>https://bugs.php.net/bug.php?id=76980<|eol|><|soopr|>The first comment is pure gold. > I think the way it works now is fine: Foo could be *mostly defined except the interface*, there was no other problem with it, and PHP was quite happy to raise an exception which you totally ignored. **At least this way the code has a chance of working.**<|eoopr|><|eols|><|endoftext|>
47
lolphp
b1ackcat
e7gkmhz
<|sols|><|sot|>Class autoloader throws an exception: the class is ... partially loaded<|eot|><|sol|>https://bugs.php.net/bug.php?id=76980<|eol|><|soopr|>The first comment is pure gold. > I think the way it works now is fine: Foo could be *mostly defined except the interface*, there was no other problem with it, and PHP was quite happy to raise an exception which you totally ignored. **At least this way the code has a chance of working.**<|eoopr|><|sor|>That sentence is pretty much the mantra of how this whole shitty language was designed, it feels like.<|eor|><|eols|><|endoftext|>
38
lolphp
cleeder
e7guhqc
<|sols|><|sot|>Class autoloader throws an exception: the class is ... partially loaded<|eot|><|sol|>https://bugs.php.net/bug.php?id=76980<|eol|><|soopr|>The first comment is pure gold. > I think the way it works now is fine: Foo could be *mostly defined except the interface*, there was no other problem with it, and PHP was quite happy to raise an exception which you totally ignored. **At least this way the code has a chance of working.**<|eoopr|><|sor|>> At least this way the code has a chance of working. _Oh, goodie. /s_<|eor|><|eols|><|endoftext|>
15
lolphp
vita10gy
e7ifdtw
<|sols|><|sot|>Class autoloader throws an exception: the class is ... partially loaded<|eot|><|sol|>https://bugs.php.net/bug.php?id=76980<|eol|><|soopr|>The first comment is pure gold. > I think the way it works now is fine: Foo could be *mostly defined except the interface*, there was no other problem with it, and PHP was quite happy to raise an exception which you totally ignored. **At least this way the code has a chance of working.**<|eoopr|><|sor|>At least the conversation takes a hard right from there. I was fully expecting the "I agree, non issue" [Status: wontfix] PHP has been fundamentally confusing "not erroring" and "working" since conception. Errors are good things when they are things we should fix. Definitely preferable to barreling on in some nonsense state of being.<|eor|><|eols|><|endoftext|>
9
lolphp
dotancohen
e7li141
<|sols|><|sot|>Class autoloader throws an exception: the class is ... partially loaded<|eot|><|sol|>https://bugs.php.net/bug.php?id=76980<|eol|><|sor|>[deleted]<|eor|><|sor|>PHP classes are instantiated every time a PHP script runs, so there's not really a distinction between static initialization failures and dynamic execution failures. People take advantage of this in a whole bunch of elaborate ways, like loading arbitrary scripts as plugins for a core CMS, installing scripts to a running webserver via an admin interface, etc. In that context it makes sense that loading a class is a recoverable error in PHP. For example, an admin installing code into a shared Wordpress installation should not be able to irreparably hose their entire website because some class definition in the PHP script they uploaded couldn't be instantiated. There is definitely a lolphp here in that partially instantiated classes are a major footgun waiting to happen, but insisting that loading code in PHP should be an unrecoverable total program failure is a bad idea.<|eor|><|sor|>> an admin installing code into a shared Wordpress installation should not be > able to irreparably hose their entire website because some class definition in > the PHP script they uploaded couldn't be instantiated. The proper fix for that use case is to have the code loading the plugin wrapped in a `try` statement.<|eor|><|eols|><|endoftext|>
8
lolphp
pilif
e7i2dtv
<|sols|><|sot|>Class autoloader throws an exception: the class is ... partially loaded<|eot|><|sol|>https://bugs.php.net/bug.php?id=76980<|eol|><|sor|>And as always, there's /u/nikic as the voice of reason. <3<|eor|><|eols|><|endoftext|>
7
lolphp
SirClueless
e7i2n2m
<|sols|><|sot|>Class autoloader throws an exception: the class is ... partially loaded<|eot|><|sol|>https://bugs.php.net/bug.php?id=76980<|eol|><|sor|>[deleted]<|eor|><|sor|>PHP classes are instantiated every time a PHP script runs, so there's not really a distinction between static initialization failures and dynamic execution failures. People take advantage of this in a whole bunch of elaborate ways, like loading arbitrary scripts as plugins for a core CMS, installing scripts to a running webserver via an admin interface, etc. In that context it makes sense that loading a class is a recoverable error in PHP. For example, an admin installing code into a shared Wordpress installation should not be able to irreparably hose their entire website because some class definition in the PHP script they uploaded couldn't be instantiated. There is definitely a lolphp here in that partially instantiated classes are a major footgun waiting to happen, but insisting that loading code in PHP should be an unrecoverable total program failure is a bad idea.<|eor|><|eols|><|endoftext|>
7
lolphp
TheBuzzSaw
9feh0h
<|sols|><|sot|>Sooo can we stop saying "Facebook uses PHP" yet?<|eot|><|sol|>https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html<|eol|><|eols|><|endoftext|>
50
lolphp
maweki
e5whwpa
<|sols|><|sot|>Sooo can we stop saying "Facebook uses PHP" yet?<|eot|><|sol|>https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html<|eol|><|sor|>Facebook used PHP to become as big as it is?<|eor|><|sor|>And immediately added a somewhat sane type system.<|eor|><|eols|><|endoftext|>
27
lolphp
mrexodia
e5wa242
<|sols|><|sot|>Sooo can we stop saying "Facebook uses PHP" yet?<|eot|><|sol|>https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html<|eol|><|sor|>Facebook used PHP to become as big as it is?<|eor|><|eols|><|endoftext|>
21
lolphp
jesseschalken
e5wacb0
<|sols|><|sot|>Sooo can we stop saying "Facebook uses PHP" yet?<|eot|><|sol|>https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html<|eol|><|sor|>IIRC the whole conversion of their codebase to partially typed Hack was finished in 2014, and anybody who has said "Facebook uses PHP" since then has been wrong.<|eor|><|eols|><|endoftext|>
16
lolphp
redwall_hp
e5x6505
<|sols|><|sot|>Sooo can we stop saying "Facebook uses PHP" yet?<|eot|><|sol|>https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html<|eol|><|sor|>Facebook used PHP to become as big as it is?<|eor|><|sor|>Because what would be the alternative in 2004? All backend webdev was utter shit back then. Note that it was before Spring or Rails. Anyhow, making a tech choice based on a tech choice 14 years ago is not a smart decision. If Zuckerberg did the same, he'd pick the top web technology from 1990, which is writing your web server from scratch in C with inline assembly.<|eor|><|sor|>Java. It was fucking huge, and still is outside of the California bubble. Hack and HHVM are basically trying to reinvent Java anyway.<|eor|><|eols|><|endoftext|>
16
lolphp
vytah
e5wwb17
<|sols|><|sot|>Sooo can we stop saying "Facebook uses PHP" yet?<|eot|><|sol|>https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html<|eol|><|sor|>Facebook used PHP to become as big as it is?<|eor|><|sor|>Because what would be the alternative in 2004? All backend webdev was utter shit back then. Note that it was before Spring or Rails. Anyhow, making a tech choice based on a tech choice 14 years ago is not a smart decision. If Zuckerberg did the same, he'd pick the top web technology from 1990, which is writing your web server from scratch in C with inline assembly.<|eor|><|eols|><|endoftext|>
11
lolphp
BooCMB
e7kmnry
<|sols|><|sot|>Sooo can we stop saying "Facebook uses PHP" yet?<|eot|><|sol|>https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html<|eol|><|sor|>Now that HHVM doesnt have performance advantage over PHP7, what other avenues for growth are there, other than focusing on extended syntax? The project is obsolete otherwise, so makes sense.<|eor|><|sor|>Hey, Trevor\_GoodchiId, just a quick heads-up: **sence** is actually spelled **sense**. You can remember it by **ends with -se**. Have a nice day! ^^^^The ^^^^parent ^^^^commenter ^^^^can ^^^^reply ^^^^with ^^^^'delete' ^^^^to ^^^^delete ^^^^this ^^^^comment.<|eor|><|sor|>Hey CommonMisspellingBot, just a quick heads up: Your spelling hints are really shitty because they're all essentially "remember the fucking spelling of the fucking word". You're useless. Have a nice day!<|eor|><|eols|><|endoftext|>
11
lolphp
mellett68
e5wdvym
<|sols|><|sot|>Sooo can we stop saying "Facebook uses PHP" yet?<|eot|><|sol|>https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html<|eol|><|sor|>Oh shit, hack is still going<|eor|><|eols|><|endoftext|>
10
lolphp
squiggleslash
e5y2csw
<|sols|><|sot|>Sooo can we stop saying "Facebook uses PHP" yet?<|eot|><|sol|>https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html<|eol|><|sor|>Facebook used PHP to become as big as it is?<|eor|><|sor|>Because what would be the alternative in 2004? All backend webdev was utter shit back then. Note that it was before Spring or Rails. Anyhow, making a tech choice based on a tech choice 14 years ago is not a smart decision. If Zuckerberg did the same, he'd pick the top web technology from 1990, which is writing your web server from scratch in C with inline assembly.<|eor|><|sor|>Java. It was fucking huge, and still is outside of the California bubble. Hack and HHVM are basically trying to reinvent Java anyway.<|eor|><|sor|>Plus Python and Perl were widely used at that point for building websites. (And for those complaining that Java only had JSP back then, it's not as if Facebook was built using an off-the-shelf PHP "framework". Although come to think of it, I've never tried visiting [facebook.com/wp-admin](https://facebook.com/wp-admin) ;-) &#x200B;<|eor|><|eols|><|endoftext|>
10
lolphp
vytah
e5x7ugz
<|sols|><|sot|>Sooo can we stop saying "Facebook uses PHP" yet?<|eot|><|sol|>https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html<|eol|><|sor|>Facebook used PHP to become as big as it is?<|eor|><|sor|>Because what would be the alternative in 2004? All backend webdev was utter shit back then. Note that it was before Spring or Rails. Anyhow, making a tech choice based on a tech choice 14 years ago is not a smart decision. If Zuckerberg did the same, he'd pick the top web technology from 1990, which is writing your web server from scratch in C with inline assembly.<|eor|><|sor|>Java. It was fucking huge, and still is outside of the California bubble. Hack and HHVM are basically trying to reinvent Java anyway.<|eor|><|sor|>Webdev in Java in 2004 was also shit. Remember, no Spring, no JSF. You had to choose between JSP and Struts (and some other less popular things). <|eor|><|eols|><|endoftext|>
9
lolphp
TorbenKoehn
e6g2jkb
<|sols|><|sot|>Sooo can we stop saying "Facebook uses PHP" yet?<|eot|><|sol|>https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html<|eol|><|sor|>Facebook used PHP to become as big as it is?<|eor|><|sor|>And immediately added a somewhat sane type system.<|eor|><|sor|>Well, PHP is getting a sane type-system version by version right now, too.<|eor|><|eols|><|endoftext|>
8
lolphp
Hathery
e5x181s
<|sols|><|sot|>Sooo can we stop saying "Facebook uses PHP" yet?<|eot|><|sol|>https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html<|eol|><|sor|>From the outside looking in, the most interesting part of the post is the note about their new release cadence: > As we expect the language to evolve rapidly, we strongly recommend using the regular releases instead of the LTS releases for large projects; while this does mean you need to upgrade more often, both us and our users have found that it is generally easier to catch up on 2 months worth of changes 3 times as often than 6 months of changes in one go. We will also be re-evaluating the length of our release cycle; one possibility is that we will move to releases every 4 weeks, with these releases being supported for 6-8 weeks. That cycle will work for FB where they are constantly iterating and also have early insight as to where the language is going before they get there but for anyone on the outside or for slower moving projects, that cadence seems fairly punishing. Is that a big change from how they release now?<|eor|><|eols|><|endoftext|>
6
lolphp
wafflePower1
e6b0iur
<|sols|><|sot|>Sooo can we stop saying "Facebook uses PHP" yet?<|eot|><|sol|>https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html<|eol|><|sor|>Facebook chose PHP and in the end reinvented Java. 10/10 would read the story again<|eor|><|eols|><|endoftext|>
5
lolphp
bwoebi
76vg5a
<|sols|><|sot|>[] ** [] === 0 (but e.g. [] - [] will fail)<|eot|><|sol|>https://3v4l.org/i06FN<|eol|><|eols|><|endoftext|>
55
lolphp
John2143658709
dohc6e5
<|sols|><|sot|>[] ** [] === 0 (but e.g. [] - [] will fail)<|eot|><|sol|>https://3v4l.org/i06FN<|eol|><|sor|>On today's episode of "Is it a javascript feature or a php bug"...<|eor|><|eols|><|endoftext|>
33
lolphp
Grimy_
dohgohp
<|sols|><|sot|>[] ** [] === 0 (but e.g. [] - [] will fail)<|eot|><|sol|>https://3v4l.org/i06FN<|eol|><|sor|>But wait, [it gets better](https://3v4l.org/tqE64)!<|eor|><|eols|><|endoftext|>
22
lolphp
bwoebi
dohjb5u
<|sols|><|sot|>[] ** [] === 0 (but e.g. [] - [] will fail)<|eot|><|sol|>https://3v4l.org/i06FN<|eol|><|sor|>who would do that? you just got your types wrong and want to blame PHP<|eor|><|soopr|>I am blaming PHP for not properly yelling at me here (I expect an Error: unsupported operand types)<|eoopr|><|eols|><|endoftext|>
17
lolphp
bwoebi
doheljg
<|sols|><|sot|>[] ** [] === 0 (but e.g. [] - [] will fail)<|eot|><|sol|>https://3v4l.org/i06FN<|eol|><|sor|>On today's episode of "Is it a javascript feature or a php bug"...<|eor|><|soopr|>Well, in Javascript `[] - []` will work perfectly though. So, either way, it's inconsistent in PHP.<|eoopr|><|eols|><|endoftext|>
15
lolphp
bj_christianson
doi31ya
<|sols|><|sot|>[] ** [] === 0 (but e.g. [] - [] will fail)<|eot|><|sol|>https://3v4l.org/i06FN<|eol|><|sor|>who would do that? you just got your types wrong and want to blame PHP<|eor|><|soopr|>I am blaming PHP for not properly yelling at me here (I expect an Error: unsupported operand types)<|eoopr|><|sor|>FTFY: I am blaming a language with dynamic typing for doing dynamic typing. <|eor|><|soopr|>I'm fine with dynamic typing between scalars, but there's no point in dynamic typing with complex types.<|eoopr|><|sor|>Its the inconsistency, too. `**` triggers coercion to a number, but not `-`.<|eor|><|eols|><|endoftext|>
9
lolphp
jfb1337
doi11m3
<|sols|><|sot|>[] ** [] === 0 (but e.g. [] - [] will fail)<|eot|><|sol|>https://3v4l.org/i06FN<|eol|><|sor|>who would do that? you just got your types wrong and want to blame PHP<|eor|><|soopr|>I am blaming PHP for not properly yelling at me here (I expect an Error: unsupported operand types)<|eoopr|><|sor|>FTFY: I am blaming a language with dynamic typing for doing dynamic typing. <|eor|><|sor|>*weak typing FTFY<|eor|><|eols|><|endoftext|>
8
lolphp
bwoebi
doi0653
<|sols|><|sot|>[] ** [] === 0 (but e.g. [] - [] will fail)<|eot|><|sol|>https://3v4l.org/i06FN<|eol|><|sor|>who would do that? you just got your types wrong and want to blame PHP<|eor|><|soopr|>I am blaming PHP for not properly yelling at me here (I expect an Error: unsupported operand types)<|eoopr|><|sor|>FTFY: I am blaming a language with dynamic typing for doing dynamic typing. <|eor|><|soopr|>I'm fine with dynamic typing between scalars, but there's no point in dynamic typing with complex types.<|eoopr|><|eols|><|endoftext|>
8
lolphp
carlos_vini
dohx6l9
<|sols|><|sot|>[] ** [] === 0 (but e.g. [] - [] will fail)<|eot|><|sol|>https://3v4l.org/i06FN<|eol|><|sor|>who would do that? you just got your types wrong and want to blame PHP<|eor|><|soopr|>I am blaming PHP for not properly yelling at me here (I expect an Error: unsupported operand types)<|eoopr|><|sor|>with that I can agree. Try it in JS though: * [] - [] = 0 * [] + [] = "" * [] * [] = 0 * [] / [] = NaN And... * {} + [] = 0 * [] + {} = "[object Object]"<|eor|><|eols|><|endoftext|>
7
lolphp
Pesthuf
dolp463
<|sols|><|sot|>[] ** [] === 0 (but e.g. [] - [] will fail)<|eot|><|sol|>https://3v4l.org/i06FN<|eol|><|sor|>Will this be the birth of PHFuck?<|eor|><|eols|><|endoftext|>
6
lolphp
ProjectAmmeh
2zsuqj
<|sols|><|sot|>PHP Easter Eggs - Because server software needs easter eggs too!<|eot|><|sol|>http://www.0php.com/php_easter_egg.php<|eol|><|eols|><|endoftext|>
50
lolphp
barubary
cpm117f
<|sols|><|sot|>PHP Easter Eggs - Because server software needs easter eggs too!<|eot|><|sol|>http://www.0php.com/php_easter_egg.php<|eol|><|sor|>... Except almost all of these have been removed in newer versions of PHP. Yet another quality shitpost bashing PHP for things that aren't a problem. <|eor|><|sor|>> almost all ( )<|eor|><|eols|><|endoftext|>
45
lolphp
suspiciously_calm
cpmi4zh
<|sols|><|sot|>PHP Easter Eggs - Because server software needs easter eggs too!<|eot|><|sol|>http://www.0php.com/php_easter_egg.php<|eol|><|sor|>> If you see such a URL in your website logs, it may be because someone is trying to determine if your server is running PHP and attempting to discover weaknesses in your system. Or they're just trying to see the funny easter eggs. Plausible deniability built-in!<|eor|><|eols|><|endoftext|>
35
lolphp
ProjectAmmeh
cplzd9n
<|sols|><|sot|>PHP Easter Eggs - Because server software needs easter eggs too!<|eot|><|sol|>http://www.0php.com/php_easter_egg.php<|eol|><|sor|>... Except almost all of these have been removed in newer versions of PHP. Yet another quality shitpost bashing PHP for things that aren't a problem. <|eor|><|soopr|>>ELEPHANT PHP LOGO: >PHP Version 5.3.0 - current Also, the issue with these is that they allow easy PHP version identification for an attacker. Even if they took them out now, that'd only add another data point.<|eoopr|><|eols|><|endoftext|>
26
lolphp
gu3st12
cplz2ew
<|sols|><|sot|>PHP Easter Eggs - Because server software needs easter eggs too!<|eot|><|sol|>http://www.0php.com/php_easter_egg.php<|eol|><|sor|>... Except almost all of these have been removed in newer versions of PHP. Yet another quality shitpost bashing PHP for things that aren't a problem. <|eor|><|eols|><|endoftext|>
25
lolphp
merreborn
cpm6iuk
<|sols|><|sot|>PHP Easter Eggs - Because server software needs easter eggs too!<|eot|><|sol|>http://www.0php.com/php_easter_egg.php<|eol|><|sor|>... Except almost all of these have been removed in newer versions of PHP. Yet another quality shitpost bashing PHP for things that aren't a problem. <|eor|><|soopr|>>ELEPHANT PHP LOGO: >PHP Version 5.3.0 - current Also, the issue with these is that they allow easy PHP version identification for an attacker. Even if they took them out now, that'd only add another data point.<|eoopr|><|sor|>http://php.net/manual/en/ini.core.php#ini.expose-php Removed in PHP 5.5.0 in 2013.<|eor|><|eols|><|endoftext|>
19
lolphp
captainramen
cpnxoqg
<|sols|><|sot|>PHP Easter Eggs - Because server software needs easter eggs too!<|eot|><|sol|>http://www.0php.com/php_easter_egg.php<|eol|><|sor|>... Except almost all of these have been removed in newer versions of PHP. Yet another quality shitpost bashing PHP for things that aren't a problem. <|eor|><|sor|>Just because *almost* all of them may now be removed doesn't mean its not an lol that these were present in PHP in the first place. The fact that these were put in there at all reflects on the quality / culture of PHP, and is funny to everyone except PHP users. Not to mention that these things remained in there for decades and weren't removed. And there are still sites out there using these php versions.<|eor|><|sor|>> And there are still sites out there using these php versions. The majority in fact<|eor|><|eols|><|endoftext|>
12
lolphp
cite-reader
cpo4jew
<|sols|><|sot|>PHP Easter Eggs - Because server software needs easter eggs too!<|eot|><|sol|>http://www.0php.com/php_easter_egg.php<|eol|><|sor|>... Except almost all of these have been removed in newer versions of PHP. Yet another quality shitpost bashing PHP for things that aren't a problem. <|eor|><|sor|>[deleted]<|eor|><|sor|>Aww a ruby dev! How does it feel to use a toy language?<|eor|><|sor|>How does it feel using personal homepage?<|eor|><|sor|>Like sadness and an endless spiral of terrible ideas as you watch with listless helplessness as Internals gradually tries to import features from other, better languages without actually understanding why they're designed that way or how to implement them well, and then you remember that the company that signs your paychecks has been planning to upgrade PHP "real soon now" for *months* so you'll never get to use even the shadow of a good idea anyway.<|eor|><|eols|><|endoftext|>
7
lolphp
edave64
cpru73f
<|sols|><|sot|>PHP Easter Eggs - Because server software needs easter eggs too!<|eot|><|sol|>http://www.0php.com/php_easter_egg.php<|eol|><|sor|>... Except almost all of these have been removed in newer versions of PHP. Yet another quality shitpost bashing PHP for things that aren't a problem. <|eor|><|sor|>[deleted]<|eor|><|sor|>Aww a ruby dev! How does it feel to use a toy language?<|eor|><|sor|>Why do you consider Ruby a toy language? <|eor|><|sor|>Because it doesn't cause trauma ;)<|eor|><|eols|><|endoftext|>
7
lolphp
Sandbucketman
cplzh5r
<|sols|><|sot|>PHP Easter Eggs - Because server software needs easter eggs too!<|eot|><|sol|>http://www.0php.com/php_easter_egg.php<|eol|><|sor|>... Except almost all of these have been removed in newer versions of PHP. Yet another quality shitpost bashing PHP for things that aren't a problem. <|eor|><|sor|>It's great when people experiment or find things by accident that really are worth a laugh because of poor or outdated design. It's not so great when people are desperately scrounging for anything that could be perceived negative just so they can start wanking over how bad php is. We need a subreddit where we start bashing posts that are designed more poorly than PHP, there's plenty of those here now.<|eor|><|eols|><|endoftext|>
5
lolphp
pitiless
2sxic4
<|sols|><|sot|>'new' keyword returning null - only in PHP<|eot|><|sol|>http://article.gmane.org/gmane.comp.php.devel/93547<|eol|><|eols|><|endoftext|>
50
lolphp
barubary
cntt4ky
<|sols|><|sot|>'new' keyword returning null - only in PHP<|eot|><|sol|>http://article.gmane.org/gmane.comp.php.devel/93547<|eol|><|sor|>> <?php $foo = new IntlGregorianCalendar(new StdClass); //Output: Catchable fatal error: Object of class stdClass could not be converted to string in.. ?> > Despite the word catchable, this is not actually an exception that is catchable, it is an error. What.<|eor|><|eols|><|endoftext|>
38
lolphp
greyphilosopher
cntwb5s
<|sols|><|sot|>'new' keyword returning null - only in PHP<|eot|><|sol|>http://article.gmane.org/gmane.comp.php.devel/93547<|eol|><|sor|>C's memory allocation functions return NULL on failure. C++'s are supposed to throw, but given how many people compile without exceptions, it's always worth remembering that they *might* return 0 instead. Although honestly I've never worked on a codebase where out-of-memory was considered a recoverable error - it's usually pretty damn fatal.<|eor|><|sor|>>C's memory allocation functions return NULL on failure. That's because C DOESN'T HAVE EXCEPTIONS. When C does something, it's usually an example of what you shouldn't do in a modern language.<|eor|><|eols|><|endoftext|>
26
lolphp
barubary
cnu0uil
<|sols|><|sot|>'new' keyword returning null - only in PHP<|eot|><|sol|>http://article.gmane.org/gmane.comp.php.devel/93547<|eol|><|sor|>link to where he gets told this is a feature not a bug?<|eor|><|sor|>Not quite: http://article.gmane.org/gmane.comp.php.devel/93549<|eor|><|eols|><|endoftext|>
21
lolphp
cythrawll
cnu7dsb
<|sols|><|sot|>'new' keyword returning null - only in PHP<|eot|><|sol|>http://article.gmane.org/gmane.comp.php.devel/93547<|eol|><|sor|>> <?php $foo = new IntlGregorianCalendar(new StdClass); //Output: Catchable fatal error: Object of class stdClass could not be converted to string in.. ?> > Despite the word catchable, this is not actually an exception that is catchable, it is an error. What.<|eor|><|sor|>http://docs.php.net/manual/en/function.set-error-handler.php Long before PHP had exceptions, it had errors as it's main source of error handling. Catchable fatal errors are able to be handled by set_error_handler allowing the programmer to decide whether it comes back with the engine in a clean state.<|eor|><|eols|><|endoftext|>
18
lolphp
ZorbaTHut
cntsaz4
<|sols|><|sot|>'new' keyword returning null - only in PHP<|eot|><|sol|>http://article.gmane.org/gmane.comp.php.devel/93547<|eol|><|sor|>C's memory allocation functions return NULL on failure. C++'s are supposed to throw, but given how many people compile without exceptions, it's always worth remembering that they *might* return 0 instead. Although honestly I've never worked on a codebase where out-of-memory was considered a recoverable error - it's usually pretty damn fatal.<|eor|><|eols|><|endoftext|>
16
lolphp
barubary
cntt2tp
<|sols|><|sot|>'new' keyword returning null - only in PHP<|eot|><|sol|>http://article.gmane.org/gmane.comp.php.devel/93547<|eol|><|sor|>C's memory allocation functions return NULL on failure. C++'s are supposed to throw, but given how many people compile without exceptions, it's always worth remembering that they *might* return 0 instead. Although honestly I've never worked on a codebase where out-of-memory was considered a recoverable error - it's usually pretty damn fatal.<|eor|><|sor|>PHP's `new` doesn't allocate memory, though. (PHP implicitly allocates memory all over the place.) `new` just initializes objects. Hmm, I wonder if you can get `array()` to return null.<|eor|><|eols|><|endoftext|>
14
lolphp
greyphilosopher
cntwecb
<|sols|><|sot|>'new' keyword returning null - only in PHP<|eot|><|sol|>http://article.gmane.org/gmane.comp.php.devel/93547<|eol|><|sor|>link to where he gets told this is a feature not a bug?<|eor|><|sor|>This. It's the community of developers that cause PHP to be so bad.<|eor|><|eols|><|endoftext|>
13
lolphp
Rainfly_X
cnudhii
<|sols|><|sot|>'new' keyword returning null - only in PHP<|eot|><|sol|>http://article.gmane.org/gmane.comp.php.devel/93547<|eol|><|sor|>link to where he gets told this is a feature not a bug?<|eor|><|sor|>Not quite: http://article.gmane.org/gmane.comp.php.devel/93549<|eor|><|sor|>Oh my god.<|eor|><|eols|><|endoftext|>
7
lolphp
HildartheDorf
cnu7fqp
<|sols|><|sot|>'new' keyword returning null - only in PHP<|eot|><|sol|>http://article.gmane.org/gmane.comp.php.devel/93547<|eol|><|sor|>C's memory allocation functions return NULL on failure. C++'s are supposed to throw, but given how many people compile without exceptions, it's always worth remembering that they *might* return 0 instead. Although honestly I've never worked on a codebase where out-of-memory was considered a recoverable error - it's usually pretty damn fatal.<|eor|><|sor|>Compiling C++ without exceptions then calling (throwing) new is undefined behaviour (hell, just compiling without exceptions is technically undefined behaviour). You have to explicity request "return null on failure".<|eor|><|eols|><|endoftext|>
6
lolphp
vytah
27rvrf
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|eols|><|endoftext|>
52
lolphp
Banane9
ci3rqsl
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>How does that even happen? Also : Notice how nobody cared, *for four months*.<|eor|><|eols|><|endoftext|>
26
lolphp
DoctorWaluigiTime
ci3s3lm
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>Meh, bugs happen.<|eor|><|sor|>Nice try, PHP team.<|eor|><|eols|><|endoftext|>
25
lolphp
thedarkhaze
ci3xcxn
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>Honest question: PHP development... do they even have regression tests? How does this stuff even get *merged* let alone released?<|eor|><|sor|>They have tests they just fail http://gcov.php.net/viewer.php?version=PHP_5_6<|eor|><|eols|><|endoftext|>
18
lolphp
Drainedsoul
ci4181d
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>I'm surprised they didn't just update the manual and announce that it works as intended.<|eor|><|sor|>Well it'd make sense, someone might be relying on this behaviour to implement an infinite loop. <|eor|><|eols|><|endoftext|>
17
lolphp
ajmarks
ci3wojc
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>I'm surprised they didn't just update the manual and announce that it works as intended.<|eor|><|eols|><|endoftext|>
14
lolphp
shillbert
ci3zqwc
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>Honest question: PHP development... do they even have regression tests? How does this stuff even get *merged* let alone released?<|eor|><|sor|>They have tests they just fail http://gcov.php.net/viewer.php?version=PHP_5_6<|eor|><|sor|>>Expected Test Failures: 40 >Expected Oh deer lord<|eor|><|eols|><|endoftext|>
14
lolphp
merreborn
ci4178u
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>Meh, bugs happen.<|eor|><|sor|>I'm sorry, but this is such a lame fucking excuse. On one hand you have a bug in a business application - maybe it costs $1,000 or even $10,000 to fix, a drop in the bucket for some places. Then you have a bug in a space probe. Billions of dollars gone and 30 years to wait for the next launch window. Some kinds of failures are acceptable. Language design is not one of them.<|eor|><|sor|>Dear god, I hope there aren't any space probes running php<|eor|><|eols|><|endoftext|>
13
lolphp
ajmarks
ci41bh2
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>I'm surprised they didn't just update the manual and announce that it works as intended.<|eor|><|sor|>Well it'd make sense, someone might be relying on this behaviour to implement an infinite loop. <|eor|><|sor|>You know, I've been looking for a way to implement `while (1)` without the annoyance of `break` and `continue`.<|eor|><|eols|><|endoftext|>
11
lolphp
Trig90
ci3uu0h
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>How does that even happen? Also : Notice how nobody cared, *for four months*.<|eor|><|sor|>Nobody uses finally /sarcasm<|eor|><|eols|><|endoftext|>
9
lolphp
ElusiveGuy
ci4dxxw
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>Meh, bugs happen.<|eor|><|sor|>I'm sorry, but this is such a lame fucking excuse. On one hand you have a bug in a business application - maybe it costs $1,000 or even $10,000 to fix, a drop in the bucket for some places. Then you have a bug in a space probe. Billions of dollars gone and 30 years to wait for the next launch window. Some kinds of failures are acceptable. Language design is not one of them.<|eor|><|sor|>Dear god, I hope there aren't any space probes running php<|eor|><|sor|>I remember interviewing for a job sometime back in 2001, and they said one of their side projects was working on PHP code that would run on one of the Mars Rovers. No joke.<|eor|><|sor|>Depends on your definition of "run", I suppose.<|eor|><|eols|><|endoftext|>
9
lolphp
michaelpb
ci3uyju
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>Honest question: PHP development... do they even have regression tests? How does this stuff even get *merged* let alone released?<|eor|><|eols|><|endoftext|>
8
lolphp
Banane9
ci3yvd8
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>Honest question: PHP development... do they even have regression tests? How does this stuff even get *merged* let alone released?<|eor|><|sor|>They have tests they just fail http://gcov.php.net/viewer.php?version=PHP_5_6<|eor|><|sor|>Holy! 104 test failures ... With just 0.3% code coverage of all the tests.<|eor|><|eols|><|endoftext|>
8
lolphp
captainramen
ci41nwi
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>Meh, bugs happen.<|eor|><|sor|>I'm sorry, but this is such a lame fucking excuse. On one hand you have a bug in a business application - maybe it costs $1,000 or even $10,000 to fix, a drop in the bucket for some places. Then you have a bug in a space probe. Billions of dollars gone and 30 years to wait for the next launch window. Some kinds of failures are acceptable. Language design is not one of them.<|eor|><|sor|>Dear god, I hope there aren't any space probes running php<|eor|><|sor|>I remember interviewing for a job sometime back in 2001, and they said one of their side projects was working on PHP code that would run on one of the Mars Rovers. No joke.<|eor|><|eols|><|endoftext|>
8
lolphp
captainramen
ci3za5c
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>Meh, bugs happen.<|eor|><|sor|>I'm sorry, but this is such a lame fucking excuse. On one hand you have a bug in a business application - maybe it costs $1,000 or even $10,000 to fix, a drop in the bucket for some places. Then you have a bug in a space probe. Billions of dollars gone and 30 years to wait for the next launch window. Some kinds of failures are acceptable. Language design is not one of them.<|eor|><|eols|><|endoftext|>
7
lolphp
iconoklast
ci4b1sx
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>How does that even happen? Also : Notice how nobody cared, *for four months*.<|eor|><|sor|>Nobody uses finally /sarcasm<|eor|><|sor|>It probably actually is true that not many use a try/finally inside another try/finally.<|eor|><|sor|>Yeah, nesting try/finally is a strong indication that your function is doing too many things and should be decomposed. Not that I'm excusing this sort of silliness.<|eor|><|eols|><|endoftext|>
7
lolphp
vytah
ci8h8kb
<|sols|><|sot|>In case of nested finally blocks, the outer block loops forever<|eot|><|sol|>https://bugs.php.net/bug.php?id=66608<|eol|><|sor|>Honest question: PHP development... do they even have regression tests? How does this stuff even get *merged* let alone released?<|eor|><|sor|>They have tests they just fail http://gcov.php.net/viewer.php?version=PHP_5_6<|eor|><|sor|>Holy! 104 test failures ... With just 0.3% code coverage of all the tests.<|eor|><|soopr|>It's like someone noticed that and said: "Guys, I think we should stop writing tests, they all fail anyway."<|eoopr|><|eols|><|endoftext|>
7
lolphp
midir
20eisu
<|soss|><|sot|>Array errors<|eot|><|sost|> error_reporting(-1); // show all possible errors $obj = new stdclass(); $arr = array(); var_dump($arr['foo']); // Notice: Undefined index var_dump($arr[$obj]); // Warning: Illegal offset type $arr = null; var_dump($arr['foo']); // No error var_dump($arr[$obj]); // No error $arr = null; $arr['i'] = $arr['i'] + 1; // No error $arr = null; $arr['i']++; // Notice: Undefined index (Tested with 5.5.5.)<|eost|><|eoss|><|endoftext|>
50
lolphp
lisp-case
cg2l9xe
<|soss|><|sot|>Array errors<|eot|><|sost|> error_reporting(-1); // show all possible errors $obj = new stdclass(); $arr = array(); var_dump($arr['foo']); // Notice: Undefined index var_dump($arr[$obj]); // Warning: Illegal offset type $arr = null; var_dump($arr['foo']); // No error var_dump($arr[$obj]); // No error $arr = null; $arr['i'] = $arr['i'] + 1; // No error $arr = null; $arr['i']++; // Notice: Undefined index (Tested with 5.5.5.)<|eost|><|sor|> You know, normally I can explain PHP's behavior. I can usually see *some* strange, misguided thought process that would have made whatever weird thing it's doing seem like a good idea. This? I have no idea what this is. I give up.<|eor|><|eoss|><|endoftext|>
36
lolphp
InconsiderateBastard
cg2vmqs
<|soss|><|sot|>Array errors<|eot|><|sost|> error_reporting(-1); // show all possible errors $obj = new stdclass(); $arr = array(); var_dump($arr['foo']); // Notice: Undefined index var_dump($arr[$obj]); // Warning: Illegal offset type $arr = null; var_dump($arr['foo']); // No error var_dump($arr[$obj]); // No error $arr = null; $arr['i'] = $arr['i'] + 1; // No error $arr = null; $arr['i']++; // Notice: Undefined index (Tested with 5.5.5.)<|eost|><|sor|>I'm a fan of: $test = "test"; $obj = new stdclass(); var_dump($test[$obj]); It spits out an illegal offset, a notice that $obj can't be converted into an integer, and string(1) "e". So it's an illegal offset, but it still uses it as an offset. It can't convert it to an int, but it converts it to 1. Edit: It won't end up accessing the value at index 1 if its an array the way it does for a string.<|eor|><|eoss|><|endoftext|>
13
lolphp
suspiciously_calm
cg2m87j
<|soss|><|sot|>Array errors<|eot|><|sost|> error_reporting(-1); // show all possible errors $obj = new stdclass(); $arr = array(); var_dump($arr['foo']); // Notice: Undefined index var_dump($arr[$obj]); // Warning: Illegal offset type $arr = null; var_dump($arr['foo']); // No error var_dump($arr[$obj]); // No error $arr = null; $arr['i'] = $arr['i'] + 1; // No error $arr = null; $arr['i']++; // Notice: Undefined index (Tested with 5.5.5.)<|eost|><|sor|>Cool you figured out that $i++ is not the same as $i = $i + 1;<|eor|><|sor|>Yes, because what operator is applied to the result of an array element reference should determine whether or not the element can be referenced in the first place ....<|eor|><|eoss|><|endoftext|>
7
lolphp
catcradle5
1z2kep
<|soss|><|sot|>A top tech company I recently interviewed for told me<|eot|><|sost|>that all employees were free, and even encouraged, to write code and personal scripts in whatever language they like. They had a totally open ecosystem and listed all the team members who were experts in X language. Java, Python, Scala, Ruby, C++, Haskell; the list went on. At the end of his cheerful praise for the company, though, the interviewer looked at me sternly and said: "however, there is one exception. Absolutely no PHP allowed." He went on to explain why PHP simply was not worth the trouble, from a security, development, and maintenance perspective. I smiled and nodded in great agreement. The next interviewer also extolled the open culture of the company, ending with "you're free to use any language you like, other than PHP!" Apparently it was an official company policy, and has been for years. It was a pleasant surprise. The company is in the Alexa top 15 (top 5 for US) and is extremely well-known, too. Anyone else have similiar experiences with companies they've worked at? Or perhaps exact opposite experiences?<|eost|><|eoss|><|endoftext|>
54
lolphp
ma-int
cfpy2v2
<|soss|><|sot|>A top tech company I recently interviewed for told me<|eot|><|sost|>that all employees were free, and even encouraged, to write code and personal scripts in whatever language they like. They had a totally open ecosystem and listed all the team members who were experts in X language. Java, Python, Scala, Ruby, C++, Haskell; the list went on. At the end of his cheerful praise for the company, though, the interviewer looked at me sternly and said: "however, there is one exception. Absolutely no PHP allowed." He went on to explain why PHP simply was not worth the trouble, from a security, development, and maintenance perspective. I smiled and nodded in great agreement. The next interviewer also extolled the open culture of the company, ending with "you're free to use any language you like, other than PHP!" Apparently it was an official company policy, and has been for years. It was a pleasant surprise. The company is in the Alexa top 15 (top 5 for US) and is extremely well-known, too. Anyone else have similiar experiences with companies they've worked at? Or perhaps exact opposite experiences?<|eost|><|sor|>So the top 5 US websites are: * google.com * facebook.com * youtube.com * yahoo.com * amazon.com We can cross out Facebook because they obviously use PHP. Youtube is long enough part of Google that we can assume this is one company. So we must choose between: * Google * Yahoo * Amazon Yahoo [seems to use PHP](https://tas-yahoo.taleo.net/careersection/yahoo_global_cs/jobsearch.ftl) and since you mention the fact that it is in top 15 Worldwide and top 5 US my bet is on **Amazon**. But good for them! I can understand the decision.<|eor|><|eoss|><|endoftext|>
43
lolphp
Serialk
cfq0itk
<|soss|><|sot|>A top tech company I recently interviewed for told me<|eot|><|sost|>that all employees were free, and even encouraged, to write code and personal scripts in whatever language they like. They had a totally open ecosystem and listed all the team members who were experts in X language. Java, Python, Scala, Ruby, C++, Haskell; the list went on. At the end of his cheerful praise for the company, though, the interviewer looked at me sternly and said: "however, there is one exception. Absolutely no PHP allowed." He went on to explain why PHP simply was not worth the trouble, from a security, development, and maintenance perspective. I smiled and nodded in great agreement. The next interviewer also extolled the open culture of the company, ending with "you're free to use any language you like, other than PHP!" Apparently it was an official company policy, and has been for years. It was a pleasant surprise. The company is in the Alexa top 15 (top 5 for US) and is extremely well-known, too. Anyone else have similiar experiences with companies they've worked at? Or perhaps exact opposite experiences?<|eost|><|sor|>So the top 5 US websites are: * google.com * facebook.com * youtube.com * yahoo.com * amazon.com We can cross out Facebook because they obviously use PHP. Youtube is long enough part of Google that we can assume this is one company. So we must choose between: * Google * Yahoo * Amazon Yahoo [seems to use PHP](https://tas-yahoo.taleo.net/careersection/yahoo_global_cs/jobsearch.ftl) and since you mention the fact that it is in top 15 Worldwide and top 5 US my bet is on **Amazon**. But good for them! I can understand the decision.<|eor|><|sor|>I'll go for Amazon too, but I don't think Google would be that happy if you began to add some PHP to their codebase.<|eor|><|eoss|><|endoftext|>
17
lolphp
MonadicTraversal
cfq7cev
<|soss|><|sot|>A top tech company I recently interviewed for told me<|eot|><|sost|>that all employees were free, and even encouraged, to write code and personal scripts in whatever language they like. They had a totally open ecosystem and listed all the team members who were experts in X language. Java, Python, Scala, Ruby, C++, Haskell; the list went on. At the end of his cheerful praise for the company, though, the interviewer looked at me sternly and said: "however, there is one exception. Absolutely no PHP allowed." He went on to explain why PHP simply was not worth the trouble, from a security, development, and maintenance perspective. I smiled and nodded in great agreement. The next interviewer also extolled the open culture of the company, ending with "you're free to use any language you like, other than PHP!" Apparently it was an official company policy, and has been for years. It was a pleasant surprise. The company is in the Alexa top 15 (top 5 for US) and is extremely well-known, too. Anyone else have similiar experiences with companies they've worked at? Or perhaps exact opposite experiences?<|eost|><|sor|>> that all employees were free, and even encouraged, to write code and personal scripts in whatever language they like. This seems like a really good way to have an unmaintainable codebase.<|eor|><|eoss|><|endoftext|>
16
lolphp
merreborn
cfqcu5p
<|soss|><|sot|>A top tech company I recently interviewed for told me<|eot|><|sost|>that all employees were free, and even encouraged, to write code and personal scripts in whatever language they like. They had a totally open ecosystem and listed all the team members who were experts in X language. Java, Python, Scala, Ruby, C++, Haskell; the list went on. At the end of his cheerful praise for the company, though, the interviewer looked at me sternly and said: "however, there is one exception. Absolutely no PHP allowed." He went on to explain why PHP simply was not worth the trouble, from a security, development, and maintenance perspective. I smiled and nodded in great agreement. The next interviewer also extolled the open culture of the company, ending with "you're free to use any language you like, other than PHP!" Apparently it was an official company policy, and has been for years. It was a pleasant surprise. The company is in the Alexa top 15 (top 5 for US) and is extremely well-known, too. Anyone else have similiar experiences with companies they've worked at? Or perhaps exact opposite experiences?<|eost|><|sor|>> that all employees were free, and even encouraged, to write code and personal scripts in whatever language they like. This seems like a really good way to have an unmaintainable codebase.<|eor|><|sor|>Definitely wouldn't fly in a small shop (<10 developers). But anything in the alexa top 5 US is probably has thousands of engineers, so finding someone who can work in an arbitrary language probably isn't a problem. Although, even though it's company policy to allow any language, I'm sure your team/superiors will have something to say if you start developing in brainfuck or something.<|eor|><|eoss|><|endoftext|>
15
lolphp
cfreak2399
cfq9cl9
<|soss|><|sot|>A top tech company I recently interviewed for told me<|eot|><|sost|>that all employees were free, and even encouraged, to write code and personal scripts in whatever language they like. They had a totally open ecosystem and listed all the team members who were experts in X language. Java, Python, Scala, Ruby, C++, Haskell; the list went on. At the end of his cheerful praise for the company, though, the interviewer looked at me sternly and said: "however, there is one exception. Absolutely no PHP allowed." He went on to explain why PHP simply was not worth the trouble, from a security, development, and maintenance perspective. I smiled and nodded in great agreement. The next interviewer also extolled the open culture of the company, ending with "you're free to use any language you like, other than PHP!" Apparently it was an official company policy, and has been for years. It was a pleasant surprise. The company is in the Alexa top 15 (top 5 for US) and is extremely well-known, too. Anyone else have similiar experiences with companies they've worked at? Or perhaps exact opposite experiences?<|eost|><|sor|>We have a similar rule, except the banned language is Perl. I'd rather maintain PHP code any day, and we can't really get away from PHP anyways because it's the primary application language. When you started a website in the early-to-mid-aughts, PHP was realistically your best bet.<|eor|><|sor|>Sounds like a company to avoid. Perl is widely used in ETL type applications because its so good at text processing and string manipulation. It's not that hard to write good Perl code. Like any language you can abuse it, so you require the developers to follow a style guide. Problem solved as the language itself is reasonably consistent. PHP on the other hand is known for inconsistency, bad programming practice out of the box and security concerns. The "it sucks but everyone else uses it, so should we" mentality has kept a lot of awful software afloat so i guess PHP has that going for it. <|eor|><|eoss|><|endoftext|>
8
lolphp
jsanc623
cfq0khd
<|soss|><|sot|>A top tech company I recently interviewed for told me<|eot|><|sost|>that all employees were free, and even encouraged, to write code and personal scripts in whatever language they like. They had a totally open ecosystem and listed all the team members who were experts in X language. Java, Python, Scala, Ruby, C++, Haskell; the list went on. At the end of his cheerful praise for the company, though, the interviewer looked at me sternly and said: "however, there is one exception. Absolutely no PHP allowed." He went on to explain why PHP simply was not worth the trouble, from a security, development, and maintenance perspective. I smiled and nodded in great agreement. The next interviewer also extolled the open culture of the company, ending with "you're free to use any language you like, other than PHP!" Apparently it was an official company policy, and has been for years. It was a pleasant surprise. The company is in the Alexa top 15 (top 5 for US) and is extremely well-known, too. Anyone else have similiar experiences with companies they've worked at? Or perhaps exact opposite experiences?<|eost|><|sor|>So the top 5 US websites are: * google.com * facebook.com * youtube.com * yahoo.com * amazon.com We can cross out Facebook because they obviously use PHP. Youtube is long enough part of Google that we can assume this is one company. So we must choose between: * Google * Yahoo * Amazon Yahoo [seems to use PHP](https://tas-yahoo.taleo.net/careersection/yahoo_global_cs/jobsearch.ftl) and since you mention the fact that it is in top 15 Worldwide and top 5 US my bet is on **Amazon**. But good for them! I can understand the decision.<|eor|><|sor|>I'll go for Amazon too, but I don't think Google would be that happy if you began to add some PHP to their codebase.<|eor|><|sor|>http://www.quora.com/PHP-programming-language-1/Does-Google-use-PHP-for-any-of-their-products?share=1<|eor|><|eoss|><|endoftext|>
7
lolphp
Sarcastinator
cfrmx0s
<|soss|><|sot|>A top tech company I recently interviewed for told me<|eot|><|sost|>that all employees were free, and even encouraged, to write code and personal scripts in whatever language they like. They had a totally open ecosystem and listed all the team members who were experts in X language. Java, Python, Scala, Ruby, C++, Haskell; the list went on. At the end of his cheerful praise for the company, though, the interviewer looked at me sternly and said: "however, there is one exception. Absolutely no PHP allowed." He went on to explain why PHP simply was not worth the trouble, from a security, development, and maintenance perspective. I smiled and nodded in great agreement. The next interviewer also extolled the open culture of the company, ending with "you're free to use any language you like, other than PHP!" Apparently it was an official company policy, and has been for years. It was a pleasant surprise. The company is in the Alexa top 15 (top 5 for US) and is extremely well-known, too. Anyone else have similiar experiences with companies they've worked at? Or perhaps exact opposite experiences?<|eost|><|sor|>> that all employees were free, and even encouraged, to write code and personal scripts in whatever language they like. This seems like a really good way to have an unmaintainable codebase.<|eor|><|sor|>Definitely wouldn't fly in a small shop (<10 developers). But anything in the alexa top 5 US is probably has thousands of engineers, so finding someone who can work in an arbitrary language probably isn't a problem. Although, even though it's company policy to allow any language, I'm sure your team/superiors will have something to say if you start developing in brainfuck or something.<|eor|><|sor|>We had a project written in Ruby, and when the ruby guy went there were no one to replace him which meant any updates to the software would take ten times longer to complete which made the customer...less satisfied. Now there is implemented a "work using the tools we have invested in" policy with exceptions only for internal tools and research.<|eor|><|eoss|><|endoftext|>
6
lolphp
xiongchiamiov
cfqk513
<|soss|><|sot|>A top tech company I recently interviewed for told me<|eot|><|sost|>that all employees were free, and even encouraged, to write code and personal scripts in whatever language they like. They had a totally open ecosystem and listed all the team members who were experts in X language. Java, Python, Scala, Ruby, C++, Haskell; the list went on. At the end of his cheerful praise for the company, though, the interviewer looked at me sternly and said: "however, there is one exception. Absolutely no PHP allowed." He went on to explain why PHP simply was not worth the trouble, from a security, development, and maintenance perspective. I smiled and nodded in great agreement. The next interviewer also extolled the open culture of the company, ending with "you're free to use any language you like, other than PHP!" Apparently it was an official company policy, and has been for years. It was a pleasant surprise. The company is in the Alexa top 15 (top 5 for US) and is extremely well-known, too. Anyone else have similiar experiences with companies they've worked at? Or perhaps exact opposite experiences?<|eost|><|sor|>We have a similar rule, except the banned language is Perl. I'd rather maintain PHP code any day, and we can't really get away from PHP anyways because it's the primary application language. When you started a website in the early-to-mid-aughts, PHP was realistically your best bet.<|eor|><|sor|>Sounds like a company to avoid. Perl is widely used in ETL type applications because its so good at text processing and string manipulation. It's not that hard to write good Perl code. Like any language you can abuse it, so you require the developers to follow a style guide. Problem solved as the language itself is reasonably consistent. PHP on the other hand is known for inconsistency, bad programming practice out of the box and security concerns. The "it sucks but everyone else uses it, so should we" mentality has kept a lot of awful software afloat so i guess PHP has that going for it. <|eor|><|sor|>> Perl is widely used in ETL type applications because its so good at text processing and string manipulation. And Ruby is just as good (arguably better!) without as much crazy. > It's not that hard to write good Perl code. That debatable, but it's certainly very *easy* to write **bad** Perl. Perl got rather popular before getting the warts out (I would argue that's not happening until Perl 6, but let's be nice and say Perl 5 is fine (disregarding the insane object system, the array flattening, and the wide variety of implicit variables)), and as such, the Internet and bookstores are chock full of bad advice. It will take years of constant "read Modern Perl!" posts before this starts to change. This, of course, is not a problem unique to Perl. PHP is the other notable example, but as I said, when you have hundreds of thousands of lines of PHP, you can't exactly stop using it. If I was working on a fresh project, I'd argue against ever using PHP as well.<|eor|><|eoss|><|endoftext|>
6
lolphp
n1c0_ds
cfq0mtd
<|soss|><|sot|>A top tech company I recently interviewed for told me<|eot|><|sost|>that all employees were free, and even encouraged, to write code and personal scripts in whatever language they like. They had a totally open ecosystem and listed all the team members who were experts in X language. Java, Python, Scala, Ruby, C++, Haskell; the list went on. At the end of his cheerful praise for the company, though, the interviewer looked at me sternly and said: "however, there is one exception. Absolutely no PHP allowed." He went on to explain why PHP simply was not worth the trouble, from a security, development, and maintenance perspective. I smiled and nodded in great agreement. The next interviewer also extolled the open culture of the company, ending with "you're free to use any language you like, other than PHP!" Apparently it was an official company policy, and has been for years. It was a pleasant surprise. The company is in the Alexa top 15 (top 5 for US) and is extremely well-known, too. Anyone else have similiar experiences with companies they've worked at? Or perhaps exact opposite experiences?<|eost|><|sor|>Depends on what you are building. Here, we use PHP because it's stupid easy to find interns to maintain the project, and because IT won't give use real server space. On the other hand, the application was built by 9 consecutive Mech E. interns. It was a total mess.<|eor|><|eoss|><|endoftext|>
5
lolphp
allthediamonds
1vyy50
<|sols|><|sot|>Fill in the blanks!<|eot|><|sol|>http://i.imgur.com/Wtg4OQZ.png<|eol|><|eols|><|endoftext|>
51
lolphp
EmptyTon
cex4dg7
<|sols|><|sot|>Fill in the blanks!<|eot|><|sol|>http://i.imgur.com/Wtg4OQZ.png<|eol|><|sor|> $x = 1; $y = 1.1; or some combination like that, because [float keys are converted to ints](http://us1.php.net/manual/en/language.types.array.php). Whee, php<|eor|><|eols|><|endoftext|>
23