subreddit
stringclasses
7 values
author
stringlengths
3
20
id
stringlengths
5
7
content
stringlengths
67
30.4k
score
int64
0
140k
lolphp
the_alias_of_andrea
cxmi8h5
<|sols|><|sot|>PHP 7 has just been released. So what's fixed and what's still hopelessly broken?<|eot|><|sol|>https://github.com/php/php-src/releases/tag/php-7.0.0<|eol|><|sor|>Per /u/antpocus over on /r/programming: > Ooh, only 137 compiler warnings and > 102 failed tests! That's a huge > improvement from 5.6's 638 > warnings and 114 failed tests! His post had links to the actual failing tests, not sure how to linkify above. If he posts here I'll delete mine. <|eor|><|sor|>Those numbers are from an old and neglected buildbot which isn't properly updated. The tests are actually green. Try them. https://www.reddit.com/r/programming/comments/3v4l98/php_7_released/<|eor|><|eols|><|endoftext|>
10
lolphp
coredumperror
cxkqbqg
<|sols|><|sot|>PHP 7 has just been released. So what's fixed and what's still hopelessly broken?<|eot|><|sol|>https://github.com/php/php-src/releases/tag/php-7.0.0<|eol|><|sor|>> what's still hopelessly broken? PHP still not a deprecated language?<|eor|><|sor|>PHP 7 is far far far less shittier than PHP 5.2/3 was.<|eor|><|sor|>How so? Honest question.<|eor|><|eols|><|endoftext|>
9
lolphp
suspiciously_calm
cxkvjee
<|sols|><|sot|>PHP 7 has just been released. So what's fixed and what's still hopelessly broken?<|eot|><|sol|>https://github.com/php/php-src/releases/tag/php-7.0.0<|eol|><|sor|>> what's still hopelessly broken? PHP still not a deprecated language?<|eor|><|sor|>PHP 7 is far far far less shittier than PHP 5.2/3 was.<|eor|><|sor|>How so? Honest question.<|eor|><|sor|>Just a few off the top of my head: - The interpreter has been rewritten to use an AST/lexer layer, which in turn fixed a large amount of syntax issues. http://php.net/manual/en/migration70.incompatible.php - Errors are slowly being phased out and replaced with exceptions. This allows fatals and other errors to be caught now. - All these new features: http://php.net/manual/en/migration70.new-features.php But yeah, PHP7 is basically a version that is making great strides to fix what was broken with PHP.<|eor|><|sor|>Well, good. There was a time when they wouldn't acknowledge the problems.<|eor|><|eols|><|endoftext|>
9
lolphp
gearvOsh
cxlej5c
<|sols|><|sot|>PHP 7 has just been released. So what's fixed and what's still hopelessly broken?<|eot|><|sol|>https://github.com/php/php-src/releases/tag/php-7.0.0<|eol|><|sor|>> what's still hopelessly broken? PHP still not a deprecated language?<|eor|><|sor|>PHP 7 is far far far less shittier than PHP 5.2/3 was.<|eor|><|sor|>How so? Honest question.<|eor|><|sor|>Just a few off the top of my head: - The interpreter has been rewritten to use an AST/lexer layer, which in turn fixed a large amount of syntax issues. http://php.net/manual/en/migration70.incompatible.php - Errors are slowly being phased out and replaced with exceptions. This allows fatals and other errors to be caught now. - All these new features: http://php.net/manual/en/migration70.new-features.php But yeah, PHP7 is basically a version that is making great strides to fix what was broken with PHP.<|eor|><|sor|>> The interpreter has been rewritten to use an AST/lexer layer Oh dear Lord. Welcome to like 1950.<|eor|><|sor|>Right? Took long enough. At least they got it done.<|eor|><|eols|><|endoftext|>
8
lolphp
Creshal
cxmtb0h
<|sols|><|sot|>PHP 7 has just been released. So what's fixed and what's still hopelessly broken?<|eot|><|sol|>https://github.com/php/php-src/releases/tag/php-7.0.0<|eol|><|sor|>Off the top of my head, unicode? Let's just wait until they release PHP 6<|eor|><|sor|>There's a project to add a Unicode string class based on ICU's, to make handling Unicode a little easier. That might end up in one of the 7.x releases.<|eor|><|sor|>Unicode only in a separate, clumsy to use string class? I'm sure nothing at all will go wrong with that approach. <|eor|><|eols|><|endoftext|>
7
lolphp
jonnywoh
cxksal0
<|sols|><|sot|>PHP 7 has just been released. So what's fixed and what's still hopelessly broken?<|eot|><|sol|>https://github.com/php/php-src/releases/tag/php-7.0.0<|eol|><|sor|>Per /u/antpocus over on /r/programming: > Ooh, only 137 compiler warnings and > 102 failed tests! That's a huge > improvement from 5.6's 638 > warnings and 114 failed tests! His post had links to the actual failing tests, not sure how to linkify above. If he posts here I'll delete mine. <|eor|><|sor|>> Ooh, only [137 compiler warnings](http://gcov.php.net/viewer.php?version=PHP_7_0&amp;func=compile_results) and [102 failed tests](http://gcov.php.net/viewer.php?version=PHP_7_0&amp;func=tests)! That's a huge improvement from 5.6's [638 warnings](http://gcov.php.net/viewer.php?version=PHP_5_6&amp;func=compile_results) and [114 failed tests](http://gcov.php.net/viewer.php?version=PHP_5_6&amp;func=tests)! I just clicked "source" under [the comment](https://www.reddit.com/r/programming/comments/3v4l98/php_7_released/cxkazco), might be a RES feature.<|eor|><|sor|>It is a RES feature<|eor|><|eols|><|endoftext|>
7
lolphp
cfreak2399
cxl7ru6
<|sols|><|sot|>PHP 7 has just been released. So what's fixed and what's still hopelessly broken?<|eot|><|sol|>https://github.com/php/php-src/releases/tag/php-7.0.0<|eol|><|sor|>Looking at the list of changes I'm actually somewhat impressed at a few of the things they are cleaning up. However the foreach behavior change is going to cause a lot of broken things. I see from the new features stuff they've started sneaking some Python ideas in.<|eor|><|eols|><|endoftext|>
6
lolphp
allthediamonds
1vurcd
<|sols|><|sot|>Today's PHP quirk: array_fill meets negative numbers<|eot|><|sol|>https://eval.in/93379<|eol|><|eols|><|endoftext|>
49
lolphp
frezik
cew6e1w
<|sols|><|sot|>Today's PHP quirk: array_fill meets negative numbers<|eot|><|sol|>https://eval.in/93379<|eol|><|soopr|>It's [documented](http://us1.php.net/manual/en/function.array-fill.php), but it doesn't make any sense.<|eoopr|><|sor|>In these situations, I reply with: > This was done badly, but we documented it, so it's OK. Incidentally, I usually have to bring this up to either PHP or MySQL apologists.<|eor|><|eols|><|endoftext|>
19
lolphp
allthediamonds
cevyf0z
<|sols|><|sot|>Today's PHP quirk: array_fill meets negative numbers<|eot|><|sol|>https://eval.in/93379<|eol|><|soopr|>It's [documented](http://us1.php.net/manual/en/function.array-fill.php), but it doesn't make any sense.<|eoopr|><|eols|><|endoftext|>
17
lolphp
ajmarks
cew8csh
<|sols|><|sot|>Today's PHP quirk: array_fill meets negative numbers<|eot|><|sol|>https://eval.in/93379<|eol|><|soopr|>It's [documented](http://us1.php.net/manual/en/function.array-fill.php), but it doesn't make any sense.<|eoopr|><|sor|>It kind of does in a PHP sort of way. -10 is a hash-table key, and hash-table keys don't have logical successors because it's being treated as a generic scalar type (the fact that that one happens to be an int is irrelevant, consider -10.5: should the next key be -9.5? -10.4? -11.5?), so it then goes to the next free array key, which is 0. So it has a sort of internal logic, but it's just the sort of nonsense you get when you combine an dictionary and an array into one type.<|eor|><|eols|><|endoftext|>
16
lolphp
jmcs
cevz5h6
<|sols|><|sot|>Today's PHP quirk: array_fill meets negative numbers<|eot|><|sol|>https://eval.in/93379<|eol|><|sor|>I promise I wont bash PHP for 24 hours if someone explains the reason for this one.<|eor|><|eols|><|endoftext|>
11
lolphp
RenaKunisaki
cewk2lg
<|sols|><|sot|>Today's PHP quirk: array_fill meets negative numbers<|eot|><|sol|>https://eval.in/93379<|eol|><|soopr|>It's [documented](http://us1.php.net/manual/en/function.array-fill.php), but it doesn't make any sense.<|eoopr|><|sor|>In these situations, I reply with: > This was done badly, but we documented it, so it's OK. Incidentally, I usually have to bring this up to either PHP or MySQL apologists.<|eor|><|sor|>One of my favourite phrases: "it's not a bug, it does exactly what the documentation/spec says." As if specs can't have bugs.<|eor|><|eols|><|endoftext|>
9
lolphp
midir
cew00nk
<|sols|><|sot|>Today's PHP quirk: array_fill meets negative numbers<|eot|><|sol|>https://eval.in/93379<|eol|><|sor|>I promise I wont bash PHP for 24 hours if someone explains the reason for this one.<|eor|><|soopr|>I *really* want to know. I mean, I would assume that a function like this one loops from the starting number to the starting number plus the number of elements, but apparently it does something else. As a fun footnote, [providing array_fill with invalid parameters may return NULL or false](https://eval.in/93412).<|eoopr|><|sor|>I imagine it assigns the first element directly, then uses `[]=` to use the automatic array key for the rest. Something like: $arr[-10] = 'hi'; for ($i = 1; $i < 3; $i++) $arr[] = 'hi'; print_r($arr); Output: Array ( [-10] => hi [0] => hi [1] => hi )<|eor|><|eols|><|endoftext|>
9
lolphp
geaal
1gylpk
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|eols|><|endoftext|>
45
lolphp
bart2019
cap3lzw
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|> <? A = { -\ value +/ mul = (x, y) -> { ret x * y } -/ __construct = (val) -> { this.value = val } -/ show = () -> { print this.value } } ?> "readable" o.O<|eor|><|eols|><|endoftext|>
62
lolphp
InconsiderateBastard
cap5a0l
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|>Satire?<|eor|><|eols|><|endoftext|>
23
lolphp
ThisIsADogHello
cap4tfu
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|> <? A = { -\ value +/ mul = (x, y) -> { ret x * y } -/ __construct = (val) -> { this.value = val } -/ show = () -> { print this.value } } ?> "readable" o.O<|eor|><|sor|>[deleted]<|eor|><|sor|>... What? Surely this is a parody that invokes Poe's Law? Nobody actually capable of building something like this would do that sort of thing, right?<|eor|><|eols|><|endoftext|>
23
lolphp
m0llusk
cap6pyj
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|>This will piss off the Perl people even more. Perl's built-in documentation format is called "POD"<|eor|><|sor|>As a Perl groupie I found myself amused by this. Perl programmers have better senses of humor than you might think. We have to.<|eor|><|eols|><|endoftext|>
17
lolphp
treenaks
cap43ef
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|>This will piss off the Perl people even more. Perl's built-in documentation format is called "POD"<|eor|><|eols|><|endoftext|>
15
lolphp
phoshi
cap5vyn
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|>> POD, the PHP preprocessor PHP Hypertext Preprocessor preprocessor Listen, if you can't figure one programming language out the last thing you should be doing is designing another.<|eor|><|sor|>excuse me, but POD is a preprocessor that generates PHP code, and PHP is a preprocessor that generates *Hypertext*, whatever that means.<|eor|><|sor|>Hypertext is the stuff that's displayed by your web browser. It's what HTML is rendered into. So this is a system that allows you to write POD code to generate PHP to generate HTML to generate Hypertext.<|eor|><|eols|><|endoftext|>
15
lolphp
Kwpolska
cap4w43
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|>> POD, the PHP preprocessor PHP Hypertext Preprocessor preprocessor Listen, if you can't figure one programming language out the last thing you should be doing is designing another.<|eor|><|sor|>excuse me, but POD is a preprocessor that generates PHP code, and PHP is a preprocessor that generates *Hypertext*, whatever that means.<|eor|><|eols|><|endoftext|>
11
lolphp
JW_BlueLabel
capg78z
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|>PHP is such a cluster fucker that I would love to have a sane language built to use in place of PHP. This however, is not it.<|eor|><|sor|>Check out Haxe, it's compiles to php too, but has a way more readable syntax <|eor|><|sor|>Whats not readable about PHP? Seems pretty standard to me.<|eor|><|sor|>It's not unreadable, it's just inconsistent and annoying.<|eor|><|eols|><|endoftext|>
11
lolphp
JW_BlueLabel
cap4r9u
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|>PHP is such a cluster fucker that I would love to have a sane language built to use in place of PHP. This however, is not it.<|eor|><|eols|><|endoftext|>
10
lolphp
vytah
capbcyp
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|> <? A = { -\ value +/ mul = (x, y) -> { ret x * y } -/ __construct = (val) -> { this.value = val } -/ show = () -> { print this.value } } ?> "readable" o.O<|eor|><|sor|>[deleted]<|eor|><|sor|>To further complicate the matter, UML class diagrams use these symbols in a [totally different way](https://en.wikipedia.org/wiki/Class_diagram#Visibility): + Public - Private # Protected / Derived (can be combined with one of the others) _ Static<|eor|><|eols|><|endoftext|>
10
lolphp
merreborn
capfhpo
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|> <? A = { -\ value +/ mul = (x, y) -> { ret x * y } -/ __construct = (val) -> { this.value = val } -/ show = () -> { print this.value } } ?> "readable" o.O<|eor|><|sor|>[deleted]<|eor|><|sor|>... What? Surely this is a parody that invokes Poe's Law? Nobody actually capable of building something like this would do that sort of thing, right?<|eor|><|sor|>Shit, you called it. Poe's law indeed. http://www.reddit.com/r/lolphp/comments/1gylpk/pod_an_new_language_compiling_to_php/capfb64?context=2<|eor|><|eols|><|endoftext|>
10
lolphp
Packet_Ranger
capnwdc
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|> <? A = { -\ value +/ mul = (x, y) -> { ret x * y } -/ __construct = (val) -> { this.value = val } -/ show = () -> { print this.value } } ?> "readable" o.O<|eor|><|sor|>[deleted]<|eor|><|soopr|>Sure, that is readable. Look at https://en.wikipedia.org/wiki/APL_%28programming_language%29 for something unreadable :)<|eoopr|><|sor|>My understanding is that APL makes (near-) perfect sense to a mathematician. For **real** unreadability look no further than [malbolge](https://en.wikipedia.org/wiki/Malbolge). <|eor|><|sor|>[Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) is another good example. ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.<|eor|><|sor|>*unlike* malbolge, if you understand Turing machines, then bf is quite readable. Now obfuscated bf varients like [Piet](http://www.dangermouse.net/esoteric/piet.html) are another story. <|eor|><|eols|><|endoftext|>
10
lolphp
geaal
capel7o
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|>Was this not published on some April 1st?<|eor|><|sor|>I'm afraid not, here is the [first commit](https://github.com/Geal/pod/commit/76726b523c71bb12301bfc07ea977fd04acd79a2), created 17 days ago. Must be a very dated april fools joke.<|eor|><|soopr|>It is based on PHPZ, which was released on April 1st: https://github.com/divarvel/PHPZ/commit/1cc2771c8b24547db5c47d2300c7f3b360b243bd<|eoopr|><|eols|><|endoftext|>
9
lolphp
geaal
cap57wp
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|> <? A = { -\ value +/ mul = (x, y) -> { ret x * y } -/ __construct = (val) -> { this.value = val } -/ show = () -> { print this.value } } ?> "readable" o.O<|eor|><|sor|>[deleted]<|eor|><|soopr|>Sure, that is readable. Look at https://en.wikipedia.org/wiki/APL_%28programming_language%29 for something unreadable :)<|eoopr|><|eols|><|endoftext|>
8
lolphp
vytah
caquaii
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|> <? A = { -\ value +/ mul = (x, y) -> { ret x * y } -/ __construct = (val) -> { this.value = val } -/ show = () -> { print this.value } } ?> "readable" o.O<|eor|><|sor|>[deleted]<|eor|><|sor|>... What? Surely this is a parody that invokes Poe's Law? Nobody actually capable of building something like this would do that sort of thing, right?<|eor|><|sor|>Shit, you called it. Poe's law indeed. http://www.reddit.com/r/lolphp/comments/1gylpk/pod_an_new_language_compiling_to_php/capfb64?context=2<|eor|><|sor|>> Poe php > $a = 'POD'; php > $a++; php > echo $a; POE <|eor|><|eols|><|endoftext|>
8
lolphp
geaal
capfb64
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|>Was this not published on some April 1st?<|eor|><|sor|>I'm afraid not, here is the [first commit](https://github.com/Geal/pod/commit/76726b523c71bb12301bfc07ea977fd04acd79a2), created 17 days ago. Must be a very dated april fools joke.<|eor|><|soopr|>It is based on PHPZ, which was released on April 1st: https://github.com/divarvel/PHPZ/commit/1cc2771c8b24547db5c47d2300c7f3b360b243bd<|eoopr|><|sor|>Then it's a very elaborate april fools joke. I just noticed that you're apparently the guy who wrote POD. Congratulations on fooling me. ;-)<|eor|><|soopr|>Yeah, the trolls are getting a bit complex. But I had a lot of fun writing that :)<|eoopr|><|eols|><|endoftext|>
8
lolphp
Pixa
capatvt
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|>> POD, the PHP preprocessor PHP Hypertext Preprocessor preprocessor Listen, if you can't figure one programming language out the last thing you should be doing is designing another.<|eor|><|sor|>excuse me, but POD is a preprocessor that generates PHP code, and PHP is a preprocessor that generates *Hypertext*, whatever that means.<|eor|><|sor|>Clearly, the best way to fix with mess is with additional layers of abstraction and indirection.<|eor|><|eols|><|endoftext|>
7
lolphp
gearvOsh
capclfw
<|sols|><|sot|>POD, an new language compiling to PHP<|eot|><|sol|>http://geal.github.io/pod/<|eol|><|sor|>PHP is such a cluster fucker that I would love to have a sane language built to use in place of PHP. This however, is not it.<|eor|><|sor|>Check out Haxe, it's compiles to php too, but has a way more readable syntax <|eor|><|sor|>Whats not readable about PHP? Seems pretty standard to me.<|eor|><|eols|><|endoftext|>
7
lolphp
vytah
11yq8y
<|sols|><|sot|>For scripts declared as UTF-8, PHP happily adds one NUL byte to your output for each non-ASCII character in the source<|eot|><|sol|>https://bugs.php.net/bug.php?id=63316<|eol|><|eols|><|endoftext|>
49
lolphp
cwmonkey
c6qqzb1
<|sols|><|sot|>For scripts declared as UTF-8, PHP happily adds one NUL byte to your output for each non-ASCII character in the source<|eot|><|sol|>https://bugs.php.net/bug.php?id=63316<|eol|><|sor|>I don't even want to think about how something could break in this way.<|eor|><|sor|>I don't even want to think about how the devs are going to frame this as not a bug but user error.<|eor|><|eols|><|endoftext|>
21
lolphp
vytah
c6qqpco
<|sols|><|sot|>For scripts declared as UTF-8, PHP happily adds one NUL byte to your output for each non-ASCII character in the source<|eot|><|sol|>https://bugs.php.net/bug.php?id=63316<|eol|><|sor|>How is this even possible? UTF-8 is designed to work even with programs that excpect 8-bit ASCII. How the hell could they mess this up this bad?<|eor|><|soopr|>The funniest part is how did they manage to mess it up when the non-ASCII characters are in the *comments*?<|eoopr|><|eols|><|endoftext|>
17
lolphp
Tjoppen
c6qqi0q
<|sols|><|sot|>For scripts declared as UTF-8, PHP happily adds one NUL byte to your output for each non-ASCII character in the source<|eot|><|sol|>https://bugs.php.net/bug.php?id=63316<|eol|><|sor|>How is this even possible? UTF-8 is designed to work even with programs that excpect 8-bit ASCII. How the hell could they mess this up this bad?<|eor|><|eols|><|endoftext|>
14
lolphp
Tjoppen
c6qy6uc
<|sols|><|sot|>For scripts declared as UTF-8, PHP happily adds one NUL byte to your output for each non-ASCII character in the source<|eot|><|sol|>https://bugs.php.net/bug.php?id=63316<|eol|><|sor|>How is this even possible? UTF-8 is designed to work even with programs that excpect 8-bit ASCII. How the hell could they mess this up this bad?<|eor|><|soopr|>The funniest part is how did they manage to mess it up when the non-ASCII characters are in the *comments*?<|eoopr|><|sor|>Yes, that's what I was thinking too. Surely there must be a step that causes everything between "//" and CR/LF to be ignored? On the other hand, that may be asking too much of PHP's parser. Let's hope this ticket gets updated soon with a patch. I'm curious what the problem actually is.<|eor|><|sor|>A blind `s/\/\/.*$//` wouldn't work properly as it would start removing in the middle of strings. My guess is they are doing some kind of *preprocessing* on the source and fucked up the UTF-8 handling.<|eor|><|sor|>Ah yes, I should have been a bit more precise: a context-free grammar that works fine with 8-bit ASCII (where no reserved symbol has the high bit set) should work just as well with UTF-8. That would imply PHP's parser is implemented in a sane way though..<|eor|><|eols|><|endoftext|>
8
lolphp
imMute
c6r0neo
<|sols|><|sot|>For scripts declared as UTF-8, PHP happily adds one NUL byte to your output for each non-ASCII character in the source<|eot|><|sol|>https://bugs.php.net/bug.php?id=63316<|eol|><|sor|>How is this even possible? UTF-8 is designed to work even with programs that excpect 8-bit ASCII. How the hell could they mess this up this bad?<|eor|><|soopr|>The funniest part is how did they manage to mess it up when the non-ASCII characters are in the *comments*?<|eoopr|><|sor|>Yes, that's what I was thinking too. Surely there must be a step that causes everything between "//" and CR/LF to be ignored? On the other hand, that may be asking too much of PHP's parser. Let's hope this ticket gets updated soon with a patch. I'm curious what the problem actually is.<|eor|><|sor|>A blind `s/\/\/.*$//` wouldn't work properly as it would start removing in the middle of strings. My guess is they are doing some kind of *preprocessing* on the source and fucked up the UTF-8 handling.<|eor|><|sor|>Ah yes, I should have been a bit more precise: a context-free grammar that works fine with 8-bit ASCII (where no reserved symbol has the high bit set) should work just as well with UTF-8. That would imply PHP's parser is implemented in a sane way though..<|eor|><|sor|>>That would imply PHP's parser is implemented in a sane way though. And that's the fatal assumption :)<|eor|><|eols|><|endoftext|>
8
lolphp
audaxxx
c6r1l5h
<|sols|><|sot|>For scripts declared as UTF-8, PHP happily adds one NUL byte to your output for each non-ASCII character in the source<|eot|><|sol|>https://bugs.php.net/bug.php?id=63316<|eol|><|sor|>How is this even possible? UTF-8 is designed to work even with programs that excpect 8-bit ASCII. How the hell could they mess this up this bad?<|eor|><|soopr|>The funniest part is how did they manage to mess it up when the non-ASCII characters are in the *comments*?<|eoopr|><|sor|>Yes, that's what I was thinking too. Surely there must be a step that causes everything between "//" and CR/LF to be ignored? On the other hand, that may be asking too much of PHP's parser. Let's hope this ticket gets updated soon with a patch. I'm curious what the problem actually is.<|eor|><|sor|>A blind `s/\/\/.*$//` wouldn't work properly as it would start removing in the middle of strings. My guess is they are doing some kind of *preprocessing* on the source and fucked up the UTF-8 handling.<|eor|><|sor|>Ah yes, I should have been a bit more precise: a context-free grammar that works fine with 8-bit ASCII (where no reserved symbol has the high bit set) should work just as well with UTF-8. That would imply PHP's parser is implemented in a sane way though..<|eor|><|sor|>PHPs grammar is not context free at all. It is...uhm...ad hoc?<|eor|><|eols|><|endoftext|>
8
lolphp
Takeoded
nxswcx
<|sols|><|sot|>source code license broken in 5 ways<|eot|><|sol|>https://www.mail-archive.com/internals@lists.php.net/msg107015.html<|eol|><|eols|><|endoftext|>
44
lolphp
CarnivorousSociety
h1hu319
<|sols|><|sot|>source code license broken in 5 ways<|eot|><|sol|>https://www.mail-archive.com/internals@lists.php.net/msg107015.html<|eol|><|sor|>oh look somebody forgot to update the copyright, quick redistribute php as a new language that everybody will want to use ... said nobody ever<|eor|><|eols|><|endoftext|>
12
lolphp
SirClueless
h1j33wj
<|sols|><|sot|>source code license broken in 5 ways<|eot|><|sol|>https://www.mail-archive.com/internals@lists.php.net/msg107015.html<|eol|><|sor|>As silly as it may look, I don't think anything about the license is incorrect. There is copyrighted material in the `Zend` source directory from 1999-2006. Presumably other material in that directory is not covered under the Zend copyright license, but instead by the PHP copyright license which is in the root directory of the PHP source code and is periodically updated with new dates as new contributions are made. Updating the dates in the Zend license would be incorrect because nobody is writing new code in the PHP project under the Zend license. And, while it's especially silly that PHP is obligated to include patently false statements in its software, those are the terms under which Zend is licensed. 5. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes the Zend Engine, freely available at http://www.zend.com" 6. All advertising materials mentioning features or use of this software must display the following acknowledgment: "The Zend Engine is freely available at http://www.zend.com" These statements may be plainly false, but under the terms of the license, PHP is obligated to include them even if they stop being true. The license includes a statement that Zend is the only party able to provide new versions of the license: 4. [...] No one other than Zend Technologies Ltd. has the right to modify the terms applicable to covered code created under this License. So if Zend wanted to go through the hassle and legal risk of updating the license, and PHP then decided to use the new license instead of the old one (both unlikely to ever happen IMO) then in theory you could change this, but until then PHP's rights to use the Zend software are tied to this license. If you're unhappy that Zend hasn't kept making the Zend engine and license freely available on the web where they said they would you're welcome to go complain to them but I don't see why they would have any incentive to care.<|eor|><|eols|><|endoftext|>
8
lolphp
Altreus
h1hvyd5
<|sols|><|sot|>source code license broken in 5 ways<|eot|><|sol|>https://www.mail-archive.com/internals@lists.php.net/msg107015.html<|eol|><|sor|>oh look somebody forgot to update the copyright, quick redistribute php as a new language that everybody will want to use ... said nobody ever<|eor|><|sor|>Some time ago I was told never to put the second date. The first year is sufficient and the current year is implied. Sadly I have no source to back this up, but I'm sure an interested party could confirm or deny it.<|eor|><|eols|><|endoftext|>
7
lolphp
barubary
iu5wsr
<|soss|><|sot|>What's a microseconds? How do numbers?<|eot|><|sost|>[`DateTime::createFromFormat`](https://www.php.net/manual/en/datetime.createfromformat.php) can parse a string into a DateTime object according to a format specification. The inverse operation is available in [`DateTime::format`](https://www.php.net/manual/en/datetime.format.php). One of the available format letters is `u`, which is documented as > format character | Description | Example parsable values > -----------------|-------------|-------------------------- > `u` | Microseconds (up to six digits) | Example: `45`, `654321` for `createFromFormat()` and > format character | Description | Example returned values > -----------------|-------------|-------------------------- > `u` | Microseconds (added in PHP 5.2.2). Note that `date()` will always generate `000000` since it takes an integer parameter, whereas `DateTime::format()` does support microseconds if `DateTime` was created with microseconds. | Example: `654321` for `format()`, respectively. Now you might naively expect that when the documentation says "microseconds", it means microseconds, and that when one of the example values is `45`, it means 45 microseconds. This is not the case. Demonstration: $d = DateTime::createFromFormat('u', '45'); // 45 microseconds, right? echo $d->format('u'), "\n"; // should be "45", right? [Output:](https://tio.run/##K8go@P/fxr4go4CLSyVFwVbBJbEkNSQzN9XKKrkoFch2K8rPdcsvyk0s0VAvVddRUDcxVde05kpNzshXUEnRtUuDy2nqKCjF5ClZ//8PAA) > 450000 Turns out that `45` actually means 45 centiseconds when parsed with `u`, but properly outputs microseconds in `format()`. (And `DateTime::createFromFormat('u', '5')` is 5 deciseconds, of course.)<|eost|><|eoss|><|endoftext|>
46
lolphp
funtek
g5itci8
<|soss|><|sot|>What's a microseconds? How do numbers?<|eot|><|sost|>[`DateTime::createFromFormat`](https://www.php.net/manual/en/datetime.createfromformat.php) can parse a string into a DateTime object according to a format specification. The inverse operation is available in [`DateTime::format`](https://www.php.net/manual/en/datetime.format.php). One of the available format letters is `u`, which is documented as > format character | Description | Example parsable values > -----------------|-------------|-------------------------- > `u` | Microseconds (up to six digits) | Example: `45`, `654321` for `createFromFormat()` and > format character | Description | Example returned values > -----------------|-------------|-------------------------- > `u` | Microseconds (added in PHP 5.2.2). Note that `date()` will always generate `000000` since it takes an integer parameter, whereas `DateTime::format()` does support microseconds if `DateTime` was created with microseconds. | Example: `654321` for `format()`, respectively. Now you might naively expect that when the documentation says "microseconds", it means microseconds, and that when one of the example values is `45`, it means 45 microseconds. This is not the case. Demonstration: $d = DateTime::createFromFormat('u', '45'); // 45 microseconds, right? echo $d->format('u'), "\n"; // should be "45", right? [Output:](https://tio.run/##K8go@P/fxr4go4CLSyVFwVbBJbEkNSQzN9XKKrkoFch2K8rPdcsvyk0s0VAvVddRUDcxVde05kpNzshXUEnRtUuDy2nqKCjF5ClZ//8PAA) > 450000 Turns out that `45` actually means 45 centiseconds when parsed with `u`, but properly outputs microseconds in `format()`. (And `DateTime::createFromFormat('u', '5')` is 5 deciseconds, of course.)<|eost|><|sor|>Shitty documentation, as expected for php... Some testing confirms that passing 45, 450, 4500 gives the same output. So i'm guessing there's an imaginary decimal point before that. 0.45s = 0.450s = 0.4500s = 450000us. It's probably meant to be used as for example "H:m:s.u" or "U.u"<|eor|><|eoss|><|endoftext|>
25
lolphp
Altreus
g5iwl76
<|soss|><|sot|>What's a microseconds? How do numbers?<|eot|><|sost|>[`DateTime::createFromFormat`](https://www.php.net/manual/en/datetime.createfromformat.php) can parse a string into a DateTime object according to a format specification. The inverse operation is available in [`DateTime::format`](https://www.php.net/manual/en/datetime.format.php). One of the available format letters is `u`, which is documented as > format character | Description | Example parsable values > -----------------|-------------|-------------------------- > `u` | Microseconds (up to six digits) | Example: `45`, `654321` for `createFromFormat()` and > format character | Description | Example returned values > -----------------|-------------|-------------------------- > `u` | Microseconds (added in PHP 5.2.2). Note that `date()` will always generate `000000` since it takes an integer parameter, whereas `DateTime::format()` does support microseconds if `DateTime` was created with microseconds. | Example: `654321` for `format()`, respectively. Now you might naively expect that when the documentation says "microseconds", it means microseconds, and that when one of the example values is `45`, it means 45 microseconds. This is not the case. Demonstration: $d = DateTime::createFromFormat('u', '45'); // 45 microseconds, right? echo $d->format('u'), "\n"; // should be "45", right? [Output:](https://tio.run/##K8go@P/fxr4go4CLSyVFwVbBJbEkNSQzN9XKKrkoFch2K8rPdcsvyk0s0VAvVddRUDcxVde05kpNzshXUEnRtUuDy2nqKCjF5ClZ//8PAA) > 450000 Turns out that `45` actually means 45 centiseconds when parsed with `u`, but properly outputs microseconds in `format()`. (And `DateTime::createFromFormat('u', '5')` is 5 deciseconds, of course.)<|eost|><|sor|>It's this way because microseconds and milliseconds are to be supplied as the decimals of a number.<|eor|><|sor|>Only a PHP apologist would defend 45 being anything other than 45<|eor|><|eoss|><|endoftext|>
24
lolphp
barubary
g5l6rnj
<|soss|><|sot|>What's a microseconds? How do numbers?<|eot|><|sost|>[`DateTime::createFromFormat`](https://www.php.net/manual/en/datetime.createfromformat.php) can parse a string into a DateTime object according to a format specification. The inverse operation is available in [`DateTime::format`](https://www.php.net/manual/en/datetime.format.php). One of the available format letters is `u`, which is documented as > format character | Description | Example parsable values > -----------------|-------------|-------------------------- > `u` | Microseconds (up to six digits) | Example: `45`, `654321` for `createFromFormat()` and > format character | Description | Example returned values > -----------------|-------------|-------------------------- > `u` | Microseconds (added in PHP 5.2.2). Note that `date()` will always generate `000000` since it takes an integer parameter, whereas `DateTime::format()` does support microseconds if `DateTime` was created with microseconds. | Example: `654321` for `format()`, respectively. Now you might naively expect that when the documentation says "microseconds", it means microseconds, and that when one of the example values is `45`, it means 45 microseconds. This is not the case. Demonstration: $d = DateTime::createFromFormat('u', '45'); // 45 microseconds, right? echo $d->format('u'), "\n"; // should be "45", right? [Output:](https://tio.run/##K8go@P/fxr4go4CLSyVFwVbBJbEkNSQzN9XKKrkoFch2K8rPdcsvyk0s0VAvVddRUDcxVde05kpNzshXUEnRtUuDy2nqKCjF5ClZ//8PAA) > 450000 Turns out that `45` actually means 45 centiseconds when parsed with `u`, but properly outputs microseconds in `format()`. (And `DateTime::createFromFormat('u', '5')` is 5 deciseconds, of course.)<|eost|><|sor|>It's this way because microseconds and milliseconds are to be supplied as the decimals of a number.<|eor|><|sor|>Only a PHP apologist would defend 45 being anything other than 45<|eor|><|sor|>No it's not, it's the fact that the `u` format specifier expects it to be as decimals. If it weren't it would completely break parsing of dates. This actually aligns with the base unit of the unix timestamp being in seconds. You don't want `U.u` to read 1.45 as one second and 45 microseconds.<|eor|><|soopr|>I don't want that, but that's exactly what the documentation says.<|eoopr|><|eoss|><|endoftext|>
8
lolphp
mort96
g5kux5s
<|soss|><|sot|>What's a microseconds? How do numbers?<|eot|><|sost|>[`DateTime::createFromFormat`](https://www.php.net/manual/en/datetime.createfromformat.php) can parse a string into a DateTime object according to a format specification. The inverse operation is available in [`DateTime::format`](https://www.php.net/manual/en/datetime.format.php). One of the available format letters is `u`, which is documented as > format character | Description | Example parsable values > -----------------|-------------|-------------------------- > `u` | Microseconds (up to six digits) | Example: `45`, `654321` for `createFromFormat()` and > format character | Description | Example returned values > -----------------|-------------|-------------------------- > `u` | Microseconds (added in PHP 5.2.2). Note that `date()` will always generate `000000` since it takes an integer parameter, whereas `DateTime::format()` does support microseconds if `DateTime` was created with microseconds. | Example: `654321` for `format()`, respectively. Now you might naively expect that when the documentation says "microseconds", it means microseconds, and that when one of the example values is `45`, it means 45 microseconds. This is not the case. Demonstration: $d = DateTime::createFromFormat('u', '45'); // 45 microseconds, right? echo $d->format('u'), "\n"; // should be "45", right? [Output:](https://tio.run/##K8go@P/fxr4go4CLSyVFwVbBJbEkNSQzN9XKKrkoFch2K8rPdcsvyk0s0VAvVddRUDcxVde05kpNzshXUEnRtUuDy2nqKCjF5ClZ//8PAA) > 450000 Turns out that `45` actually means 45 centiseconds when parsed with `u`, but properly outputs microseconds in `format()`. (And `DateTime::createFromFormat('u', '5')` is 5 deciseconds, of course.)<|eost|><|sor|>It's this way because microseconds and milliseconds are to be supplied as the decimals of a number.<|eor|><|sor|>So... you're not supplying microseconds. You're supplying the digits after the decimal separator. Why call it microseconds then?<|eor|><|eoss|><|endoftext|>
7
lolphp
AyrA_ch
g5j6nfr
<|soss|><|sot|>What's a microseconds? How do numbers?<|eot|><|sost|>[`DateTime::createFromFormat`](https://www.php.net/manual/en/datetime.createfromformat.php) can parse a string into a DateTime object according to a format specification. The inverse operation is available in [`DateTime::format`](https://www.php.net/manual/en/datetime.format.php). One of the available format letters is `u`, which is documented as > format character | Description | Example parsable values > -----------------|-------------|-------------------------- > `u` | Microseconds (up to six digits) | Example: `45`, `654321` for `createFromFormat()` and > format character | Description | Example returned values > -----------------|-------------|-------------------------- > `u` | Microseconds (added in PHP 5.2.2). Note that `date()` will always generate `000000` since it takes an integer parameter, whereas `DateTime::format()` does support microseconds if `DateTime` was created with microseconds. | Example: `654321` for `format()`, respectively. Now you might naively expect that when the documentation says "microseconds", it means microseconds, and that when one of the example values is `45`, it means 45 microseconds. This is not the case. Demonstration: $d = DateTime::createFromFormat('u', '45'); // 45 microseconds, right? echo $d->format('u'), "\n"; // should be "45", right? [Output:](https://tio.run/##K8go@P/fxr4go4CLSyVFwVbBJbEkNSQzN9XKKrkoFch2K8rPdcsvyk0s0VAvVddRUDcxVde05kpNzshXUEnRtUuDy2nqKCjF5ClZ//8PAA) > 450000 Turns out that `45` actually means 45 centiseconds when parsed with `u`, but properly outputs microseconds in `format()`. (And `DateTime::createFromFormat('u', '5')` is 5 deciseconds, of course.)<|eost|><|sor|>It's this way because microseconds and milliseconds are to be supplied as the decimals of a number.<|eor|><|sor|>Only a PHP apologist would defend 45 being anything other than 45<|eor|><|sor|>No it's not, it's the fact that the `u` format specifier expects it to be as decimals. If it weren't it would completely break parsing of dates. This actually aligns with the base unit of the unix timestamp being in seconds. You don't want `U.u` to read 1.45 as one second and 45 microseconds.<|eor|><|eoss|><|endoftext|>
7
lolphp
barubary
g5ojirh
<|soss|><|sot|>What's a microseconds? How do numbers?<|eot|><|sost|>[`DateTime::createFromFormat`](https://www.php.net/manual/en/datetime.createfromformat.php) can parse a string into a DateTime object according to a format specification. The inverse operation is available in [`DateTime::format`](https://www.php.net/manual/en/datetime.format.php). One of the available format letters is `u`, which is documented as > format character | Description | Example parsable values > -----------------|-------------|-------------------------- > `u` | Microseconds (up to six digits) | Example: `45`, `654321` for `createFromFormat()` and > format character | Description | Example returned values > -----------------|-------------|-------------------------- > `u` | Microseconds (added in PHP 5.2.2). Note that `date()` will always generate `000000` since it takes an integer parameter, whereas `DateTime::format()` does support microseconds if `DateTime` was created with microseconds. | Example: `654321` for `format()`, respectively. Now you might naively expect that when the documentation says "microseconds", it means microseconds, and that when one of the example values is `45`, it means 45 microseconds. This is not the case. Demonstration: $d = DateTime::createFromFormat('u', '45'); // 45 microseconds, right? echo $d->format('u'), "\n"; // should be "45", right? [Output:](https://tio.run/##K8go@P/fxr4go4CLSyVFwVbBJbEkNSQzN9XKKrkoFch2K8rPdcsvyk0s0VAvVddRUDcxVde05kpNzshXUEnRtUuDy2nqKCjF5ClZ//8PAA) > 450000 Turns out that `45` actually means 45 centiseconds when parsed with `u`, but properly outputs microseconds in `format()`. (And `DateTime::createFromFormat('u', '5')` is 5 deciseconds, of course.)<|eost|><|sor|>Because they're used that way. There's also a specifier for milliseconds. They had to decide for this to work one way or another. They picked the variant that's compatible to unix time (and thus their other time implementations), as the base unit there is seconds, so milliseconds and microseconds would naturally be fractions. If they went the other way, you would need to manually pick the floating point number apart manually.<|eor|><|soopr|>No, they could've simply said something like: "`u` - fractional seconds (parses digits as if preceded by a decimal point)." Why bother with "milliseconds" and "microseconds" if that's not how it works?<|eoopr|><|sor|>> Why bother with "milliseconds" and "microseconds" if that's not how it works? Because that's how they work. Using the millisecond specifier will not read beyond 3 digits. [If you don't like how it's worded, you can always edit the documentation](https://edit.php.net/)<|eor|><|soopr|>"Milliseconds" does not mean "a 3 digit number". WTF?<|eoopr|><|sor|>Yes it does. If there were more decimals it would not be milliseconds anymore.<|eor|><|soopr|>Why do you keep bringing up decimals? "Milliseconds" is a unit, not a number of digits. 1570ms is a perfectly cromulent duration (equal to 1.57 seconds).<|eoopr|><|sor|>> Why do you keep bringing up decimals? Because milli/microseconds in the unix universe are used as decimals. The base unit is 1 second not 1 millisecond. The `u` and `v` specifiers conform to that.<|eor|><|soopr|>That's not how units work. You kind of remind me of the Verizon people who insisted that 0.02 cents and 0.02 dollars are the same thing, presumably because "cents are used as decimals" or some shit.<|eoopr|><|eoss|><|endoftext|>
5
lolphp
barubary
cwl72a
<|soss|><|sot|>Casts are not sure whether they're a single token or multiple<|eot|><|sost|>As explained in [Type Casting](https://www.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting): > Type casting in PHP works much as it does in C: the name of the desired type is written in parentheses before the variable which is to be cast. Of course that is not how casts work in C. In particular, "cast" is the general C term for an explicit type conversion and not limited to variables. (Besides, PHP doesn't require variables either.) Also, the "name of the type" is not limited to a single identifier: `(const char *(*)(int, struct foo *))0` is perfectly valid C. Thus C casts are necessarily multi-token constructs: `(struct foo*)`, `( struct foo * )`, and `( struct /* hello, world! */ foo /**/* )` all mean the same thing. How about PHP? > Note that tabs and spaces are allowed inside the parentheses, so the following are functionally equivalent: > <?php > $foo = (int) $bar; > $foo = ( int ) $bar; > ?> Looks similar at first glance, but it's not: Each possible PHP cast is a single token as far as the parser is concerned. The lexer, however, accepts arbitrary horizontal whitespace inside the actual source syntax. So when you do this ... <?php function int($x) { return "not a cast"; } echo ( int )(42), "\n"; echo (int /* */)(42), "\n"; echo ( int)(42), "\n"; The output is `42`, `not a cast`, `not a cast`. ([Live demo](https://3v4l.org/ThWes)) Only the first line is parsed as a cast. The other two contain a comment (`/* */`) and vertical whitespace (a newline), respectively, so they are treated as a three-token sequence: `(` `int` `)`.<|eost|><|eoss|><|endoftext|>
48
lolphp
The_Sly_Marbo
eye8scd
<|soss|><|sot|>Casts are not sure whether they're a single token or multiple<|eot|><|sost|>As explained in [Type Casting](https://www.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting): > Type casting in PHP works much as it does in C: the name of the desired type is written in parentheses before the variable which is to be cast. Of course that is not how casts work in C. In particular, "cast" is the general C term for an explicit type conversion and not limited to variables. (Besides, PHP doesn't require variables either.) Also, the "name of the type" is not limited to a single identifier: `(const char *(*)(int, struct foo *))0` is perfectly valid C. Thus C casts are necessarily multi-token constructs: `(struct foo*)`, `( struct foo * )`, and `( struct /* hello, world! */ foo /**/* )` all mean the same thing. How about PHP? > Note that tabs and spaces are allowed inside the parentheses, so the following are functionally equivalent: > <?php > $foo = (int) $bar; > $foo = ( int ) $bar; > ?> Looks similar at first glance, but it's not: Each possible PHP cast is a single token as far as the parser is concerned. The lexer, however, accepts arbitrary horizontal whitespace inside the actual source syntax. So when you do this ... <?php function int($x) { return "not a cast"; } echo ( int )(42), "\n"; echo (int /* */)(42), "\n"; echo ( int)(42), "\n"; The output is `42`, `not a cast`, `not a cast`. ([Live demo](https://3v4l.org/ThWes)) Only the first line is parsed as a cast. The other two contain a comment (`/* */`) and vertical whitespace (a newline), respectively, so they are treated as a three-token sequence: `(` `int` `)`.<|eost|><|sor|>Although I admit this is very strange, this is quite an hard edge-case.<|eor|><|soopr|>More like a dumb edge case. It's so unnecessary. Why would you design your language with optional whitespace *inside* of (some) tokens? Let the parser deal with assembling compound structures; the lexer already knows how to skip over whitespace between tokens.<|eoopr|><|sor|>It's quite simple. PHP was not *designed*. It *evolved*, without a predator to remove bad mutations.<|eor|><|eoss|><|endoftext|>
20
lolphp
barubary
eydaqh1
<|soss|><|sot|>Casts are not sure whether they're a single token or multiple<|eot|><|sost|>As explained in [Type Casting](https://www.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting): > Type casting in PHP works much as it does in C: the name of the desired type is written in parentheses before the variable which is to be cast. Of course that is not how casts work in C. In particular, "cast" is the general C term for an explicit type conversion and not limited to variables. (Besides, PHP doesn't require variables either.) Also, the "name of the type" is not limited to a single identifier: `(const char *(*)(int, struct foo *))0` is perfectly valid C. Thus C casts are necessarily multi-token constructs: `(struct foo*)`, `( struct foo * )`, and `( struct /* hello, world! */ foo /**/* )` all mean the same thing. How about PHP? > Note that tabs and spaces are allowed inside the parentheses, so the following are functionally equivalent: > <?php > $foo = (int) $bar; > $foo = ( int ) $bar; > ?> Looks similar at first glance, but it's not: Each possible PHP cast is a single token as far as the parser is concerned. The lexer, however, accepts arbitrary horizontal whitespace inside the actual source syntax. So when you do this ... <?php function int($x) { return "not a cast"; } echo ( int )(42), "\n"; echo (int /* */)(42), "\n"; echo ( int)(42), "\n"; The output is `42`, `not a cast`, `not a cast`. ([Live demo](https://3v4l.org/ThWes)) Only the first line is parsed as a cast. The other two contain a comment (`/* */`) and vertical whitespace (a newline), respectively, so they are treated as a three-token sequence: `(` `int` `)`.<|eost|><|sor|>Although I admit this is very strange, this is quite an hard edge-case.<|eor|><|soopr|>More like a dumb edge case. It's so unnecessary. Why would you design your language with optional whitespace *inside* of (some) tokens? Let the parser deal with assembling compound structures; the lexer already knows how to skip over whitespace between tokens.<|eoopr|><|eoss|><|endoftext|>
17
lolphp
pokexpert30
eycpwp7
<|soss|><|sot|>Casts are not sure whether they're a single token or multiple<|eot|><|sost|>As explained in [Type Casting](https://www.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting): > Type casting in PHP works much as it does in C: the name of the desired type is written in parentheses before the variable which is to be cast. Of course that is not how casts work in C. In particular, "cast" is the general C term for an explicit type conversion and not limited to variables. (Besides, PHP doesn't require variables either.) Also, the "name of the type" is not limited to a single identifier: `(const char *(*)(int, struct foo *))0` is perfectly valid C. Thus C casts are necessarily multi-token constructs: `(struct foo*)`, `( struct foo * )`, and `( struct /* hello, world! */ foo /**/* )` all mean the same thing. How about PHP? > Note that tabs and spaces are allowed inside the parentheses, so the following are functionally equivalent: > <?php > $foo = (int) $bar; > $foo = ( int ) $bar; > ?> Looks similar at first glance, but it's not: Each possible PHP cast is a single token as far as the parser is concerned. The lexer, however, accepts arbitrary horizontal whitespace inside the actual source syntax. So when you do this ... <?php function int($x) { return "not a cast"; } echo ( int )(42), "\n"; echo (int /* */)(42), "\n"; echo ( int)(42), "\n"; The output is `42`, `not a cast`, `not a cast`. ([Live demo](https://3v4l.org/ThWes)) Only the first line is parsed as a cast. The other two contain a comment (`/* */`) and vertical whitespace (a newline), respectively, so they are treated as a three-token sequence: `(` `int` `)`.<|eost|><|sor|>Although I admit this is very strange, this is quite an hard edge-case.<|eor|><|eoss|><|endoftext|>
16
lolphp
HenkPoley
eycyh2r
<|soss|><|sot|>Casts are not sure whether they're a single token or multiple<|eot|><|sost|>As explained in [Type Casting](https://www.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting): > Type casting in PHP works much as it does in C: the name of the desired type is written in parentheses before the variable which is to be cast. Of course that is not how casts work in C. In particular, "cast" is the general C term for an explicit type conversion and not limited to variables. (Besides, PHP doesn't require variables either.) Also, the "name of the type" is not limited to a single identifier: `(const char *(*)(int, struct foo *))0` is perfectly valid C. Thus C casts are necessarily multi-token constructs: `(struct foo*)`, `( struct foo * )`, and `( struct /* hello, world! */ foo /**/* )` all mean the same thing. How about PHP? > Note that tabs and spaces are allowed inside the parentheses, so the following are functionally equivalent: > <?php > $foo = (int) $bar; > $foo = ( int ) $bar; > ?> Looks similar at first glance, but it's not: Each possible PHP cast is a single token as far as the parser is concerned. The lexer, however, accepts arbitrary horizontal whitespace inside the actual source syntax. So when you do this ... <?php function int($x) { return "not a cast"; } echo ( int )(42), "\n"; echo (int /* */)(42), "\n"; echo ( int)(42), "\n"; The output is `42`, `not a cast`, `not a cast`. ([Live demo](https://3v4l.org/ThWes)) Only the first line is parsed as a cast. The other two contain a comment (`/* */`) and vertical whitespace (a newline), respectively, so they are treated as a three-token sequence: `(` `int` `)`.<|eost|><|sor|>This would be nice for an underhanded PHP challenge<|eor|><|eoss|><|endoftext|>
12
lolphp
shitcanz
cvl668
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|eols|><|endoftext|>
44
lolphp
dotancohen
ey4wha4
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>I can relate to the struggles of organizing a conference that appeals to everybody's wishes, and it's a bit disheartening to see the organizers quit over it. Seeing the passively aggressive "won't be continued after this, this and this," it seems that they're simply upset about the whole ordeal instead of acknowledging the underlying problem. I had wished that they overcame their egos and tried to change. Regardless, in this day, downright ignoring minorities is unacceptable. The organizers probably had plenty of opportunities to do better. How were minorities represented in past years? How could they have communicated publicly to encourage speaker submissions? Could they have invited some individuals or reached out to them to ask what they could do better? Did they inform meetup groups about their inclusivity goals? And in the worst case, were there any submissions that could be favored such that a role model can break stereotypes? It appears from reading the blog posts that nothing of the above was tried, which is truly disheartening. What blows my mind is that despite that they did actually receive a submission from a seasoned female speaker, they _still_ rejected it. All put together, it appears to be that the white male committee is a usual case of biased bigots, that gave no care for making an inclusive event. However, one speaker indicated that the organizers intended to do better the next time, but now the whole thing has been discontinued. Really the whole story is just a shame.<|eor|><|sor|>Actually, only a single woman had submitted a proposal and it was [a repeat from a local conference last year](https://steemit.com/php/@crell/skipping-php-ce-this-year). The phpCE committee _accepts proposals_ and if no women, or Zulus, or left-handers submit proposals than there will be no women, no Zulus, and no left-handers. Accepting a bad proposal _because it is from a woman_ would be worse for the PHP committee than than rejecting it. It would be worse for women in general as well. The PHP community is a meritocracy, and within that framework everyone can sink or swim regardless of their sex.<|eor|><|eols|><|endoftext|>
35
lolphp
bart2019
ey50rhd
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>I can relate to the struggles of organizing a conference that appeals to everybody's wishes, and it's a bit disheartening to see the organizers quit over it. Seeing the passively aggressive "won't be continued after this, this and this," it seems that they're simply upset about the whole ordeal instead of acknowledging the underlying problem. I had wished that they overcame their egos and tried to change. Regardless, in this day, downright ignoring minorities is unacceptable. The organizers probably had plenty of opportunities to do better. How were minorities represented in past years? How could they have communicated publicly to encourage speaker submissions? Could they have invited some individuals or reached out to them to ask what they could do better? Did they inform meetup groups about their inclusivity goals? And in the worst case, were there any submissions that could be favored such that a role model can break stereotypes? It appears from reading the blog posts that nothing of the above was tried, which is truly disheartening. What blows my mind is that despite that they did actually receive a submission from a seasoned female speaker, they _still_ rejected it. All put together, it appears to be that the white male committee is a usual case of biased bigots, that gave no care for making an inclusive event. However, one speaker indicated that the organizers intended to do better the next time, but now the whole thing has been discontinued. Really the whole story is just a shame.<|eor|><|sor|>> All put together, it appears to be that the white male committee is a usual case of biased bigots You'll be very hard pressed to find any PHP developers in Germany that are not white and male. The bigotry is in your head.<|eor|><|eols|><|endoftext|>
28
lolphp
Thanks__For_The_Gold
ey682wu
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>That strange person with pronouns in his bio literally has a problem with white people in central Europe. It's like going to China and complaining that it's full of Chinese people.<|eor|><|eols|><|endoftext|>
11
lolphp
poopskins
ey5j28n
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>[deleted]<|eor|><|sor|>The qualm is that the event reinforces stereotypes. Since there are non-white/non-male software engineers, reflecting this diversity makes for a more inclusive event, and by extension, a more inclusive work environment.<|eor|><|eols|><|endoftext|>
8
lolphp
AlbertRammstein
ey52tis
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>I can relate to the struggles of organizing a conference that appeals to everybody's wishes, and it's a bit disheartening to see the organizers quit over it. Seeing the passively aggressive "won't be continued after this, this and this," it seems that they're simply upset about the whole ordeal instead of acknowledging the underlying problem. I had wished that they overcame their egos and tried to change. Regardless, in this day, downright ignoring minorities is unacceptable. The organizers probably had plenty of opportunities to do better. How were minorities represented in past years? How could they have communicated publicly to encourage speaker submissions? Could they have invited some individuals or reached out to them to ask what they could do better? Did they inform meetup groups about their inclusivity goals? And in the worst case, were there any submissions that could be favored such that a role model can break stereotypes? It appears from reading the blog posts that nothing of the above was tried, which is truly disheartening. What blows my mind is that despite that they did actually receive a submission from a seasoned female speaker, they _still_ rejected it. All put together, it appears to be that the white male committee is a usual case of biased bigots, that gave no care for making an inclusive event. However, one speaker indicated that the organizers intended to do better the next time, but now the whole thing has been discontinued. Really the whole story is just a shame.<|eor|><|sor|>Friend from a different field sometimes co-organizes some conferences. Of course they got attacked for not having enough women too. Their official response (for the 2019 conference): they had policy of offering every talk to a woman/minority (in EU tech these are synonyms). **They could not find single speaker who would accept**. The unofficial addendum: this is because there are still relatively few women in the field, and they are invited to speak at every possible conference for exactly these reasons. As a result, even the mediocre ones are doing so many talks and keynotes (helping their careers tremendously) that they dont accept anything but the top conferences.<|eor|><|eols|><|endoftext|>
8
lolphp
cube-drone
ey5dghq
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>I can relate to the struggles of organizing a conference that appeals to everybody's wishes, and it's a bit disheartening to see the organizers quit over it. Seeing the passively aggressive "won't be continued after this, this and this," it seems that they're simply upset about the whole ordeal instead of acknowledging the underlying problem. I had wished that they overcame their egos and tried to change. Regardless, in this day, downright ignoring minorities is unacceptable. The organizers probably had plenty of opportunities to do better. How were minorities represented in past years? How could they have communicated publicly to encourage speaker submissions? Could they have invited some individuals or reached out to them to ask what they could do better? Did they inform meetup groups about their inclusivity goals? And in the worst case, were there any submissions that could be favored such that a role model can break stereotypes? It appears from reading the blog posts that nothing of the above was tried, which is truly disheartening. What blows my mind is that despite that they did actually receive a submission from a seasoned female speaker, they _still_ rejected it. All put together, it appears to be that the white male committee is a usual case of biased bigots, that gave no care for making an inclusive event. However, one speaker indicated that the organizers intended to do better the next time, but now the whole thing has been discontinued. Really the whole story is just a shame.<|eor|><|sor|>I love that you gave a thoughtful response grounded in your own experience running inclusive conferences, it got downvoted, and your top response is "lol there aren't any women who develop software" and it got upvoted. It's too bad that r/lollolphp doesn't exist.<|eor|><|eols|><|endoftext|>
8
lolphp
shaql
eyb8et3
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>[deleted]<|eor|><|sor|>The qualm is that the event reinforces stereotypes. Since there are non-white/non-male software engineers, reflecting this diversity makes for a more inclusive event, and by extension, a more inclusive work environment.<|eor|><|sor|>I get that, but surely the solution is disproportionate encouragement to submit in the first place, rather than foregoing normal consideration or cancelling the event.<|eor|><|sor|>The whole thing could have been nipped in the bud by having two invited talks by women in the previous year. When they saw female participation going down they could've done something to stop the spiral and they didn't. In my field of academia, when I submit papers to conferences I always look who and what has been accepted the previous years. Conferences do shift focus. That's why they usually have steering committees. Female participation was clearly not a goal - at least it wasn't when there was still a chance to save the situation.<|eor|><|sor|>> Female participation was clearly not a goal Are you suggesting that it *should* be? That participants should be judged/selected based on gender?<|eor|><|eols|><|endoftext|>
8
lolphp
shaql
eybhxtf
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>[deleted]<|eor|><|sor|>The qualm is that the event reinforces stereotypes. Since there are non-white/non-male software engineers, reflecting this diversity makes for a more inclusive event, and by extension, a more inclusive work environment.<|eor|><|sor|>I get that, but surely the solution is disproportionate encouragement to submit in the first place, rather than foregoing normal consideration or cancelling the event.<|eor|><|sor|>The whole thing could have been nipped in the bud by having two invited talks by women in the previous year. When they saw female participation going down they could've done something to stop the spiral and they didn't. In my field of academia, when I submit papers to conferences I always look who and what has been accepted the previous years. Conferences do shift focus. That's why they usually have steering committees. Female participation was clearly not a goal - at least it wasn't when there was still a chance to save the situation.<|eor|><|sor|>> Female participation was clearly not a goal Are you suggesting that it *should* be? That participants should be judged/selected based on gender?<|eor|><|sor|>If there are women participating in the industry (they are), then their representation should be one of the goals, yes. Invited speakers should be invited as role models for the direction the conference wants to take. Be that in terms of content and/or representation. If you see a lack in functional programming, invite someone from that field. If you see a lack in OOP then invite someone from that field. If you see a lack of women, then invite a few women. It's not that hard and that's what a steering committee is for. That's what invited talks are for. But you clearly never submitted to a conference, especially a long-running one.<|eor|><|sor|>> But you clearly never submitted to a conference, especially a long-running one. Please hold the ad-hominems for now. I don't see a lack of women, because I don't see men and women. I see programmers. What part of being a woman is relevant in a programming conference? What part of being left-handed is relevant? Or what part of having blond hair? Should I also notice that too many speakers have dark hair, and I should invite more blond-haired ones?<|eor|><|eols|><|endoftext|>
8
lolphp
colshrapnel
ey4y41v
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>I can relate to the struggles of organizing a conference that appeals to everybody's wishes, and it's a bit disheartening to see the organizers quit over it. Seeing the passively aggressive "won't be continued after this, this and this," it seems that they're simply upset about the whole ordeal instead of acknowledging the underlying problem. I had wished that they overcame their egos and tried to change. Regardless, in this day, downright ignoring minorities is unacceptable. The organizers probably had plenty of opportunities to do better. How were minorities represented in past years? How could they have communicated publicly to encourage speaker submissions? Could they have invited some individuals or reached out to them to ask what they could do better? Did they inform meetup groups about their inclusivity goals? And in the worst case, were there any submissions that could be favored such that a role model can break stereotypes? It appears from reading the blog posts that nothing of the above was tried, which is truly disheartening. What blows my mind is that despite that they did actually receive a submission from a seasoned female speaker, they _still_ rejected it. All put together, it appears to be that the white male committee is a usual case of biased bigots, that gave no care for making an inclusive event. However, one speaker indicated that the organizers intended to do better the next time, but now the whole thing has been discontinued. Really the whole story is just a shame.<|eor|><|sor|>The sweet feeling of social justice when you call someone a biased bigot.<|eor|><|eols|><|endoftext|>
7
lolphp
smegnose
ey7f3hf
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>[deleted]<|eor|><|sor|>The qualm is that the event reinforces stereotypes. Since there are non-white/non-male software engineers, reflecting this diversity makes for a more inclusive event, and by extension, a more inclusive work environment.<|eor|><|sor|>I get that, but surely the solution is disproportionate encouragement to submit in the first place, rather than foregoing normal consideration or cancelling the event.<|eor|><|eols|><|endoftext|>
6
lolphp
Miserable_Fuck
ey5r3yu
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>I can relate to the struggles of organizing a conference that appeals to everybody's wishes, and it's a bit disheartening to see the organizers quit over it. Seeing the passively aggressive "won't be continued after this, this and this," it seems that they're simply upset about the whole ordeal instead of acknowledging the underlying problem. I had wished that they overcame their egos and tried to change. Regardless, in this day, downright ignoring minorities is unacceptable. The organizers probably had plenty of opportunities to do better. How were minorities represented in past years? How could they have communicated publicly to encourage speaker submissions? Could they have invited some individuals or reached out to them to ask what they could do better? Did they inform meetup groups about their inclusivity goals? And in the worst case, were there any submissions that could be favored such that a role model can break stereotypes? It appears from reading the blog posts that nothing of the above was tried, which is truly disheartening. What blows my mind is that despite that they did actually receive a submission from a seasoned female speaker, they _still_ rejected it. All put together, it appears to be that the white male committee is a usual case of biased bigots, that gave no care for making an inclusive event. However, one speaker indicated that the organizers intended to do better the next time, but now the whole thing has been discontinued. Really the whole story is just a shame.<|eor|><|sor|>Friend from a different field sometimes co-organizes some conferences. Of course they got attacked for not having enough women too. Their official response (for the 2019 conference): they had policy of offering every talk to a woman/minority (in EU tech these are synonyms). **They could not find single speaker who would accept**. The unofficial addendum: this is because there are still relatively few women in the field, and they are invited to speak at every possible conference for exactly these reasons. As a result, even the mediocre ones are doing so many talks and keynotes (helping their careers tremendously) that they dont accept anything but the top conferences.<|eor|><|sor|>[As this speaker writes](https://steemit.com/php/@crell/skipping-php-ce-this-year), they had a seasoned female speaker that they rejected. I was one of the organizers of DevFest NL. [I wrote this article back in 2015](http://2015.devfest.nl/blog/women-techmakers/) summarizing the efforts for that year's conference. With some effort, I was able to make a significant change in perception of the event.<|eor|><|sor|>Rejected for understandabke reasons.<|eor|><|eols|><|endoftext|>
6
lolphp
bart2019
eyb599m
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>I can relate to the struggles of organizing a conference that appeals to everybody's wishes, and it's a bit disheartening to see the organizers quit over it. Seeing the passively aggressive "won't be continued after this, this and this," it seems that they're simply upset about the whole ordeal instead of acknowledging the underlying problem. I had wished that they overcame their egos and tried to change. Regardless, in this day, downright ignoring minorities is unacceptable. The organizers probably had plenty of opportunities to do better. How were minorities represented in past years? How could they have communicated publicly to encourage speaker submissions? Could they have invited some individuals or reached out to them to ask what they could do better? Did they inform meetup groups about their inclusivity goals? And in the worst case, were there any submissions that could be favored such that a role model can break stereotypes? It appears from reading the blog posts that nothing of the above was tried, which is truly disheartening. What blows my mind is that despite that they did actually receive a submission from a seasoned female speaker, they _still_ rejected it. All put together, it appears to be that the white male committee is a usual case of biased bigots, that gave no care for making an inclusive event. However, one speaker indicated that the organizers intended to do better the next time, but now the whole thing has been discontinued. Really the whole story is just a shame.<|eor|><|sor|>> All put together, it appears to be that the white male committee is a usual case of biased bigots You'll be very hard pressed to find any PHP developers in Germany that are not white and male. The bigotry is in your head.<|eor|><|sor|>Wait, when did the last woman die off in Germany?<|eor|><|sor|>Since when is it OK to force people into liking programming?<|eor|><|sor|>You know, I've squinted at my comment real hard several times, and I still can't see where I said anyone should be forced to like anything.<|eor|><|sor|>There is a strong correlation between people's gender and their interest in math, physics or programming. No amount of wishful thinking is going to make that correlation go away.<|eor|><|eols|><|endoftext|>
6
lolphp
phatskat
eyyf8gg
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>[deleted]<|eor|><|sor|>The qualm is that the event reinforces stereotypes. Since there are non-white/non-male software engineers, reflecting this diversity makes for a more inclusive event, and by extension, a more inclusive work environment.<|eor|><|sor|>I get that, but surely the solution is disproportionate encouragement to submit in the first place, rather than foregoing normal consideration or cancelling the event.<|eor|><|sor|>The whole thing could have been nipped in the bud by having two invited talks by women in the previous year. When they saw female participation going down they could've done something to stop the spiral and they didn't. In my field of academia, when I submit papers to conferences I always look who and what has been accepted the previous years. Conferences do shift focus. That's why they usually have steering committees. Female participation was clearly not a goal - at least it wasn't when there was still a chance to save the situation.<|eor|><|sor|>> Female participation was clearly not a goal Are you suggesting that it *should* be? That participants should be judged/selected based on gender?<|eor|><|sor|>> Are you suggesting that it should be? Yes. > That participants should be judged/selected based on gender? No. Those two things arent the same. You can reach out to a group of female speakers, or POC speakers, etc, and then judge replies based on their content.<|eor|><|sor|>Why? What's the difference between male and female speakers? What's the difference between POC and white speakers? How would any of such differences affect anything PHP-related/technical?<|eor|><|sor|>> How would any of such differences affect anything PHP-related/technical? It provides several things that aid the conference as a whole. Its not just about the technology, its about who feels comfortable in that space. If your lineup is all composed of people of the same gender and skin tone, you alienate a chunk of your audience. Theres no shortage of things to discuss in programming, so why not make an effort to have some of the people talking be more diverse? If you dont give people representation, then you run the risk of losing potential audiences. If those audiences go away, you risk fewer voices in the discussion. The fewer people who are participating, the fewer new ideas we find together. Im not saying you get better ideas from the speakers _necessarily_ based on gender or race, but you get more diverse _and larger_ audiences that can then lead to better overall discussion and sharing. Finally, on the topic of merit, it seems at best odd that the only panelists were white men. Surely, if other candidates were heavily considered, it would seem rather improbable that that the best topics and the best presenters all happened to be white men. I dont think it was malicious or with the forethought of picking speakers like that, but it also seems rather tone deaf in the face of a rapidly diversifying field.<|eor|><|eols|><|endoftext|>
6
lolphp
Miserable_Fuck
ey63wxd
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>I can relate to the struggles of organizing a conference that appeals to everybody's wishes, and it's a bit disheartening to see the organizers quit over it. Seeing the passively aggressive "won't be continued after this, this and this," it seems that they're simply upset about the whole ordeal instead of acknowledging the underlying problem. I had wished that they overcame their egos and tried to change. Regardless, in this day, downright ignoring minorities is unacceptable. The organizers probably had plenty of opportunities to do better. How were minorities represented in past years? How could they have communicated publicly to encourage speaker submissions? Could they have invited some individuals or reached out to them to ask what they could do better? Did they inform meetup groups about their inclusivity goals? And in the worst case, were there any submissions that could be favored such that a role model can break stereotypes? It appears from reading the blog posts that nothing of the above was tried, which is truly disheartening. What blows my mind is that despite that they did actually receive a submission from a seasoned female speaker, they _still_ rejected it. All put together, it appears to be that the white male committee is a usual case of biased bigots, that gave no care for making an inclusive event. However, one speaker indicated that the organizers intended to do better the next time, but now the whole thing has been discontinued. Really the whole story is just a shame.<|eor|><|sor|>> All put together, it appears to be that the white male committee is a usual case of biased bigots You'll be very hard pressed to find any PHP developers in Germany that are not white and male. The bigotry is in your head.<|eor|><|sor|>Some of the speakers were international. The linked blog posts provide a bit more context. For posterity, [here](https://steemit.com/php/@crell/skipping-php-ce-this-year) and [here](https://markbakeruk.net/2019/07/24/withdrawal-from-speaking-at-phpce-2019/). I was one of the organizers of DevFest NL in the Netherlands from 2014 to 2017, and made a personal effort to diversify the attendees and speakers, which [I wrote about here](http://2015.devfest.nl/blog/women-techmakers/). While I was only successful in getting two female speakers of twenty, I'm happy to have increased the female attendance from 6% to 18% in 2015, and that increase continued to roughly 30% in 2017.<|eor|><|sor|>>While I was only successful in getting two female speakers of twenty What if my own line in the sand tells me that wasnt enough and I call you a bigot?<|eor|><|sor|>I'd agree with you.<|eor|><|sor|>So is bigotry in the eye of the beholder?<|eor|><|sor|>I think casting judgement on the actions of others usually tends to be in the eye of the beholder. This thread has proven to be a testament of that.<|eor|><|sor|>I'm asking about the specific issue which lead to the cancellation of this event i.e. female underrepresentation due to some form of sexism/oppression. If the the outrage is arbitrary then we shouldn't be making decisions based on it. Further, one of the linked articles gives a glimpse into the mind of these people: > Again, many potential women speakers will look at the previous years line-up and see just 1 out of 39, and conclude that it is a predominantly male conference, and not worth their time to submit. I refuse to concede that point without any form of evidence, as well as a clarification of what "many" means. As a male, I wouldn't decline to speak just because most of the speakers are female. I wouldn't even care to check the genders of other speakers. In fact, if I were to decline to speak on the basis that most speakers were female, I'd probably get eaten alive by society. Yet here this person is assuring me that not only does this happen, but that we should be concerned on behalf of the very same people who take sex into account when making these decisions i.e. discriminate. Isn't that what they're trying to fight *against*? And I know that my opinion on this is deemed uninformed because I'm a male myself, but I'm also a minority and I feel the same way about *that*. It would never occur to me to decline to speak at an event just because most of the speakers were white. I'd feel like a complete asshole if I did/said that. Just the thought makes me feel dirty. And yet if it were about sex/gender I'd be given a pass for being discriminatory, and people would write articles like the one above to explain why/how my discrimination is someone *else's* fault instead of my own. This specific brand of concern over equality only seems to exist in the minds of **certain** types of people. I think those people do more harm than good.<|eor|><|eols|><|endoftext|>
6
lolphp
maweki
ey6i1kg
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>[deleted]<|eor|><|sor|>They accepted only a single talk by a woman the year before and didn't have an invited talk by a woman either. A single submission by a woman means that something is wrong with the conference. Such a low ratio does not reflect the community. And these problems will repeat and be exacerbated year after year if nothing changes.<|eor|><|eols|><|endoftext|>
5
lolphp
maweki
ey52t3f
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>I can relate to the struggles of organizing a conference that appeals to everybody's wishes, and it's a bit disheartening to see the organizers quit over it. Seeing the passively aggressive "won't be continued after this, this and this," it seems that they're simply upset about the whole ordeal instead of acknowledging the underlying problem. I had wished that they overcame their egos and tried to change. Regardless, in this day, downright ignoring minorities is unacceptable. The organizers probably had plenty of opportunities to do better. How were minorities represented in past years? How could they have communicated publicly to encourage speaker submissions? Could they have invited some individuals or reached out to them to ask what they could do better? Did they inform meetup groups about their inclusivity goals? And in the worst case, were there any submissions that could be favored such that a role model can break stereotypes? It appears from reading the blog posts that nothing of the above was tried, which is truly disheartening. What blows my mind is that despite that they did actually receive a submission from a seasoned female speaker, they _still_ rejected it. All put together, it appears to be that the white male committee is a usual case of biased bigots, that gave no care for making an inclusive event. However, one speaker indicated that the organizers intended to do better the next time, but now the whole thing has been discontinued. Really the whole story is just a shame.<|eor|><|sor|>Actually, only a single woman had submitted a proposal and it was [a repeat from a local conference last year](https://steemit.com/php/@crell/skipping-php-ce-this-year). The phpCE committee _accepts proposals_ and if no women, or Zulus, or left-handers submit proposals than there will be no women, no Zulus, and no left-handers. Accepting a bad proposal _because it is from a woman_ would be worse for the PHP committee than than rejecting it. It would be worse for women in general as well. The PHP community is a meritocracy, and within that framework everyone can sink or swim regardless of their sex.<|eor|><|sor|>The counterargument to that is, that if only a single woman has submitted anything, then something was broken way before. They only accepted a single presentation of female submitters the year before and had no invited talks of women. This could have been avoided but the problems are not all recent.<|eor|><|eols|><|endoftext|>
5
lolphp
poopskins
ey55ork
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>I can relate to the struggles of organizing a conference that appeals to everybody's wishes, and it's a bit disheartening to see the organizers quit over it. Seeing the passively aggressive "won't be continued after this, this and this," it seems that they're simply upset about the whole ordeal instead of acknowledging the underlying problem. I had wished that they overcame their egos and tried to change. Regardless, in this day, downright ignoring minorities is unacceptable. The organizers probably had plenty of opportunities to do better. How were minorities represented in past years? How could they have communicated publicly to encourage speaker submissions? Could they have invited some individuals or reached out to them to ask what they could do better? Did they inform meetup groups about their inclusivity goals? And in the worst case, were there any submissions that could be favored such that a role model can break stereotypes? It appears from reading the blog posts that nothing of the above was tried, which is truly disheartening. What blows my mind is that despite that they did actually receive a submission from a seasoned female speaker, they _still_ rejected it. All put together, it appears to be that the white male committee is a usual case of biased bigots, that gave no care for making an inclusive event. However, one speaker indicated that the organizers intended to do better the next time, but now the whole thing has been discontinued. Really the whole story is just a shame.<|eor|><|sor|>Friend from a different field sometimes co-organizes some conferences. Of course they got attacked for not having enough women too. Their official response (for the 2019 conference): they had policy of offering every talk to a woman/minority (in EU tech these are synonyms). **They could not find single speaker who would accept**. The unofficial addendum: this is because there are still relatively few women in the field, and they are invited to speak at every possible conference for exactly these reasons. As a result, even the mediocre ones are doing so many talks and keynotes (helping their careers tremendously) that they dont accept anything but the top conferences.<|eor|><|sor|>[As this speaker writes](https://steemit.com/php/@crell/skipping-php-ce-this-year), they had a seasoned female speaker that they rejected. I was one of the organizers of DevFest NL. [I wrote this article back in 2015](http://2015.devfest.nl/blog/women-techmakers/) summarizing the efforts for that year's conference. With some effort, I was able to make a significant change in perception of the event.<|eor|><|eols|><|endoftext|>
5
lolphp
phatskat
eywjtja
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>[deleted]<|eor|><|sor|>The qualm is that the event reinforces stereotypes. Since there are non-white/non-male software engineers, reflecting this diversity makes for a more inclusive event, and by extension, a more inclusive work environment.<|eor|><|sor|>I get that, but surely the solution is disproportionate encouragement to submit in the first place, rather than foregoing normal consideration or cancelling the event.<|eor|><|sor|>The whole thing could have been nipped in the bud by having two invited talks by women in the previous year. When they saw female participation going down they could've done something to stop the spiral and they didn't. In my field of academia, when I submit papers to conferences I always look who and what has been accepted the previous years. Conferences do shift focus. That's why they usually have steering committees. Female participation was clearly not a goal - at least it wasn't when there was still a chance to save the situation.<|eor|><|sor|>> Female participation was clearly not a goal Are you suggesting that it *should* be? That participants should be judged/selected based on gender?<|eor|><|sor|>> Are you suggesting that it should be? Yes. > That participants should be judged/selected based on gender? No. Those two things arent the same. You can reach out to a group of female speakers, or POC speakers, etc, and then judge replies based on their content.<|eor|><|eols|><|endoftext|>
5
lolphp
poopskins
ey60xxk
<|sols|><|sot|>LOLCONF cancelled - Reason: "White Males Only"<|eot|><|sol|>https://2019.phpce.eu/en/<|eol|><|sor|>I can relate to the struggles of organizing a conference that appeals to everybody's wishes, and it's a bit disheartening to see the organizers quit over it. Seeing the passively aggressive "won't be continued after this, this and this," it seems that they're simply upset about the whole ordeal instead of acknowledging the underlying problem. I had wished that they overcame their egos and tried to change. Regardless, in this day, downright ignoring minorities is unacceptable. The organizers probably had plenty of opportunities to do better. How were minorities represented in past years? How could they have communicated publicly to encourage speaker submissions? Could they have invited some individuals or reached out to them to ask what they could do better? Did they inform meetup groups about their inclusivity goals? And in the worst case, were there any submissions that could be favored such that a role model can break stereotypes? It appears from reading the blog posts that nothing of the above was tried, which is truly disheartening. What blows my mind is that despite that they did actually receive a submission from a seasoned female speaker, they _still_ rejected it. All put together, it appears to be that the white male committee is a usual case of biased bigots, that gave no care for making an inclusive event. However, one speaker indicated that the organizers intended to do better the next time, but now the whole thing has been discontinued. Really the whole story is just a shame.<|eor|><|sor|>> All put together, it appears to be that the white male committee is a usual case of biased bigots You'll be very hard pressed to find any PHP developers in Germany that are not white and male. The bigotry is in your head.<|eor|><|sor|>Some of the speakers were international. The linked blog posts provide a bit more context. For posterity, [here](https://steemit.com/php/@crell/skipping-php-ce-this-year) and [here](https://markbakeruk.net/2019/07/24/withdrawal-from-speaking-at-phpce-2019/). I was one of the organizers of DevFest NL in the Netherlands from 2014 to 2017, and made a personal effort to diversify the attendees and speakers, which [I wrote about here](http://2015.devfest.nl/blog/women-techmakers/). While I was only successful in getting two female speakers of twenty, I'm happy to have increased the female attendance from 6% to 18% in 2015, and that increase continued to roughly 30% in 2017.<|eor|><|sor|>>While I was only successful in getting two female speakers of twenty What if my own line in the sand tells me that wasnt enough and I call you a bigot?<|eor|><|sor|>I'd agree with you.<|eor|><|sor|>So is bigotry in the eye of the beholder?<|eor|><|sor|>I think casting judgement on the actions of others usually tends to be in the eye of the beholder. This thread has proven to be a testament of that.<|eor|><|eols|><|endoftext|>
5
lolphp
Takeoded
7sbsn3
<|sols|><|sot|>SIGBABY<|eot|><|sol|>https://stackoverflow.com/a/18584728/1067003<|eol|><|eols|><|endoftext|>
43
lolphp
Coul33t
dt46n0e
<|sols|><|sot|>SIGBABY<|eot|><|sol|>https://stackoverflow.com/a/18584728/1067003<|eol|><|sor|>That's a wholesome lolphp!<|eor|><|eols|><|endoftext|>
9
lolphp
Various_Pickles
dt6mb44
<|sols|><|sot|>SIGBABY<|eot|><|sol|>https://stackoverflow.com/a/18584728/1067003<|eol|><|sor|>Reminds me of the random PHP logos and other version-identifying crap that used to be GETable in any PHP deployment. Its always a great idea to tell anyone who asks exactly what software versions your infrastructure is running.<|eor|><|eols|><|endoftext|>
8
lolphp
andsens
6nsi7h
<|sols|><|sot|>continue in a switch statement jumps to the end of the switch, just like break. So remember to use continue 2; when switching in a loop.<|eot|><|sol|>https://3v4l.org/4v7Ss<|eol|><|eols|><|endoftext|>
49
lolphp
RenaKunisaki
dkd7ymr
<|sols|><|sot|>continue in a switch statement jumps to the end of the switch, just like break. So remember to use continue 2; when switching in a loop.<|eot|><|sol|>https://3v4l.org/4v7Ss<|eol|><|sor|>What would you expect to happen?<|eor|><|sor|>Jump to the beginning of the loop like in other languages?<|eor|><|eols|><|endoftext|>
20
lolphp
andsens
dkclsug
<|sols|><|sot|>continue in a switch statement jumps to the end of the switch, just like break. So remember to use continue 2; when switching in a loop.<|eot|><|sol|>https://3v4l.org/4v7Ss<|eol|><|sor|>Yes, there is a big clear note in the documentation: http://php.net/manual/en/control-structures.switch.php &nbsp; Where is the LOL part?<|eor|><|soopr|>No other language I know of does this. No how matter how much you document something like that, it's still a quirk. It's one of those things that contribute to a form of chilling effect where you can never really be fluent in a language because you have to consult the docs all the time. For example: is the argument order in `array_map` and `array_filter` the same? In any sane language you'd know right away, with PHP: check the docs.<|eoopr|><|eols|><|endoftext|>
13
lolphp
sproingie
dkkjotn
<|sols|><|sot|>continue in a switch statement jumps to the end of the switch, just like break. So remember to use continue 2; when switching in a loop.<|eot|><|sol|>https://3v4l.org/4v7Ss<|eol|><|sor|>The real lolphp is the fact even though PHP has labels for goto, continue and break don't work with them, only taking a numeric level arg instead.<|eor|><|eols|><|endoftext|>
10
lolphp
josefx
dkgv8b4
<|sols|><|sot|>continue in a switch statement jumps to the end of the switch, just like break. So remember to use continue 2; when switching in a loop.<|eot|><|sol|>https://3v4l.org/4v7Ss<|eol|><|sor|>So today's lolphp is "php has different semantics for continue inside nested for/switch statements". You guys are positively making php look good here. I wish my other languages had warts this small.<|eor|><|sor|>/r/lolphp is seven years old by now, so the worst warts were already discussed long ago. Not every sub constantly re posts last weeks content. <|eor|><|eols|><|endoftext|>
9
lolphp
RichardEyre
dkcj7de
<|sols|><|sot|>continue in a switch statement jumps to the end of the switch, just like break. So remember to use continue 2; when switching in a loop.<|eot|><|sol|>https://3v4l.org/4v7Ss<|eol|><|sor|>What would you expect to happen?<|eor|><|soopr|>Nothing? An error? Anything but that!<|eoopr|><|sor|>Surely it is doing nothing here though. The second case doesn't match so it exits and continues the loop. The way it's working is consistent with break here, to behave differently would be confusing.<|eor|><|eols|><|endoftext|>
9
lolphp
RichardEyre
dkcfkaa
<|sols|><|sot|>continue in a switch statement jumps to the end of the switch, just like break. So remember to use continue 2; when switching in a loop.<|eot|><|sol|>https://3v4l.org/4v7Ss<|eol|><|sor|>What would you expect to happen?<|eor|><|eols|><|endoftext|>
7
lolphp
nikanjX
dkd8nuz
<|sols|><|sot|>continue in a switch statement jumps to the end of the switch, just like break. So remember to use continue 2; when switching in a loop.<|eot|><|sol|>https://3v4l.org/4v7Ss<|eol|><|sor|>So today's lolphp is "php has different semantics for continue inside nested for/switch statements". You guys are positively making php look good here. I wish my other languages had warts this small.<|eor|><|eols|><|endoftext|>
7
lolphp
andsens
dkclm2f
<|sols|><|sot|>continue in a switch statement jumps to the end of the switch, just like break. So remember to use continue 2; when switching in a loop.<|eot|><|sol|>https://3v4l.org/4v7Ss<|eol|><|sor|>You need to use 0/1 instead of true/false: https://3v4l.org/pbPeS but the output is still wrong. Works fine with JS: https://jsbin.com/zofupipiju/edit?output . Bug in PHP or defective by design?<|eor|><|soopr|>Woops, you're right. Ah well, too late. The docs say it's by design: > Note: Note that unlike some other languages, the continue statement applies to switch and acts similar to break. If you have a switch inside a loop and wish to continue to the next iteration of the outer loop, use continue 2.<|eoopr|><|eols|><|endoftext|>
5
lolphp
colinodell
66rrqp
<|soss|><|sot|>Setting CURLOPT_SSL_VERIFYHOST to true actually disables validation<|eot|><|sost|>Stumbled across this gem while reading http://ferd.ca/tout-est-terrible.html: > But my favorite has to be the cURL API in PHP. By default, settings are fine and correct, but if you read the doc, you may want to set the `CURLOPT_SSL_VERIFYHOST` option to `true`. The problem is that in PHP (much as in C and C++), `true` is pretty much the same as `1`. Yet, the value `1` for `CURLOPT_SSL_VERIFYHOST` actually disables validation. The correct value is `2`. > > Whoops. (Support for value `1` was eventually removed in cURL 7.28.1)<|eost|><|eoss|><|endoftext|>
46
lolphp
lostcoffee
dgl54de
<|soss|><|sot|>Setting CURLOPT_SSL_VERIFYHOST to true actually disables validation<|eot|><|sost|>Stumbled across this gem while reading http://ferd.ca/tout-est-terrible.html: > But my favorite has to be the cURL API in PHP. By default, settings are fine and correct, but if you read the doc, you may want to set the `CURLOPT_SSL_VERIFYHOST` option to `true`. The problem is that in PHP (much as in C and C++), `true` is pretty much the same as `1`. Yet, the value `1` for `CURLOPT_SSL_VERIFYHOST` actually disables validation. The correct value is `2`. > > Whoops. (Support for value `1` was eventually removed in cURL 7.28.1)<|eost|><|sor|>For a variety of reasons, SSL hostname verification is a frequently made but disastrous security mistake. This is an understandably common misuse of libcurl, which could happen in more contexts than PHP: > cURL is a popular tool and library (libcurl) for fetching data from remote servers. Since version 7.10, cURL validate s SSL certificates by default. Internally, it uses OpenSSL to verify the chain of trust and verifies the hostname itself. This functionality is controlled by parameters `CURLOPT_SSL_VERIFYPEER` (default value: true) and `CURLOPT_SSL_VERIFYHOST` (default value: 2). This interface is almost perversely bad. The `VERIFYPEER`parameter is a boolean, while a similar-looking `VERIFYHOST` parameter is an integer. The following quote from the cURL manual explains the meaning of `CURLOPT_SSL_VERIFYHOST`: >> 1 to check the existence of a common name in the SSL peer certificate. 2 to check the existence of a common name and also verify that it matches the hostname provided. In production environments the value of this option should be kept at 2 (default value). > Well-intentioned developers not only routinely misunderstand these parameters, but often set `CURLOPT_SSL_VERIFY HOST`to `TRUE`, thereby changing it to 1 and thus accidentally disabling hostname verification with disastrous consequences (see Section 7.1). From [The Most Dangerous Code in the World: Validating SSL Certificates in Non-Browser Software](https://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf), page 5, which details hostname verification failures in a number of applications/libraries.<|eor|><|eoss|><|endoftext|>
19
lolphp
sproingie
dglw1tk
<|soss|><|sot|>Setting CURLOPT_SSL_VERIFYHOST to true actually disables validation<|eot|><|sost|>Stumbled across this gem while reading http://ferd.ca/tout-est-terrible.html: > But my favorite has to be the cURL API in PHP. By default, settings are fine and correct, but if you read the doc, you may want to set the `CURLOPT_SSL_VERIFYHOST` option to `true`. The problem is that in PHP (much as in C and C++), `true` is pretty much the same as `1`. Yet, the value `1` for `CURLOPT_SSL_VERIFYHOST` actually disables validation. The correct value is `2`. > > Whoops. (Support for value `1` was eventually removed in cURL 7.28.1)<|eost|><|sor|>Seems more like lolcurl, which has a byzantine API in the best of parts, so abandon all hope when it comes to interfacing with something as baroque as openssl. ... laying aside that the Byzantines were gone two centuries before the Baroque period began ;) libcurl should be thought of as similarly ancient.<|eor|><|eoss|><|endoftext|>
6
lolphp
raylu
dglwggq
<|soss|><|sot|>Setting CURLOPT_SSL_VERIFYHOST to true actually disables validation<|eot|><|sost|>Stumbled across this gem while reading http://ferd.ca/tout-est-terrible.html: > But my favorite has to be the cURL API in PHP. By default, settings are fine and correct, but if you read the doc, you may want to set the `CURLOPT_SSL_VERIFYHOST` option to `true`. The problem is that in PHP (much as in C and C++), `true` is pretty much the same as `1`. Yet, the value `1` for `CURLOPT_SSL_VERIFYHOST` actually disables validation. The correct value is `2`. > > Whoops. (Support for value `1` was eventually removed in cURL 7.28.1)<|eost|><|sor|>Seems more like lolcurl, which has a byzantine API in the best of parts, so abandon all hope when it comes to interfacing with something as baroque as openssl. ... laying aside that the Byzantines were gone two centuries before the Baroque period began ;) libcurl should be thought of as similarly ancient.<|eor|><|sor|>Definitely an issue in libcurl, but the real issue here is that every other high-level language has HTTP(S) abstractions that aren't just a wrapper around libcurl.<|eor|><|eoss|><|endoftext|>
6
lolphp
kauffj
4k59pq
<|sols|><|sot|>json_encode(['color' => '1e3678']) === false<|eot|><|sol|>https://3v4l.org/aHt34<|eol|><|eols|><|endoftext|>
49
lolphp
lfairy
d3cktr2
<|sols|><|sot|>json_encode(['color' => '1e3678']) === false<|eot|><|sol|>https://3v4l.org/aHt34<|eol|><|sor|>I'm guessing 1e3768 is interpreted as an out-of-range double, which triggers an error in the JSON encoder?<|eor|><|eols|><|endoftext|>
24
lolphp
the_alias_of_andrea
d3cpwv1
<|sols|><|sot|>json_encode(['color' => '1e3678']) === false<|eot|><|sol|>https://3v4l.org/aHt34<|eol|><|sor|>Title is misleading. Yes, it ~~produces~~ produced an error given that string if you ~~tell~~ told it that strings like it should be converted to numbers with a flag. ~~That's not~~ That wasn't the default behaviour. EDIT: Looking at the versions this occurs in, this seems to be a bug *that has been fixed*.<|eor|><|eols|><|endoftext|>
23
lolphp
bart2019
d3d36m5
<|sols|><|sot|>json_encode(['color' => '1e3678']) === false<|eot|><|sol|>https://3v4l.org/aHt34<|eol|><|sor|>I'm guessing 1e3768 is interpreted as an out-of-range double, which triggers an error in the JSON encoder?<|eor|><|sor|>Yep: https://github.com/php/php-src/blob/4ed24e1e18a5546aa68b641cb8081233ec27ebd4/ext/json/json.c#L425-L428 Instead of falling back to encoding a string, someone made it produce an error. Weird. Now it falls back as it should: https://github.com/php/php-src/blob/95ed19ae28009aa7b3ed42d5760478de82640560/ext/json/json.c#L422-L428<|eor|><|sor|>It's a string. It should not "fall back" on encoding it as a string, it should *always* treat it as a string. Because the source does not contain a floating point value; it contains a string.<|eor|><|eols|><|endoftext|>
23
lolphp
the_alias_of_andrea
d3cv83f
<|sols|><|sot|>json_encode(['color' => '1e3678']) === false<|eot|><|sol|>https://3v4l.org/aHt34<|eol|><|sor|>I'm guessing 1e3768 is interpreted as an out-of-range double, which triggers an error in the JSON encoder?<|eor|><|sor|>Yep: https://github.com/php/php-src/blob/4ed24e1e18a5546aa68b641cb8081233ec27ebd4/ext/json/json.c#L425-L428 Instead of falling back to encoding a string, someone made it produce an error. Weird. Now it falls back as it should: https://github.com/php/php-src/blob/95ed19ae28009aa7b3ed42d5760478de82640560/ext/json/json.c#L422-L428<|eor|><|eols|><|endoftext|>
12
lolphp
kauffj
d3dd7cj
<|sols|><|sot|>json_encode(['color' => '1e3678']) === false<|eot|><|sol|>https://3v4l.org/aHt34<|eol|><|sor|>Title is misleading. Yes, it ~~produces~~ produced an error given that string if you ~~tell~~ told it that strings like it should be converted to numbers with a flag. ~~That's not~~ That wasn't the default behaviour. EDIT: Looking at the versions this occurs in, this seems to be a bug *that has been fixed*.<|eor|><|soopr|>Didn't intend to mislead, just to keep the title shorter. JSON\_NUMERIC\_CHECK is supposed to convert '17' to 17, choking on a string that happens to match scientific notation, _and silently failing_, is a pretty lolphp behavior.<|eoopr|><|eols|><|endoftext|>
5
lolphp
the_alias_of_andrea
d3eajeo
<|sols|><|sot|>json_encode(['color' => '1e3678']) === false<|eot|><|sol|>https://3v4l.org/aHt34<|eol|><|sor|>I'm guessing 1e3768 is interpreted as an out-of-range double, which triggers an error in the JSON encoder?<|eor|><|sor|>Yep: https://github.com/php/php-src/blob/4ed24e1e18a5546aa68b641cb8081233ec27ebd4/ext/json/json.c#L425-L428 Instead of falling back to encoding a string, someone made it produce an error. Weird. Now it falls back as it should: https://github.com/php/php-src/blob/95ed19ae28009aa7b3ed42d5760478de82640560/ext/json/json.c#L422-L428<|eor|><|sor|>It's a string. It should not "fall back" on encoding it as a string, it should *always* treat it as a string. Because the source does not contain a floating point value; it contains a string.<|eor|><|sor|>Huh? The whole point of the JSON_NUMERIC_CHECK flag is to do this conversion! `json_encode` doesn't do that by default. Why are you complaining about the flag doing its job?<|eor|><|eols|><|endoftext|>
5
lolphp
vytah
d3en6hv
<|sols|><|sot|>json_encode(['color' => '1e3678']) === false<|eot|><|sol|>https://3v4l.org/aHt34<|eol|><|sor|>Title is misleading. Yes, it ~~produces~~ produced an error given that string if you ~~tell~~ told it that strings like it should be converted to numbers with a flag. ~~That's not~~ That wasn't the default behaviour. EDIT: Looking at the versions this occurs in, this seems to be a bug *that has been fixed*.<|eor|><|soopr|>Didn't intend to mislead, just to keep the title shorter. JSON\_NUMERIC\_CHECK is supposed to convert '17' to 17, choking on a string that happens to match scientific notation, _and silently failing_, is a pretty lolphp behavior.<|eoopr|><|sor|>I'm not sure I see the lolphp. Realize that JSON explicitly does not support floating point Inf and NaN. You are asking it to convert numeric strings to numbers and encode those. The conversion from string to number resulted in a number that happens to be not representable in JSON, so you get a failure. The new behavior where the conversion to number does not happen if the result is unrepresentable is more useful, but I don't think the original was particularly unreasonable either.<|eor|><|sor|>1e3678 is perfectly representable in JSON as 1e3678. There's nothing in the JSON specification that limits the range of numbers.<|eor|><|eols|><|endoftext|>
5