subreddit
stringclasses
7 values
author
stringlengths
3
20
id
stringlengths
5
7
content
stringlengths
67
30.4k
score
int64
0
140k
lolphp
barubary
cfvpg6q
<|soss|><|sot|>PHP Dereferencing<|eot|><|sost|>In PHP 5.4 this would break: echo array(1, 2, 3)[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 Luckily, they added "dereferencing" in PHP 5.5 which would solve it! Hurray! And sure enough, it works! However, the fix isn't very clever, because this will break in 5.5: echo (array(1, 2, 3))[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 That's a little embarrassing.<|eost|><|sor|>I'm not sure why you'd expect that to work, exactly.<|eor|><|sor|>Because there's no reason for it not to? I just checked. The trivial translation works as expected in Python, Perl, Ruby, OCaml, and Javascript; that's all the non-PHP languages with dedicated indexing syntax and array literals I have ready access to. These languages all make it work by doing *nothing in particular*; the array literal is an expression, and since expressions might result in things that can be indexed a sane grammar will accommodate that. Sure some particular example might be nonsense semantically, but the parser shouldn't care about that.<|eor|><|sor|>Can you do it in asm? Haskell, C, C#, F#? I don't know why because it would work in some other language you'd expect it to in another. EDIT: the downvotes are hilarious, lolphp truly is full of amateurs. <|eor|><|sor|>Asm doesn't have array literals or indexing syntax. Or expressions, really. Haskell? Of course: main = do print $ [1, 2, 3] !! 0 print $ ([1, 2, 3]) !! 0 C also works fine: #include <stdio.h> int main(void) { printf("%d\n", (int []){1, 2, 3}[0]); printf("%d\n", ((int []){1, 2, 3})[0]); return 0; } I don't know C# or F# but based on what I know about Java and OCaml they won't have any issues either. <|eor|><|eoss|><|endoftext|>
10
lolphp
skeeto
cfvcbxm
<|soss|><|sot|>PHP Dereferencing<|eot|><|sost|>In PHP 5.4 this would break: echo array(1, 2, 3)[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 Luckily, they added "dereferencing" in PHP 5.5 which would solve it! Hurray! And sure enough, it works! However, the fix isn't very clever, because this will break in 5.5: echo (array(1, 2, 3))[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 That's a little embarrassing.<|eost|><|sor|>php is, by default, dynamically compiled on every execution. since this impacts response time, the compiler only does a single pass. between over a decade of legacy cruft, and the unusual single pass compiler, these sorts of issues are unavoidable. this is pretty well documented in some feature specs the developers have published.<|eor|><|sor|>This is a syntax error so the compiler hasn't even gotten to it yet. The parser isn't properly recursive. This exact issue is one of my favorite Matlab language design mistakes, too. <|eor|><|eoss|><|endoftext|>
9
lolphp
allthediamonds
cfwbunv
<|soss|><|sot|>PHP Dereferencing<|eot|><|sost|>In PHP 5.4 this would break: echo array(1, 2, 3)[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 Luckily, they added "dereferencing" in PHP 5.5 which would solve it! Hurray! And sure enough, it works! However, the fix isn't very clever, because this will break in 5.5: echo (array(1, 2, 3))[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 That's a little embarrassing.<|eost|><|sor|>Judging by its behaviour, there seems to be a pattern in the design of the php "parser" of not re-using syntax where similar functionality is needed. In this case, it seems to me that they used to parse array indexing with a rule like "$<variable>[<expression>]", and they just added another case "<function>(<arguments>)[<expression>]" alongside it. Doing It Right would've been staying at a single rule, just making it "<expression>[<expression>]". But when does PHP ever do the right thing? See also -- the addition of "foreach (... as list(...))" in 5.5, among others.<|eor|><|sor|>From what I understand the lexing, parsing and bytecode emitting in php is an intertwined mess.<|eor|><|sor|>PHP is built the same way that a majority of PHP sites are built?<|eor|><|sor|>This is what happens when you let PHP developers read about homoiconicity.<|eor|><|eoss|><|endoftext|>
9
lolphp
merreborn
cfv5a1s
<|soss|><|sot|>PHP Dereferencing<|eot|><|sost|>In PHP 5.4 this would break: echo array(1, 2, 3)[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 Luckily, they added "dereferencing" in PHP 5.5 which would solve it! Hurray! And sure enough, it works! However, the fix isn't very clever, because this will break in 5.5: echo (array(1, 2, 3))[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 That's a little embarrassing.<|eost|><|sor|>php is, by default, dynamically compiled on every execution. since this impacts response time, the compiler only does a single pass. between over a decade of legacy cruft, and the unusual single pass compiler, these sorts of issues are unavoidable. this is pretty well documented in some feature specs the developers have published.<|eor|><|eoss|><|endoftext|>
8
lolphp
Dereleased
cfvpui0
<|soss|><|sot|>PHP Dereferencing<|eot|><|sost|>In PHP 5.4 this would break: echo array(1, 2, 3)[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 Luckily, they added "dereferencing" in PHP 5.5 which would solve it! Hurray! And sure enough, it works! However, the fix isn't very clever, because this will break in 5.5: echo (array(1, 2, 3))[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 That's a little embarrassing.<|eost|><|sor|>Judging by its behaviour, there seems to be a pattern in the design of the php "parser" of not re-using syntax where similar functionality is needed. In this case, it seems to me that they used to parse array indexing with a rule like "$<variable>[<expression>]", and they just added another case "<function>(<arguments>)[<expression>]" alongside it. Doing It Right would've been staying at a single rule, just making it "<expression>[<expression>]". But when does PHP ever do the right thing? See also -- the addition of "foreach (... as list(...))" in 5.5, among others.<|eor|><|sor|>But it doesn't lex to T_STRING, it lexes to T_ARRAY! ...wait, that's not better.<|eor|><|eoss|><|endoftext|>
7
lolphp
BufferUnderpants
cfyfi8d
<|soss|><|sot|>PHP Dereferencing<|eot|><|sost|>In PHP 5.4 this would break: echo array(1, 2, 3)[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 Luckily, they added "dereferencing" in PHP 5.5 which would solve it! Hurray! And sure enough, it works! However, the fix isn't very clever, because this will break in 5.5: echo (array(1, 2, 3))[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 That's a little embarrassing.<|eost|><|sor|>I'm not sure why you'd expect that to work, exactly.<|eor|><|sor|>Because there's no reason for it not to? I just checked. The trivial translation works as expected in Python, Perl, Ruby, OCaml, and Javascript; that's all the non-PHP languages with dedicated indexing syntax and array literals I have ready access to. These languages all make it work by doing *nothing in particular*; the array literal is an expression, and since expressions might result in things that can be indexed a sane grammar will accommodate that. Sure some particular example might be nonsense semantically, but the parser shouldn't care about that.<|eor|><|sor|>Can you do it in asm? Haskell, C, C#, F#? I don't know why because it would work in some other language you'd expect it to in another. EDIT: the downvotes are hilarious, lolphp truly is full of amateurs. <|eor|><|sor|>Because it's an obvious, grating and completely unnecessary violation of referential transparency that anyone with half a brain wouldn't even think to introduce in the first place? Seriously, why *wouldn't* I be able to perform an array-operation on an array?!<|eor|><|eoss|><|endoftext|>
7
lolphp
Sarcastinator
cfvqcdf
<|soss|><|sot|>PHP Dereferencing<|eot|><|sost|>In PHP 5.4 this would break: echo array(1, 2, 3)[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 Luckily, they added "dereferencing" in PHP 5.5 which would solve it! Hurray! And sure enough, it works! However, the fix isn't very clever, because this will break in 5.5: echo (array(1, 2, 3))[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 That's a little embarrassing.<|eost|><|sor|>I'm not sure why you'd expect that to work, exactly.<|eor|><|sor|>Because there's no reason for it not to? I just checked. The trivial translation works as expected in Python, Perl, Ruby, OCaml, and Javascript; that's all the non-PHP languages with dedicated indexing syntax and array literals I have ready access to. These languages all make it work by doing *nothing in particular*; the array literal is an expression, and since expressions might result in things that can be indexed a sane grammar will accommodate that. Sure some particular example might be nonsense semantically, but the parser shouldn't care about that.<|eor|><|sor|>Can you do it in asm? Haskell, C, C#, F#? I don't know why because it would work in some other language you'd expect it to in another. EDIT: the downvotes are hilarious, lolphp truly is full of amateurs. <|eor|><|sor|>Asm doesn't have array literals or indexing syntax. Or expressions, really. Haskell? Of course: main = do print $ [1, 2, 3] !! 0 print $ ([1, 2, 3]) !! 0 C also works fine: #include <stdio.h> int main(void) { printf("%d\n", (int []){1, 2, 3}[0]); printf("%d\n", ((int []){1, 2, 3})[0]); return 0; } I don't know C# or F# but based on what I know about Java and OCaml they won't have any issues either. <|eor|><|soopr|>It works in C# as well using System.IO; using System; class Program { static int[] Array(params int[] array) { return array; } static void Main() { Console.WriteLine(new [] {1, 2, 3}[0]); Console.WriteLine((new [] {1, 2, 3})[0]); Console.WriteLine(Array(1, 2, 3)[0]); Console.WriteLine((Array(1, 2, 3))[0]); } } Returns 1 1 1 1 It works in F# as well: let value1 = [| 1; 2; 3; |].[0] let value2 = ([| 1; 2; 3; |]).[0] let array = [| 1; 2; 3; |] let fvalue1 = array.[0] let fvalue2 = (array).[0] All values are 1. No parse error. By extension I would think this would work in OCaml as well since F# is heavily OCaml based.<|eoopr|><|eoss|><|endoftext|>
7
lolphp
nikic
cfvfzym
<|soss|><|sot|>PHP Dereferencing<|eot|><|sost|>In PHP 5.4 this would break: echo array(1, 2, 3)[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 Luckily, they added "dereferencing" in PHP 5.5 which would solve it! Hurray! And sure enough, it works! However, the fix isn't very clever, because this will break in 5.5: echo (array(1, 2, 3))[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 That's a little embarrassing.<|eost|><|sor|>Judging by its behaviour, there seems to be a pattern in the design of the php "parser" of not re-using syntax where similar functionality is needed. In this case, it seems to me that they used to parse array indexing with a rule like "$<variable>[<expression>]", and they just added another case "<function>(<arguments>)[<expression>]" alongside it. Doing It Right would've been staying at a single rule, just making it "<expression>[<expression>]". But when does PHP ever do the right thing? See also -- the addition of "foreach (... as list(...))" in 5.5, among others.<|eor|><|sor|>From what I understand the lexing, parsing and bytecode emitting in php is an intertwined mess.<|eor|><|sor|>The lexing and parsing are strictly separate. Parsing and bytecode emission are intermixed. I.e. the parser calls the bytecode emitting routines.<|eor|><|eoss|><|endoftext|>
6
lolphp
poloppoyop
cfvralu
<|soss|><|sot|>PHP Dereferencing<|eot|><|sost|>In PHP 5.4 this would break: echo array(1, 2, 3)[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 Luckily, they added "dereferencing" in PHP 5.5 which would solve it! Hurray! And sure enough, it works! However, the fix isn't very clever, because this will break in 5.5: echo (array(1, 2, 3))[0] With the message Parse error: syntax error, unexpected '[', expecting ',' or ';' in [...][...] on line 1 That's a little embarrassing.<|eost|><|sor|>Even if echo is a language construct it can be used with parenthesis. Too bad the documention does not document in which cases echo can not be used as a function. <|eor|><|eoss|><|endoftext|>
5
lolphp
masklinn
1lvh3u
<|sols|><|sot|>Antonio Ferrara gives up on improving PHP<|eot|><|sol|>http://blog.ircmaxell.com/2013/09/rambling-on-internals.html#comment-form<|eol|><|eols|><|endoftext|>
78
lolphp
infinull
cc3cw7s
<|sols|><|sot|>Antonio Ferrara gives up on improving PHP<|eot|><|sol|>http://blog.ircmaxell.com/2013/09/rambling-on-internals.html#comment-form<|eol|><|sor|>That sounds like about any open source project ever. Try suggesting a non-technical fix (e.g. usability or documentation issues) to any open source project, and you will be met by the same kind of people.<|eor|><|sor|>Python for example has a fair amount of bikeshedding, but the other problems listed not so much: FUD, (Fear, Uncertainty, and Doubt), ignorance, lack of direction etc. When you submit a PEP (Python Enhancement Proposal, essentially an RFC for Python)... it's debated vigorously, etc, but the level of toxicity is limited. Guido (Python's BDFL) gets veto power, but respects the community and provides vision, and it sounds like the core maintainers of PHP don't do that.<|eor|><|eols|><|endoftext|>
18
lolphp
n1c0_ds
cc3chcs
<|sols|><|sot|>Antonio Ferrara gives up on improving PHP<|eot|><|sol|>http://blog.ircmaxell.com/2013/09/rambling-on-internals.html#comment-form<|eol|><|sor|>That sounds like about any open source project ever. Try suggesting a non-technical fix (e.g. usability or documentation issues) to any open source project, and you will be met by the same kind of people.<|eor|><|eols|><|endoftext|>
12
lolphp
xiongchiamiov
cc3mb66
<|sols|><|sot|>Antonio Ferrara gives up on improving PHP<|eot|><|sol|>http://blog.ircmaxell.com/2013/09/rambling-on-internals.html#comment-form<|eol|><|sor|>That sounds like about any open source project ever. Try suggesting a non-technical fix (e.g. usability or documentation issues) to any open source project, and you will be met by the same kind of people.<|eor|><|sor|>Python for example has a fair amount of bikeshedding, but the other problems listed not so much: FUD, (Fear, Uncertainty, and Doubt), ignorance, lack of direction etc. When you submit a PEP (Python Enhancement Proposal, essentially an RFC for Python)... it's debated vigorously, etc, but the level of toxicity is limited. Guido (Python's BDFL) gets veto power, but respects the community and provides vision, and it sounds like the core maintainers of PHP don't do that.<|eor|><|sor|>There is no vision behind PHP whatsoever, which is why it's such a damned inconsistent language - things got put it just because someone thought of it. I can't find it, but my boss tells me he saw a video of a talk Rasmus was giving about PHP in the early days where someone suggested a feature and he hacked it out on stage. **That** is how much thought is generally put into PHP's design, and why it's having so many issues now that it's grown up a bit.<|eor|><|eols|><|endoftext|>
12
lolphp
xiongchiamiov
cc3mci0
<|sols|><|sot|>Antonio Ferrara gives up on improving PHP<|eot|><|sol|>http://blog.ircmaxell.com/2013/09/rambling-on-internals.html#comment-form<|eol|><|sor|>It's really a shame. I saw a noticeable increase in PHP's quality over this last year, due primarily to the work he and [laruence](https://github.com/laruence) have been doing. This sort of departure is rarely felt by the end-users, but in this case it will be.<|eor|><|eols|><|endoftext|>
7
lolphp
notR1CH
1fb17y
<|sols|><|sot|>The Singapore timezone (SGT) in strtotime has been broken for over 5 years.<|eot|><|sol|>https://bugs.php.net/bug.php?id=45081<|eol|><|eols|><|endoftext|>
80
lolphp
notR1CH
ca8i33p
<|sols|><|sot|>The Singapore timezone (SGT) in strtotime has been broken for over 5 years.<|eot|><|sol|>https://bugs.php.net/bug.php?id=45081<|eol|><|soopr|>There's no way to fix this by updating the timezone database, since the offsets are hard coded in timezonemap.h. SGT / Asia/Singapore seems to be specified twice with different offsets for some reason. typedef struct _timelib_tz_lookup_table { char *name; int type; float gmtoffset; char *full_tz_name; } timelib_tz_lookup_table; ... { "sgt", 0, 27000, "Asia/Singapore" }, { "sgt", 0, 28800, "Asia/Singapore" }, { "sgt", 0, 27000, "Singapore" }, <|eoopr|><|eols|><|endoftext|>
24
lolphp
frezik
ca8wpis
<|sols|><|sot|>The Singapore timezone (SGT) in strtotime has been broken for over 5 years.<|eot|><|sol|>https://bugs.php.net/bug.php?id=45081<|eol|><|soopr|>There's no way to fix this by updating the timezone database, since the offsets are hard coded in timezonemap.h. SGT / Asia/Singapore seems to be specified twice with different offsets for some reason. typedef struct _timelib_tz_lookup_table { char *name; int type; float gmtoffset; char *full_tz_name; } timelib_tz_lookup_table; ... { "sgt", 0, 27000, "Asia/Singapore" }, { "sgt", 0, 28800, "Asia/Singapore" }, { "sgt", 0, 27000, "Singapore" }, <|eoopr|><|sor|>So the fix is literally to delete one redundant line?<|eor|><|eols|><|endoftext|>
15
lolphp
jiwari
ca99kw2
<|sols|><|sot|>The Singapore timezone (SGT) in strtotime has been broken for over 5 years.<|eot|><|sol|>https://bugs.php.net/bug.php?id=45081<|eol|><|soopr|>There's no way to fix this by updating the timezone database, since the offsets are hard coded in timezonemap.h. SGT / Asia/Singapore seems to be specified twice with different offsets for some reason. typedef struct _timelib_tz_lookup_table { char *name; int type; float gmtoffset; char *full_tz_name; } timelib_tz_lookup_table; ... { "sgt", 0, 27000, "Asia/Singapore" }, { "sgt", 0, 28800, "Asia/Singapore" }, { "sgt", 0, 27000, "Singapore" }, <|eoopr|><|sor|>So the fix is literally to delete one redundant line?<|eor|><|soopr|>It appears so.<|eoopr|><|sor|>sadness<|eor|><|eols|><|endoftext|>
7
lolphp
notR1CH
ca9743t
<|sols|><|sot|>The Singapore timezone (SGT) in strtotime has been broken for over 5 years.<|eot|><|sol|>https://bugs.php.net/bug.php?id=45081<|eol|><|soopr|>There's no way to fix this by updating the timezone database, since the offsets are hard coded in timezonemap.h. SGT / Asia/Singapore seems to be specified twice with different offsets for some reason. typedef struct _timelib_tz_lookup_table { char *name; int type; float gmtoffset; char *full_tz_name; } timelib_tz_lookup_table; ... { "sgt", 0, 27000, "Asia/Singapore" }, { "sgt", 0, 28800, "Asia/Singapore" }, { "sgt", 0, 27000, "Singapore" }, <|eoopr|><|sor|>So the fix is literally to delete one redundant line?<|eor|><|soopr|>It appears so.<|eoopr|><|eols|><|endoftext|>
5
lolphp
ThisIsADogHello
28oolu
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|eols|><|endoftext|>
78
lolphp
sloat
cicyj25
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Wordpress and the wordpress ecosystem (plugins, themes, etc.) could be a lol-subreddit unto itself. For example, they somehow managed to get it to not be able to work correctly with any web server except Apache httpd. That's like writing a Java program that will only run on Windows. (Maybe it's gotten better since I last tried it. But I do remember lots of pain when I had a client who wanted WP and I tried nginx. There was a plugin involved and some horrifying configuration done.)<|eor|><|eols|><|endoftext|>
52
lolphp
merreborn
cid1yka
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Wordpress and the wordpress ecosystem (plugins, themes, etc.) could be a lol-subreddit unto itself. For example, they somehow managed to get it to not be able to work correctly with any web server except Apache httpd. That's like writing a Java program that will only run on Windows. (Maybe it's gotten better since I last tried it. But I do remember lots of pain when I had a client who wanted WP and I tried nginx. There was a plugin involved and some horrifying configuration done.)<|eor|><|sor|>Working with wordpress is miserable. Working with vBulletin is 10 times worse. I've written plugins for both. Wordpress documents every one of their plugin hooks. vBulletin has hundreds of plugin hooks; not a single one of them is documented; the hook system is implemented via eval() calls (one per hook); and it stores large blocks of PHP code in PHP variables -- which are then of course evaluated with eval(). Oh, and the template system is also eval() based. I could go on...<|eor|><|eols|><|endoftext|>
36
lolphp
ThisIsADogHello
cicy33q
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Holy shit. I refuse to believe someone did this without having a good reason to that isn't immediately obvious.<|eor|><|soopr|>On some systems, getting a decent source of random numbers can be difficult. Linux lets you use urandom before the RNG is initialised, or embedded systems or VMs may not have sources of entropy. Worse, maybe an attacker replaced /dev/random or urandom with /dev/zero. Also, pretty much all the cryptography libraries in PHP are shit. Therefore, the only safe way to get random numbers is to get some guaranteed-to-be-random numbers from WordPress, a group well known for their attention to detail when it comes to handling anything involving security! /s At least it's HTTPS, I guess. Does anyone know if the libraries used will at least check HTTPS certs?<|eoopr|><|eols|><|endoftext|>
23
lolphp
bart2019
cid757i
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Wordpress and the wordpress ecosystem (plugins, themes, etc.) could be a lol-subreddit unto itself. For example, they somehow managed to get it to not be able to work correctly with any web server except Apache httpd. That's like writing a Java program that will only run on Windows. (Maybe it's gotten better since I last tried it. But I do remember lots of pain when I had a client who wanted WP and I tried nginx. There was a plugin involved and some horrifying configuration done.)<|eor|><|sor|>> Wordpress and the wordpress ecosystem (plugins, themes, etc.) could be a lol-subreddit unto itself. What's SO FUCKING HARD about pseudo-random generation? I have a project I'm working on where I'm deploying bulk wordpress sites via puppet. A part of the code is a perl script to generate wp-config files. my $wp_auth_key = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_secure_auth_key = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_logged_in_key = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_nonce_key = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_auth_salt = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_secure_auth_salt = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_logged_in_salt = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_nonce_salt = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; It spits out something like this: wp_auth_key => "XY9hvvWVdc2wRfIwOpPVEkjt7iUkqpEbxMn6qGmE8v8yCHqf5a4e8E87Bw22nb6A", wp_secure_auth_key => "cMvvspVS5ki597ODVhFFtRmPylDFWcM1ne4qYViNYIYfmLe8OGLfG3IKoNgpgJPT", wp_logged_in_key => "plCOR6kuuGfnEc5EB6UdGsf9JqMPctM4ADyCejnWWPuSDFmtzmgcQv4oXtVRx1WI", wp_nonce_key => "PdtfoYcOn3suzQi3sJV0JbYJKgxsaF2dJv4DaHSCMOesXSLs34SeR0uXnkVpK1W1", wp_auth_salt => "jJDLvfuKrhH7MCTyOSNCFdFSUSVRiYVD8PYQx7QPq6Rr4vAPWcCmhGiIwRgVcsNf", wp_secure_auth_salt => "2k4RMQJUl6DT9f08AtYUMV2ihsj0hsFGfr6OQWs4WyxhZq0Yr9lS8UNYkelfgZv5", wp_logged_in_salt => "gbdnoFQMhjPZoPKzvj8qw16KvwcG8frJZJydudtCCGx8kA0Db4lJxGHLdCju6DND", wp_nonce_salt => "ARfE5ZoZN2X4ZjNWzUj0Bb84WggXq7LoExw6e83Vr73UZGEwbR1rngDWPJGBEo4G", *don't worry I'm blitzing that site in a bit anyway, shit takes work* This is NOT HARD to do correctly. Sourcing my secure constants off wordpress.org is NOT GONNA FUCKING HAPPEN. Also, wordpress, please for the love of god upgrade to git so I don't have to do some fucking abomination of a script to keep plugins updated because I can't just pull "latest" like I can with git because you keep fucking using svn. > (Maybe it's gotten better since I last tried it. But I do remember lots of pain when I had a client who wanted WP and I tried nginx. There was a plugin involved and some horrifying configuration done.) Yeah nginx + wordpress is "a special snowflake". I have to do a lot of custom shit b/c wordpress relies on httpd mod_rewrite. nginx::resource::vhost { "$domain": ensure => "present", listen_port => "80", www_root => "/var/www/domains/$domain", index_files => [ "index.php" ], try_files => [ "\$uri", "\$uri/", "/index.php?\$args" ], } nginx::resource::location { "${domain}_php": ensure => "present", www_root => "/var/www/domains/$domain", vhost => $domain, location => "~ \.php$", index_files => [ "index.php" ], fastcgi => "127.0.0.1:9000", fastcgi_script => undef, location_cfg_append => { fastcgi_connect_timeout => '3m', fastcgi_read_timeout => '3m', fastcgi_send_timeout => '3m' } } <|eor|><|sor|>> This is NOT HARD to do correctly. Oh yes it is. At least f you want to do it in a cryptographically secure way. rand() just isn't random enough.<|eor|><|eols|><|endoftext|>
19
lolphp
chrismsnz
cid0ul4
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Holy shit. I refuse to believe someone did this without having a good reason to that isn't immediately obvious.<|eor|><|soopr|>On some systems, getting a decent source of random numbers can be difficult. Linux lets you use urandom before the RNG is initialised, or embedded systems or VMs may not have sources of entropy. Worse, maybe an attacker replaced /dev/random or urandom with /dev/zero. Also, pretty much all the cryptography libraries in PHP are shit. Therefore, the only safe way to get random numbers is to get some guaranteed-to-be-random numbers from WordPress, a group well known for their attention to detail when it comes to handling anything involving security! /s At least it's HTTPS, I guess. Does anyone know if the libraries used will at least check HTTPS certs?<|eoopr|><|sor|>Sure it's https, but if the system has unreliable rng the how 's' is https?<|eor|><|eols|><|endoftext|>
19
lolphp
n42
cicxubs
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Holy shit. I refuse to believe someone did this without having a good reason to that isn't immediately obvious.<|eor|><|eols|><|endoftext|>
15
lolphp
rukestisak
cid81hg
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Wordpress and the wordpress ecosystem (plugins, themes, etc.) could be a lol-subreddit unto itself. For example, they somehow managed to get it to not be able to work correctly with any web server except Apache httpd. That's like writing a Java program that will only run on Windows. (Maybe it's gotten better since I last tried it. But I do remember lots of pain when I had a client who wanted WP and I tried nginx. There was a plugin involved and some horrifying configuration done.)<|eor|><|sor|>Working with wordpress is miserable. Working with vBulletin is 10 times worse. I've written plugins for both. Wordpress documents every one of their plugin hooks. vBulletin has hundreds of plugin hooks; not a single one of them is documented; the hook system is implemented via eval() calls (one per hook); and it stores large blocks of PHP code in PHP variables -- which are then of course evaluated with eval(). Oh, and the template system is also eval() based. I could go on...<|eor|><|sor|>I came to WordPress from Joomla around 2009, and man did that feel like a breath of fresh air. WordPress had everything documented (unlike Joomla where I had to mostly rely on forums) and it was just easier to work with and develop, not to mention the admin area looked much more user friendly. I realize WP has its problems but I don't think it deserves the amount of hate people give it.<|eor|><|eols|><|endoftext|>
15
lolphp
gu3st12
cid2xpa
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>The real WTF is WordPress.<|eor|><|eols|><|endoftext|>
13
lolphp
sstewartgallus
cid1jt1
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Holy shit. I refuse to believe someone did this without having a good reason to that isn't immediately obvious.<|eor|><|soopr|>On some systems, getting a decent source of random numbers can be difficult. Linux lets you use urandom before the RNG is initialised, or embedded systems or VMs may not have sources of entropy. Worse, maybe an attacker replaced /dev/random or urandom with /dev/zero. Also, pretty much all the cryptography libraries in PHP are shit. Therefore, the only safe way to get random numbers is to get some guaranteed-to-be-random numbers from WordPress, a group well known for their attention to detail when it comes to handling anything involving security! /s At least it's HTTPS, I guess. Does anyone know if the libraries used will at least check HTTPS certs?<|eoopr|><|sor|>Replacing `/dev/random` with `/dev/zero` is a feature not a bug. Replacing `/dev/random` with your own custom source lets one run a program dependant on `/dev/random` deterministicly (as long as other sources of nondeterminism aren't involved) and if anyone has the permissions to change `/dev/random` then they can do already far worse attacks. I will agree that a lot of crypto libraries in PHP are shit though. Personally, I'd make this a configurable parameter so that people can host their own random number services.<|eor|><|eols|><|endoftext|>
13
lolphp
minivanmegafun
cid1ik6
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Wordpress and the wordpress ecosystem (plugins, themes, etc.) could be a lol-subreddit unto itself. For example, they somehow managed to get it to not be able to work correctly with any web server except Apache httpd. That's like writing a Java program that will only run on Windows. (Maybe it's gotten better since I last tried it. But I do remember lots of pain when I had a client who wanted WP and I tried nginx. There was a plugin involved and some horrifying configuration done.)<|eor|><|sor|>Ugh. I sure hope it's gotten better, my weekend project is getting that piece of shit running under nginx, chrooted with php-fpm, on SELinux, with mod_security running in front of the whole thing. More or less keeping it in its own sandbox as well as can be done. /adds "bottle of scotch" to shopping list<|eor|><|eols|><|endoftext|>
11
lolphp
hfern
cid1qys
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>I cannot actually believe someone could write that... Much less get it accepted into such a well used app. What the actual fuck....<|eor|><|eols|><|endoftext|>
7
lolphp
merreborn
cid23s0
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Found the original commit and the relevant ticket https://github.com/WordPress/WordPress/commit/a8e393c607e1f8d7f3f1c56ea0db0a2fcfee371c https://core.trac.wordpress.org/ticket/12159 I'm no closer to understanding the reasoning here. The switch statement around line 200 of setup-config.php in this revision is also thoroughly disgusting. This is where the whole "generate secret keys from a url" concept is introduced: https://github.com/WordPress/WordPress/commit/03a9269b113f2a3fbe30eddf395e90612bec1cd5 The fact that it defaulted to a completely non-random secret key before that commit is pretty heinous<|eor|><|eols|><|endoftext|>
7
lolphp
cbraga
cidgr4t
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Wordpress and the wordpress ecosystem (plugins, themes, etc.) could be a lol-subreddit unto itself. For example, they somehow managed to get it to not be able to work correctly with any web server except Apache httpd. That's like writing a Java program that will only run on Windows. (Maybe it's gotten better since I last tried it. But I do remember lots of pain when I had a client who wanted WP and I tried nginx. There was a plugin involved and some horrifying configuration done.)<|eor|><|sor|>> Wordpress and the wordpress ecosystem (plugins, themes, etc.) could be a lol-subreddit unto itself. What's SO FUCKING HARD about pseudo-random generation? I have a project I'm working on where I'm deploying bulk wordpress sites via puppet. A part of the code is a perl script to generate wp-config files. my $wp_auth_key = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_secure_auth_key = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_logged_in_key = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_nonce_key = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_auth_salt = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_secure_auth_salt = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_logged_in_salt = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_nonce_salt = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; It spits out something like this: wp_auth_key => "XY9hvvWVdc2wRfIwOpPVEkjt7iUkqpEbxMn6qGmE8v8yCHqf5a4e8E87Bw22nb6A", wp_secure_auth_key => "cMvvspVS5ki597ODVhFFtRmPylDFWcM1ne4qYViNYIYfmLe8OGLfG3IKoNgpgJPT", wp_logged_in_key => "plCOR6kuuGfnEc5EB6UdGsf9JqMPctM4ADyCejnWWPuSDFmtzmgcQv4oXtVRx1WI", wp_nonce_key => "PdtfoYcOn3suzQi3sJV0JbYJKgxsaF2dJv4DaHSCMOesXSLs34SeR0uXnkVpK1W1", wp_auth_salt => "jJDLvfuKrhH7MCTyOSNCFdFSUSVRiYVD8PYQx7QPq6Rr4vAPWcCmhGiIwRgVcsNf", wp_secure_auth_salt => "2k4RMQJUl6DT9f08AtYUMV2ihsj0hsFGfr6OQWs4WyxhZq0Yr9lS8UNYkelfgZv5", wp_logged_in_salt => "gbdnoFQMhjPZoPKzvj8qw16KvwcG8frJZJydudtCCGx8kA0Db4lJxGHLdCju6DND", wp_nonce_salt => "ARfE5ZoZN2X4ZjNWzUj0Bb84WggXq7LoExw6e83Vr73UZGEwbR1rngDWPJGBEo4G", *don't worry I'm blitzing that site in a bit anyway, shit takes work* This is NOT HARD to do correctly. Sourcing my secure constants off wordpress.org is NOT GONNA FUCKING HAPPEN. Also, wordpress, please for the love of god upgrade to git so I don't have to do some fucking abomination of a script to keep plugins updated because I can't just pull "latest" like I can with git because you keep fucking using svn. > (Maybe it's gotten better since I last tried it. But I do remember lots of pain when I had a client who wanted WP and I tried nginx. There was a plugin involved and some horrifying configuration done.) Yeah nginx + wordpress is "a special snowflake". I have to do a lot of custom shit b/c wordpress relies on httpd mod_rewrite. nginx::resource::vhost { "$domain": ensure => "present", listen_port => "80", www_root => "/var/www/domains/$domain", index_files => [ "index.php" ], try_files => [ "\$uri", "\$uri/", "/index.php?\$args" ], } nginx::resource::location { "${domain}_php": ensure => "present", www_root => "/var/www/domains/$domain", vhost => $domain, location => "~ \.php$", index_files => [ "index.php" ], fastcgi => "127.0.0.1:9000", fastcgi_script => undef, location_cfg_append => { fastcgi_connect_timeout => '3m', fastcgi_read_timeout => '3m', fastcgi_send_timeout => '3m' } } <|eor|><|sor|>It hurts looking at your program. @keys = ('wp_auth_key', 'wp_secure_auth_key', 'wp_logged_in_key', 'wp_nonce_key', 'wp_auth_salt', 'wp_secure_auth_salt', 'wp_logged_in_salt', 'wp_logged_in_salt'); print ($_, ' => "', join ('', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64), "\",\n") foreach (@keys); <|eor|><|eols|><|endoftext|>
7
lolphp
poizan42
cid8qk3
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Holy shit. I refuse to believe someone did this without having a good reason to that isn't immediately obvious.<|eor|><|soopr|>On some systems, getting a decent source of random numbers can be difficult. Linux lets you use urandom before the RNG is initialised, or embedded systems or VMs may not have sources of entropy. Worse, maybe an attacker replaced /dev/random or urandom with /dev/zero. Also, pretty much all the cryptography libraries in PHP are shit. Therefore, the only safe way to get random numbers is to get some guaranteed-to-be-random numbers from WordPress, a group well known for their attention to detail when it comes to handling anything involving security! /s At least it's HTTPS, I guess. Does anyone know if the libraries used will at least check HTTPS certs?<|eoopr|><|sor|>> Worse, maybe an attacker replaced /dev/random or urandom with /dev/zero. Yeah, if the attacker has already gained root. Then I think that would be the least of your worries (or as Raymond Chen would say: they are already on the other side of the airtight hatchway)<|eor|><|eols|><|endoftext|>
7
lolphp
captainramen
cid7bvv
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Wordpress and the wordpress ecosystem (plugins, themes, etc.) could be a lol-subreddit unto itself. For example, they somehow managed to get it to not be able to work correctly with any web server except Apache httpd. That's like writing a Java program that will only run on Windows. (Maybe it's gotten better since I last tried it. But I do remember lots of pain when I had a client who wanted WP and I tried nginx. There was a plugin involved and some horrifying configuration done.)<|eor|><|sor|>> Wordpress and the wordpress ecosystem (plugins, themes, etc.) could be a lol-subreddit unto itself. What's SO FUCKING HARD about pseudo-random generation? I have a project I'm working on where I'm deploying bulk wordpress sites via puppet. A part of the code is a perl script to generate wp-config files. my $wp_auth_key = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_secure_auth_key = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_logged_in_key = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_nonce_key = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_auth_salt = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_secure_auth_salt = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_logged_in_salt = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; my $wp_nonce_salt = join'', map +(0..9,'a'..'z','A'..'Z')[rand(10+26*2)], 1..64; It spits out something like this: wp_auth_key => "XY9hvvWVdc2wRfIwOpPVEkjt7iUkqpEbxMn6qGmE8v8yCHqf5a4e8E87Bw22nb6A", wp_secure_auth_key => "cMvvspVS5ki597ODVhFFtRmPylDFWcM1ne4qYViNYIYfmLe8OGLfG3IKoNgpgJPT", wp_logged_in_key => "plCOR6kuuGfnEc5EB6UdGsf9JqMPctM4ADyCejnWWPuSDFmtzmgcQv4oXtVRx1WI", wp_nonce_key => "PdtfoYcOn3suzQi3sJV0JbYJKgxsaF2dJv4DaHSCMOesXSLs34SeR0uXnkVpK1W1", wp_auth_salt => "jJDLvfuKrhH7MCTyOSNCFdFSUSVRiYVD8PYQx7QPq6Rr4vAPWcCmhGiIwRgVcsNf", wp_secure_auth_salt => "2k4RMQJUl6DT9f08AtYUMV2ihsj0hsFGfr6OQWs4WyxhZq0Yr9lS8UNYkelfgZv5", wp_logged_in_salt => "gbdnoFQMhjPZoPKzvj8qw16KvwcG8frJZJydudtCCGx8kA0Db4lJxGHLdCju6DND", wp_nonce_salt => "ARfE5ZoZN2X4ZjNWzUj0Bb84WggXq7LoExw6e83Vr73UZGEwbR1rngDWPJGBEo4G", *don't worry I'm blitzing that site in a bit anyway, shit takes work* This is NOT HARD to do correctly. Sourcing my secure constants off wordpress.org is NOT GONNA FUCKING HAPPEN. Also, wordpress, please for the love of god upgrade to git so I don't have to do some fucking abomination of a script to keep plugins updated because I can't just pull "latest" like I can with git because you keep fucking using svn. > (Maybe it's gotten better since I last tried it. But I do remember lots of pain when I had a client who wanted WP and I tried nginx. There was a plugin involved and some horrifying configuration done.) Yeah nginx + wordpress is "a special snowflake". I have to do a lot of custom shit b/c wordpress relies on httpd mod_rewrite. nginx::resource::vhost { "$domain": ensure => "present", listen_port => "80", www_root => "/var/www/domains/$domain", index_files => [ "index.php" ], try_files => [ "\$uri", "\$uri/", "/index.php?\$args" ], } nginx::resource::location { "${domain}_php": ensure => "present", www_root => "/var/www/domains/$domain", vhost => $domain, location => "~ \.php$", index_files => [ "index.php" ], fastcgi => "127.0.0.1:9000", fastcgi_script => undef, location_cfg_append => { fastcgi_connect_timeout => '3m', fastcgi_read_timeout => '3m', fastcgi_send_timeout => '3m' } } <|eor|><|sor|>> This is NOT HARD to do correctly. Oh yes it is. At least f you want to do it in a cryptographically secure way. rand() just isn't random enough.<|eor|><|sor|>Shell it out? If you need to delegate this then fine, just don't make a **remote call to do so**. What if it were down?<|eor|><|eols|><|endoftext|>
7
lolphp
rcxdude
cidh1gj
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>The response from the server looks like this, define('AUTH_KEY', '0^6:$-+%$,m9,(*>jV$+$76+qY[g))--.}QT@^+c&XR_ x!h5Kd+341@+Ygz{W+;'); define('SECURE_AUTH_KEY', '9J%sK%$H=r]8*64O-KOS70)n?` }wMn1$s`F-h+_LZ@%2eD%w@M:trj:{f3-+Rh1'); define('LOGGED_IN_KEY', 'n/!A#|b6~x6Gtn!=>U)fP rz[evc1p i7:Zs&lr>x-2mde_TGX>bM$3K1Vnt{Zc+'); define('NONCE_KEY', 'j+4r(*XK$R6!w]{X+<V KI#kWy^V)QZCsrud,b`E9B,AnWWG!{l%`Q=-++rcexp3'); define('AUTH_SALT', 'eNvihq?>S`Q#Xw|-v$Okyam,s+@K+ydWT8~}T#SygkZp;hcA_[3rBiPwLUD?UM]y'); define('SECURE_AUTH_SALT', 'HE|o?6|m/-oRMoC+j/;6bdvQ)AkfdtW7@;&vvq,i-dY^6D(AaU3$(KcA49U/~h59'); define('LOGGED_IN_SALT', '+P7~<~ |1fC!=Wr%3|{?XBV]~?.+sQ6(Pue(c tz$C|3bGI)CXL;I/gg|fmOC^Y-'); define('NONCE_SALT', '9zdg-]3|Yu .8,qW=3&B9(w{/~2^[,&ky 1@(J.iwmI*:!VhxNAmq`Si{CMXCkpt'); It's parsed like this, foreach ( $secret_keys as $k => $v ) { $secret_keys[$k] = substr( $v, 28, 64 ); } It's uses `substr` to pull the random data out. However, guessing from the formating (PHP code), I bet the original version of this code just `eval`ed the response from the server, trusting that it won't inject anything nasty. <|eor|><|sor|>Best part is it still assumes that: the random keys are stuck into the generated config file unescaped.<|eor|><|eols|><|endoftext|>
6
lolphp
Breaking-Away
cidgfao
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Wordpress and the wordpress ecosystem (plugins, themes, etc.) could be a lol-subreddit unto itself. For example, they somehow managed to get it to not be able to work correctly with any web server except Apache httpd. That's like writing a Java program that will only run on Windows. (Maybe it's gotten better since I last tried it. But I do remember lots of pain when I had a client who wanted WP and I tried nginx. There was a plugin involved and some horrifying configuration done.)<|eor|><|sor|>Working with wordpress is miserable. Working with vBulletin is 10 times worse. I've written plugins for both. Wordpress documents every one of their plugin hooks. vBulletin has hundreds of plugin hooks; not a single one of them is documented; the hook system is implemented via eval() calls (one per hook); and it stores large blocks of PHP code in PHP variables -- which are then of course evaluated with eval(). Oh, and the template system is also eval() based. I could go on...<|eor|><|sor|>I came to WordPress from Joomla around 2009, and man did that feel like a breath of fresh air. WordPress had everything documented (unlike Joomla where I had to mostly rely on forums) and it was just easier to work with and develop, not to mention the admin area looked much more user friendly. I realize WP has its problems but I don't think it deserves the amount of hate people give it.<|eor|><|sor|>People don't give it hate for its documentation. It's docs are actually amazing. It gets hate for its promotion of really shitty code. That said wordpress is really good at solving it's specific problem set, but as soon as you try to do more with it you're asking for trouble <|eor|><|eols|><|endoftext|>
6
lolphp
X-Istence
cieyeza
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Holy shit. I refuse to believe someone did this without having a good reason to that isn't immediately obvious.<|eor|><|sor|>>without having a good reason to that isn't immediately obvious I think the standard random number generator in PHP has about 32767 different values before it starts repeating, on some platforms. That is 32000 odd different keys possible, for the entire world. <|eor|><|sor|>Addedum: If the openssl library is available inside PHP, this might have been a better choice: [openssl_random_pseudo_bytes](http://www.php.net/manual/en/function.openssl-random-pseudo-bytes.php)<|eor|><|sor|>What's wrong with a `read()` from `/dev/random` or `/dev/urandom` (The latter is preferred)<|eor|><|sor|>It's OK if your system has it. Which excludes Windows.<|eor|><|sor|>Having a separate code path for Windows is much better than downloading data from a URL...<|eor|><|eols|><|endoftext|>
6
lolphp
skeeto
cidcd3j
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>The response from the server looks like this, define('AUTH_KEY', '0^6:$-+%$,m9,(*>jV$+$76+qY[g))--.}QT@^+c&XR_ x!h5Kd+341@+Ygz{W+;'); define('SECURE_AUTH_KEY', '9J%sK%$H=r]8*64O-KOS70)n?` }wMn1$s`F-h+_LZ@%2eD%w@M:trj:{f3-+Rh1'); define('LOGGED_IN_KEY', 'n/!A#|b6~x6Gtn!=>U)fP rz[evc1p i7:Zs&lr>x-2mde_TGX>bM$3K1Vnt{Zc+'); define('NONCE_KEY', 'j+4r(*XK$R6!w]{X+<V KI#kWy^V)QZCsrud,b`E9B,AnWWG!{l%`Q=-++rcexp3'); define('AUTH_SALT', 'eNvihq?>S`Q#Xw|-v$Okyam,s+@K+ydWT8~}T#SygkZp;hcA_[3rBiPwLUD?UM]y'); define('SECURE_AUTH_SALT', 'HE|o?6|m/-oRMoC+j/;6bdvQ)AkfdtW7@;&vvq,i-dY^6D(AaU3$(KcA49U/~h59'); define('LOGGED_IN_SALT', '+P7~<~ |1fC!=Wr%3|{?XBV]~?.+sQ6(Pue(c tz$C|3bGI)CXL;I/gg|fmOC^Y-'); define('NONCE_SALT', '9zdg-]3|Yu .8,qW=3&B9(w{/~2^[,&ky 1@(J.iwmI*:!VhxNAmq`Si{CMXCkpt'); It's parsed like this, foreach ( $secret_keys as $k => $v ) { $secret_keys[$k] = substr( $v, 28, 64 ); } It's uses `substr` to pull the random data out. However, guessing from the formating (PHP code), I bet the original version of this code just `eval`ed the response from the server, trusting that it won't inject anything nasty. <|eor|><|eols|><|endoftext|>
5
lolphp
jsanc623
cid38uh
<|sols|><|sot|>Random number generation in PHP is hard, we'll just download some random numbers<|eot|><|sol|>https://github.com/WordPress/WordPress/blob/fd838ccb2b1d37bda02eecdf09c324863f050812/wp-admin/setup-config.php#L211<|eol|><|sor|>Wordpress and the wordpress ecosystem (plugins, themes, etc.) could be a lol-subreddit unto itself. For example, they somehow managed to get it to not be able to work correctly with any web server except Apache httpd. That's like writing a Java program that will only run on Windows. (Maybe it's gotten better since I last tried it. But I do remember lots of pain when I had a client who wanted WP and I tried nginx. There was a plugin involved and some horrifying configuration done.)<|eor|><|sor|>It plays nice with Nginx now, though there are some (pretty deep) pitfalls and of course the plugins that rely on .htaccess files and demand that they exist. Just have to touch the .htaccess file and add an Nginx config to prevent access to it. <|eor|><|eols|><|endoftext|>
5
lolphp
pilif
9lbf6h
<|sols|><|sot|>Even PHP's developers are stumbling over the lolphp that's the $escape parameter to fputcsv<|eot|><|sol|>https://i.redd.it/ijnqr5hlw5q11.png<|eol|><|eols|><|endoftext|>
80
lolphp
pilif
e75byxn
<|sols|><|sot|>Even PHP's developers are stumbling over the lolphp that's the $escape parameter to fputcsv<|eot|><|sol|>https://i.redd.it/ijnqr5hlw5q11.png<|eol|><|soopr|>source: [https://externals.io/message/103268#103287](https://externals.io/message/103268#103287)<|eoopr|><|eols|><|endoftext|>
8
lolphp
muglug
7joew1
<|sols|><|sot|>(0 > null) is false, (-1 > null) is true<|eot|><|sol|>https://3v4l.org/EfhqW<|eol|><|eols|><|endoftext|>
78
lolphp
dalastboss
dr87hw1
<|sols|><|sot|>(0 > null) is false, (-1 > null) is true<|eot|><|sol|>https://3v4l.org/EfhqW<|eol|><|sor|>Pass garbage in, get garbage out. News at 11.<|eor|><|sor|>If only types were a thing <|eor|><|eols|><|endoftext|>
38
lolphp
mrpaco
dr830so
<|sols|><|sot|>(0 > null) is false, (-1 > null) is true<|eot|><|sol|>https://3v4l.org/EfhqW<|eol|><|sor|>Pass garbage in, get garbage out. News at 11.<|eor|><|eols|><|endoftext|>
22
lolphp
thenickdude
dr8cuq8
<|sols|><|sot|>(0 > null) is false, (-1 > null) is true<|eot|><|sol|>https://3v4l.org/EfhqW<|eol|><|sor|>I guess -1 effectively ends up being coerced into an unsigned integer for the comparison, which makes it huge.<|eor|><|sor|>That doesn't seem likely to me. I'd expect PHP to coerce both sides to booleans or some nonsense like that.<|eor|><|sor|>Oh yep you must be right. Non-zero integers become true and null becomes false, and true > false.<|eor|><|eols|><|endoftext|>
19
lolphp
barubary
dr8cd0f
<|sols|><|sot|>(0 > null) is false, (-1 > null) is true<|eot|><|sol|>https://3v4l.org/EfhqW<|eol|><|sor|>I guess -1 effectively ends up being coerced into an unsigned integer for the comparison, which makes it huge.<|eor|><|sor|>That doesn't seem likely to me. I'd expect PHP to coerce both sides to booleans or some nonsense like that.<|eor|><|eols|><|endoftext|>
17
lolphp
thenickdude
dr89gs9
<|sols|><|sot|>(0 > null) is false, (-1 > null) is true<|eot|><|sol|>https://3v4l.org/EfhqW<|eol|><|sor|>I guess -1 effectively ends up being coerced into an unsigned integer for the comparison, which makes it huge.<|eor|><|eols|><|endoftext|>
14
lolphp
FlyLo11
dr8g47g
<|sols|><|sot|>(0 > null) is false, (-1 > null) is true<|eot|><|sol|>https://3v4l.org/EfhqW<|eol|><|sor|>I guess -1 effectively ends up being coerced into an unsigned integer for the comparison, which makes it huge.<|eor|><|sor|>That doesn't seem likely to me. I'd expect PHP to coerce both sides to booleans or some nonsense like that.<|eor|><|sor|>Sweet, so i can replace stuff like strpos($haystack, $needle) !== false with the shorter version strpos($haystack, $needle) > -1 .. /s<|eor|><|eols|><|endoftext|>
13
lolphp
Takeoded
dr8h4at
<|sols|><|sot|>(0 > null) is false, (-1 > null) is true<|eot|><|sol|>https://3v4l.org/EfhqW<|eol|><|sor|>I guess -1 effectively ends up being coerced into an unsigned integer for the comparison, which makes it huge.<|eor|><|sor|>That doesn't seem likely to me. I'd expect PHP to coerce both sides to booleans or some nonsense like that.<|eor|><|sor|>Sweet, so i can replace stuff like strpos($haystack, $needle) !== false with the shorter version strpos($haystack, $needle) > -1 .. /s<|eor|><|sor|>actually... yes you can!<|eor|><|eols|><|endoftext|>
10
lolphp
Saltub
dr8gwg4
<|sols|><|sot|>(0 > null) is false, (-1 > null) is true<|eot|><|sol|>https://3v4l.org/EfhqW<|eol|><|sor|>I guess -1 effectively ends up being coerced into an unsigned integer for the comparison, which makes it huge.<|eor|><|sor|>> I guess Like most people on this sub. <|eor|><|eols|><|endoftext|>
7
lolphp
polish_niceguy
dr9jphk
<|sols|><|sot|>(0 > null) is false, (-1 > null) is true<|eot|><|sol|>https://3v4l.org/EfhqW<|eol|><|sor|>I guess -1 effectively ends up being coerced into an unsigned integer for the comparison, which makes it huge.<|eor|><|sor|>That doesn't seem likely to me. I'd expect PHP to coerce both sides to booleans or some nonsense like that.<|eor|><|sor|>Sweet, so i can replace stuff like strpos($haystack, $needle) !== false with the shorter version strpos($haystack, $needle) > -1 .. /s<|eor|><|sor|>Neat, looks like a retarded child of PHP and Javascript.<|eor|><|eols|><|endoftext|>
6
lolphp
maweki
dr8h8nb
<|sols|><|sot|>(0 > null) is false, (-1 > null) is true<|eot|><|sol|>https://3v4l.org/EfhqW<|eol|><|sor|>Transitivity of > was maybe a thing in the 90s.<|eor|><|eols|><|endoftext|>
5
lolphp
Danack
ds4uita
<|sols|><|sot|>(0 > null) is false, (-1 > null) is true<|eot|><|sol|>https://3v4l.org/EfhqW<|eol|><|sor|>I guess -1 effectively ends up being coerced into an unsigned integer for the comparison, which makes it huge.<|eor|><|sor|>That doesn't seem likely to me. I'd expect PHP to coerce both sides to booleans or some nonsense like that.<|eor|><|sor|>> I'd expect PHP to coerce both sides to booleans or some nonsense like that. You're half right. It coerces the [non-null side to a boolean](https://github.com/php/php-src/blob/64002648562362b97fcb78b68366b1b2118ffd5b/Zend/zend_operators.c#L2084-L2090).....and returns: * zval_is_true(op2) ? -1 : 0 - if the null is the op1, or left side of comparison * zval_is_true(op1) ? 1 : 0 - if the null is the op2, or right side of comparison. Which certainly meets the criteria of some nonsense. <|eor|><|eols|><|endoftext|>
5
lolphp
lyoshenka
49al7w
<|soss|><|sot|>One of these things is not like the others<|eot|><|sost|> php > (new stdClass()) == false; php > (new stdClass()) == null; php > (new stdClass()) == 'a string'; php > (new stdClass()) == []; php > (new stdClass()) == (new stdClass()); php > (new stdClass()) == 4; PHP Notice: Object of class stdClass could not be converted to int in php shell code on line 1 Comparing an object and an int (or float) triggers a notice. Doesn't happen for any other type.<|eost|><|eoss|><|endoftext|>
77
lolphp
Lord_NShYH
d0qd9w5
<|soss|><|sot|>One of these things is not like the others<|eot|><|sost|> php > (new stdClass()) == false; php > (new stdClass()) == null; php > (new stdClass()) == 'a string'; php > (new stdClass()) == []; php > (new stdClass()) == (new stdClass()); php > (new stdClass()) == 4; PHP Notice: Object of class stdClass could not be converted to int in php shell code on line 1 Comparing an object and an int (or float) triggers a notice. Doesn't happen for any other type.<|eost|><|sor|>wat.<|eor|><|eoss|><|endoftext|>
35
lolphp
chimyx
d0qjii6
<|soss|><|sot|>One of these things is not like the others<|eot|><|sost|> php > (new stdClass()) == false; php > (new stdClass()) == null; php > (new stdClass()) == 'a string'; php > (new stdClass()) == []; php > (new stdClass()) == (new stdClass()); php > (new stdClass()) == 4; PHP Notice: Object of class stdClass could not be converted to int in php shell code on line 1 Comparing an object and an int (or float) triggers a notice. Doesn't happen for any other type.<|eost|><|sor|>`$ xsel | sed -e 's/php >/var_dump (/' -e 's/;/\);/' | php -a` Interactive shell php > var_dump ( (new stdClass()) == false); bool(false) php > var_dump ( (new stdClass()) == null); bool(false) php > var_dump ( (new stdClass()) == 'a string'); bool(false) php > var_dump ( (new stdClass()) == []); bool(false) php > var_dump ( (new stdClass()) == (new stdClass())); bool(true) php > var_dump ( (new stdClass()) == 4); PHP Notice: Object of class stdClass could not be converted to int in php shell code on line 1 bool(false) php ><|eor|><|eoss|><|endoftext|>
22
lolphp
iluuu
d0qm45x
<|soss|><|sot|>One of these things is not like the others<|eot|><|sost|> php > (new stdClass()) == false; php > (new stdClass()) == null; php > (new stdClass()) == 'a string'; php > (new stdClass()) == []; php > (new stdClass()) == (new stdClass()); php > (new stdClass()) == 4; PHP Notice: Object of class stdClass could not be converted to int in php shell code on line 1 Comparing an object and an int (or float) triggers a notice. Doesn't happen for any other type.<|eost|><|sor|>God, I don't even want to imagine what kind of absolute mess the PHP compiler code is. Or is it an interpreter? Whatever it is, I bet it's nasty.<|eor|><|sor|>It's a mixture i suppose. It compiles it down to bytecode and then runs that in a VM. You don't have to imagine, you can enjoy it in all of its glory [here](https://github.com/php/php-src).<|eor|><|eoss|><|endoftext|>
21
lolphp
coredumperror
d0ql262
<|soss|><|sot|>One of these things is not like the others<|eot|><|sost|> php > (new stdClass()) == false; php > (new stdClass()) == null; php > (new stdClass()) == 'a string'; php > (new stdClass()) == []; php > (new stdClass()) == (new stdClass()); php > (new stdClass()) == 4; PHP Notice: Object of class stdClass could not be converted to int in php shell code on line 1 Comparing an object and an int (or float) triggers a notice. Doesn't happen for any other type.<|eost|><|sor|>God, I don't even want to imagine what kind of absolute mess the PHP compiler code is. Or is it an interpreter? Whatever it is, I bet it's nasty.<|eor|><|eoss|><|endoftext|>
17
lolphp
the_alias_of_andrea
d0qpju0
<|soss|><|sot|>One of these things is not like the others<|eot|><|sost|> php > (new stdClass()) == false; php > (new stdClass()) == null; php > (new stdClass()) == 'a string'; php > (new stdClass()) == []; php > (new stdClass()) == (new stdClass()); php > (new stdClass()) == 4; PHP Notice: Object of class stdClass could not be converted to int in php shell code on line 1 Comparing an object and an int (or float) triggers a notice. Doesn't happen for any other type.<|eost|><|sor|>I can explain this! Objects have an (internal) handler function for converting to different types, called for both implicit *and* explicit casts. So that `if ($object)` works properly, objects convert to bool silently. But they produce an error when converted to an integer. It's one of PHP's worse parts, for sure. It's more confusing in the OP because apparently the == operator doesn't always try to convert its operands. It clearly didn't do that in the string case, because if it did it would have caused a fatal error.<|eor|><|eoss|><|endoftext|>
15
lolphp
Various_Pickles
d0rfs4r
<|soss|><|sot|>One of these things is not like the others<|eot|><|sost|> php > (new stdClass()) == false; php > (new stdClass()) == null; php > (new stdClass()) == 'a string'; php > (new stdClass()) == []; php > (new stdClass()) == (new stdClass()); php > (new stdClass()) == 4; PHP Notice: Object of class stdClass could not be converted to int in php shell code on line 1 Comparing an object and an int (or float) triggers a notice. Doesn't happen for any other type.<|eost|><|sor|>error_reporting(E_ALL & ~E_NOTICE); Done! :-)<|eor|><|sor|>Sorry, there is a php.ini that defines something different located somewhere. Errors will now present the entire stack to users, but no server log entries will be produced.<|eor|><|eoss|><|endoftext|>
10
lolphp
philsown
d0qwglu
<|soss|><|sot|>One of these things is not like the others<|eot|><|sost|> php > (new stdClass()) == false; php > (new stdClass()) == null; php > (new stdClass()) == 'a string'; php > (new stdClass()) == []; php > (new stdClass()) == (new stdClass()); php > (new stdClass()) == 4; PHP Notice: Object of class stdClass could not be converted to int in php shell code on line 1 Comparing an object and an int (or float) triggers a notice. Doesn't happen for any other type.<|eost|><|sor|>error_reporting(E_ALL & ~E_NOTICE); Done! :-)<|eor|><|eoss|><|endoftext|>
9
lolphp
graingert
d0qq2ua
<|soss|><|sot|>One of these things is not like the others<|eot|><|sost|> php > (new stdClass()) == false; php > (new stdClass()) == null; php > (new stdClass()) == 'a string'; php > (new stdClass()) == []; php > (new stdClass()) == (new stdClass()); php > (new stdClass()) == 4; PHP Notice: Object of class stdClass could not be converted to int in php shell code on line 1 Comparing an object and an int (or float) triggers a notice. Doesn't happen for any other type.<|eost|><|sor|>God, I don't even want to imagine what kind of absolute mess the PHP compiler code is. Or is it an interpreter? Whatever it is, I bet it's nasty.<|eor|><|sor|>It's a mixture i suppose. It compiles it down to bytecode and then runs that in a VM. You don't have to imagine, you can enjoy it in all of its glory [here](https://github.com/php/php-src).<|eor|><|sor|>You're thinking of python. PHP didn't even have a grammar for a long time<|eor|><|sor|>In PHP/FI 2.0, maybe. PHP has had a formal grammar for, what, at least 16 years? Most of its existence.<|eor|><|sor|>Ah until PHP 4.0 with the Zend engine, PHP source code was parsed and executed right away by the PHP interpreter.<|eor|><|eoss|><|endoftext|>
8
lolphp
philsown
d0s0bmt
<|soss|><|sot|>One of these things is not like the others<|eot|><|sost|> php > (new stdClass()) == false; php > (new stdClass()) == null; php > (new stdClass()) == 'a string'; php > (new stdClass()) == []; php > (new stdClass()) == (new stdClass()); php > (new stdClass()) == 4; PHP Notice: Object of class stdClass could not be converted to int in php shell code on line 1 Comparing an object and an int (or float) triggers a notice. Doesn't happen for any other type.<|eost|><|sor|>error_reporting(E_ALL & ~E_NOTICE); Done! :-)<|eor|><|sor|>Sorry, there is a php.ini that defines something different located somewhere. Errors will now present the entire stack to users, but no server log entries will be produced.<|eor|><|sor|>Multiple configuration files is how it's always been so don't you dare complain on the internals list! Also, what's a system log? :)<|eor|><|eoss|><|endoftext|>
6
lolphp
Calavar
d0zqp6q
<|soss|><|sot|>One of these things is not like the others<|eot|><|sost|> php > (new stdClass()) == false; php > (new stdClass()) == null; php > (new stdClass()) == 'a string'; php > (new stdClass()) == []; php > (new stdClass()) == (new stdClass()); php > (new stdClass()) == 4; PHP Notice: Object of class stdClass could not be converted to int in php shell code on line 1 Comparing an object and an int (or float) triggers a notice. Doesn't happen for any other type.<|eost|><|sor|>God, I don't even want to imagine what kind of absolute mess the PHP compiler code is. Or is it an interpreter? Whatever it is, I bet it's nasty.<|eor|><|sor|>It's a mixture i suppose. It compiles it down to bytecode and then runs that in a VM. You don't have to imagine, you can enjoy it in all of its glory [here](https://github.com/php/php-src).<|eor|><|sor|>The guts of the engine are mostly okay, and it's quite compact. It suffers from poor documentation, however.<|eor|><|sor|>> The guts of the engine are mostly okay unexpected T_PAAMAYIM_NEKUDOTAYIM<|eor|><|eoss|><|endoftext|>
6
lolphp
the_alias_of_andrea
d0qpi7q
<|soss|><|sot|>One of these things is not like the others<|eot|><|sost|> php > (new stdClass()) == false; php > (new stdClass()) == null; php > (new stdClass()) == 'a string'; php > (new stdClass()) == []; php > (new stdClass()) == (new stdClass()); php > (new stdClass()) == 4; PHP Notice: Object of class stdClass could not be converted to int in php shell code on line 1 Comparing an object and an int (or float) triggers a notice. Doesn't happen for any other type.<|eost|><|sor|>God, I don't even want to imagine what kind of absolute mess the PHP compiler code is. Or is it an interpreter? Whatever it is, I bet it's nasty.<|eor|><|sor|>It's a mixture i suppose. It compiles it down to bytecode and then runs that in a VM. You don't have to imagine, you can enjoy it in all of its glory [here](https://github.com/php/php-src).<|eor|><|sor|>The guts of the engine are mostly okay, and it's quite compact. It suffers from poor documentation, however.<|eor|><|eoss|><|endoftext|>
5
lolphp
akoskm
2kb5rm
<|sols|><|sot|>Brainfuck and PHP [x-post from /r/ProgrammerHumor]<|eot|><|sol|>https://pbs.twimg.com/media/B0n_EAmIUAEf_M3.png:large<|eol|><|eols|><|endoftext|>
76
lolphp
merreborn
cljro0n
<|sols|><|sot|>Brainfuck and PHP [x-post from /r/ProgrammerHumor]<|eot|><|sol|>https://pbs.twimg.com/media/B0n_EAmIUAEf_M3.png:large<|eol|><|sor|>I'll say one thing: I've never seen a brainfuck application exploited in the wild. BF arguably has the better security track record Are there any good brainfuck Web frameworks? Maybe brainfuck on rails? <|eor|><|eols|><|endoftext|>
22
lolphp
Serialk
cljtzxe
<|sols|><|sot|>Brainfuck and PHP [x-post from /r/ProgrammerHumor]<|eot|><|sol|>https://pbs.twimg.com/media/B0n_EAmIUAEf_M3.png:large<|eol|><|sor|>I'll say one thing: I've never seen a brainfuck application exploited in the wild. BF arguably has the better security track record Are there any good brainfuck Web frameworks? Maybe brainfuck on rails? <|eor|><|sor|>> Maybe brainfuck on rails? Yes. https://github.com/masylum/Brainfuck-on-Rails Edit: for those who don't want to try it, [spoiler](#s "it just prints 'first of april fools!'")<|eor|><|eols|><|endoftext|>
12
lolphp
merreborn
clju32g
<|sols|><|sot|>Brainfuck and PHP [x-post from /r/ProgrammerHumor]<|eot|><|sol|>https://pbs.twimg.com/media/B0n_EAmIUAEf_M3.png:large<|eol|><|sor|>I'll say one thing: I've never seen a brainfuck application exploited in the wild. BF arguably has the better security track record Are there any good brainfuck Web frameworks? Maybe brainfuck on rails? <|eor|><|sor|>> Maybe brainfuck on rails? Yes. https://github.com/masylum/Brainfuck-on-Rails Edit: for those who don't want to try it, [spoiler](#s "it just prints 'first of april fools!'")<|eor|><|sor|>> Brainfuck on Rails (BoR) is a **production-ready** port of the popular ruby framework Ruby on Rails. I know what I'm building my next startup on! Wow... bor.bf is a single 20 megabyte line.<|eor|><|eols|><|endoftext|>
12
lolphp
FireyFly
clk6ars
<|sols|><|sot|>Brainfuck and PHP [x-post from /r/ProgrammerHumor]<|eot|><|sol|>https://pbs.twimg.com/media/B0n_EAmIUAEf_M3.png:large<|eol|><|sor|>I'll say one thing: I've never seen a brainfuck application exploited in the wild. BF arguably has the better security track record Are there any good brainfuck Web frameworks? Maybe brainfuck on rails? <|eor|><|sor|>> Maybe brainfuck on rails? Yes. https://github.com/masylum/Brainfuck-on-Rails Edit: for those who don't want to try it, [spoiler](#s "it just prints 'first of april fools!'")<|eor|><|sor|>> Brainfuck on Rails (BoR) is a **production-ready** port of the popular ruby framework Ruby on Rails. I know what I'm building my next startup on! Wow... bor.bf is a single 20 megabyte line.<|eor|><|sor|>All I'm hearing is bor.bf is a oneliner. Wow, so expressive!<|eor|><|eols|><|endoftext|>
12
lolphp
allthediamonds
clk2wq3
<|sols|><|sot|>Brainfuck and PHP [x-post from /r/ProgrammerHumor]<|eot|><|sol|>https://pbs.twimg.com/media/B0n_EAmIUAEf_M3.png:large<|eol|><|sor|>I'll say one thing: I've never seen a brainfuck application exploited in the wild. BF arguably has the better security track record Are there any good brainfuck Web frameworks? Maybe brainfuck on rails? <|eor|><|sor|>Alas, I'd argue that Brainfuck is the better designed of the two. All Brainfuck operations do one thing and do it well; none of them accept their parameters in any order, you don't supply an extra parameter for more entropy, there's no magical type juggling happening under the hood... I think I'd enjoy Brainfuck for a change.<|eor|><|eols|><|endoftext|>
11
lolphp
shiase
cljq3cv
<|sols|><|sot|>Brainfuck and PHP [x-post from /r/ProgrammerHumor]<|eot|><|sol|>https://pbs.twimg.com/media/B0n_EAmIUAEf_M3.png:large<|eol|><|sor|>i remember this, php plebs were so butthurt<|eor|><|eols|><|endoftext|>
8
lolphp
PrettyWhore
clk2wgj
<|sols|><|sot|>Brainfuck and PHP [x-post from /r/ProgrammerHumor]<|eot|><|sol|>https://pbs.twimg.com/media/B0n_EAmIUAEf_M3.png:large<|eol|><|sor|>I'll say one thing: I've never seen a brainfuck application exploited in the wild. BF arguably has the better security track record Are there any good brainfuck Web frameworks? Maybe brainfuck on rails? <|eor|><|sor|>> Maybe brainfuck on rails? Oh god, my brain is producing so many images right now.<|eor|><|sor|>It's beautiful. <|eor|><|eols|><|endoftext|>
5
lolphp
shitcanz
5usnkk
<|soss|><|sot|>Yet another PHP Garbage class<|eot|><|sost|>I was recently working with some PHP and had to hunt down a weird bug, and yet again it was PHP related. Basically you can modify DateTimeImmutable (i repeat IMMUTABLE!) very easily. Just call the getTimeStamp method on it. Originally i had the assumption you cant modify anything within the immutable namespace, but hey PHP surprised me again. It seems like PHP is so full of these weird loop holes and crappy implementations its almost impossible to write anything other than throwaway prototypes with it. So i also found out there has been a open bug-report since 2014. Bug in action: https://3v4l.org/ShFpG<|eost|><|eoss|><|endoftext|>
76
lolphp
emilvikstrom
ddx15in
<|soss|><|sot|>Yet another PHP Garbage class<|eot|><|sost|>I was recently working with some PHP and had to hunt down a weird bug, and yet again it was PHP related. Basically you can modify DateTimeImmutable (i repeat IMMUTABLE!) very easily. Just call the getTimeStamp method on it. Originally i had the assumption you cant modify anything within the immutable namespace, but hey PHP surprised me again. It seems like PHP is so full of these weird loop holes and crappy implementations its almost impossible to write anything other than throwaway prototypes with it. So i also found out there has been a open bug-report since 2014. Bug in action: https://3v4l.org/ShFpG<|eost|><|sor|>Don't miss the [hilarous lol on why DateTimeImmutable extends DateTime](http://comments.gmane.org/gmane.comp.php.devel/78803) and breaks Liskow's substitution principle!<|eor|><|eoss|><|endoftext|>
37
lolphp
AlGoreBestGore
ddxnpi8
<|soss|><|sot|>Yet another PHP Garbage class<|eot|><|sost|>I was recently working with some PHP and had to hunt down a weird bug, and yet again it was PHP related. Basically you can modify DateTimeImmutable (i repeat IMMUTABLE!) very easily. Just call the getTimeStamp method on it. Originally i had the assumption you cant modify anything within the immutable namespace, but hey PHP surprised me again. It seems like PHP is so full of these weird loop holes and crappy implementations its almost impossible to write anything other than throwaway prototypes with it. So i also found out there has been a open bug-report since 2014. Bug in action: https://3v4l.org/ShFpG<|eost|><|sor|>Don't miss the [hilarous lol on why DateTimeImmutable extends DateTime](http://comments.gmane.org/gmane.comp.php.devel/78803) and breaks Liskow's substitution principle!<|eor|><|sor|>I love that there's [DateTimeImmutable::modify](http://php.net/manual/en/datetimeimmutable.modify.php).<|eor|><|eoss|><|endoftext|>
23
lolphp
Pesthuf
ddxqzah
<|soss|><|sot|>Yet another PHP Garbage class<|eot|><|sost|>I was recently working with some PHP and had to hunt down a weird bug, and yet again it was PHP related. Basically you can modify DateTimeImmutable (i repeat IMMUTABLE!) very easily. Just call the getTimeStamp method on it. Originally i had the assumption you cant modify anything within the immutable namespace, but hey PHP surprised me again. It seems like PHP is so full of these weird loop holes and crappy implementations its almost impossible to write anything other than throwaway prototypes with it. So i also found out there has been a open bug-report since 2014. Bug in action: https://3v4l.org/ShFpG<|eost|><|sor|>[deleted]<|eor|><|sor|>`DateTime\DateTimeImmutable`<|eor|><|sor|>Namespaces.... in the Core?! You madman, polluting the global Namespace is an important part of the PHP philosophy!<|eor|><|eoss|><|endoftext|>
23
lolphp
_Lady_Deadpool_
ddwlnkd
<|soss|><|sot|>Yet another PHP Garbage class<|eot|><|sost|>I was recently working with some PHP and had to hunt down a weird bug, and yet again it was PHP related. Basically you can modify DateTimeImmutable (i repeat IMMUTABLE!) very easily. Just call the getTimeStamp method on it. Originally i had the assumption you cant modify anything within the immutable namespace, but hey PHP surprised me again. It seems like PHP is so full of these weird loop holes and crappy implementations its almost impossible to write anything other than throwaway prototypes with it. So i also found out there has been a open bug-report since 2014. Bug in action: https://3v4l.org/ShFpG<|eost|><|sor|>PHP is a programming language for amateurs lead by amateurs. The PSR process in a nutshell: One guy sees something another language does well and then makes a shitty copy of it. Any criticism is ignored because the guy obviously knows what he's doing and all other PHP programmers are amateurs. Then the PSR gets accepted for lack of alternatives, but it doesn't matter because in 1 year we'll have a new PSR and this time it will be even crappier. Example: why is Map not an interface but a class: http://php.net/manual/fr/class.ds-map.php But the whole DS collection "API" is a gem. Feel free to browse if you need a laugh.<|eor|><|sor|>Map can't be converted to an array? How the fuck does it store its kv pairs then? <|eor|><|eoss|><|endoftext|>
14
lolphp
chazzeromus
ddwsko5
<|soss|><|sot|>Yet another PHP Garbage class<|eot|><|sost|>I was recently working with some PHP and had to hunt down a weird bug, and yet again it was PHP related. Basically you can modify DateTimeImmutable (i repeat IMMUTABLE!) very easily. Just call the getTimeStamp method on it. Originally i had the assumption you cant modify anything within the immutable namespace, but hey PHP surprised me again. It seems like PHP is so full of these weird loop holes and crappy implementations its almost impossible to write anything other than throwaway prototypes with it. So i also found out there has been a open bug-report since 2014. Bug in action: https://3v4l.org/ShFpG<|eost|><|sor|>PHP is a programming language for amateurs lead by amateurs. The PSR process in a nutshell: One guy sees something another language does well and then makes a shitty copy of it. Any criticism is ignored because the guy obviously knows what he's doing and all other PHP programmers are amateurs. Then the PSR gets accepted for lack of alternatives, but it doesn't matter because in 1 year we'll have a new PSR and this time it will be even crappier. Example: why is Map not an interface but a class: http://php.net/manual/fr/class.ds-map.php But the whole DS collection "API" is a gem. Feel free to browse if you need a laugh.<|eor|><|sor|>It's the easy bake oven of programming languages.<|eor|><|eoss|><|endoftext|>
10
lolphp
nikic
ddyhvp6
<|soss|><|sot|>Yet another PHP Garbage class<|eot|><|sost|>I was recently working with some PHP and had to hunt down a weird bug, and yet again it was PHP related. Basically you can modify DateTimeImmutable (i repeat IMMUTABLE!) very easily. Just call the getTimeStamp method on it. Originally i had the assumption you cant modify anything within the immutable namespace, but hey PHP surprised me again. It seems like PHP is so full of these weird loop holes and crappy implementations its almost impossible to write anything other than throwaway prototypes with it. So i also found out there has been a open bug-report since 2014. Bug in action: https://3v4l.org/ShFpG<|eost|><|sor|>Don't miss the [hilarous lol on why DateTimeImmutable extends DateTime](http://comments.gmane.org/gmane.comp.php.devel/78803) and breaks Liskow's substitution principle!<|eor|><|sor|>To clarify, as a result of that discussion (which appears to be cut off) `DateTimeImmutable` no longer extends `DateTime` and instead both implement a common interface.<|eor|><|eoss|><|endoftext|>
9
lolphp
Pesthuf
ddwn7i7
<|soss|><|sot|>Yet another PHP Garbage class<|eot|><|sost|>I was recently working with some PHP and had to hunt down a weird bug, and yet again it was PHP related. Basically you can modify DateTimeImmutable (i repeat IMMUTABLE!) very easily. Just call the getTimeStamp method on it. Originally i had the assumption you cant modify anything within the immutable namespace, but hey PHP surprised me again. It seems like PHP is so full of these weird loop holes and crappy implementations its almost impossible to write anything other than throwaway prototypes with it. So i also found out there has been a open bug-report since 2014. Bug in action: https://3v4l.org/ShFpG<|eost|><|sor|>PHP is a programming language for amateurs lead by amateurs. The PSR process in a nutshell: One guy sees something another language does well and then makes a shitty copy of it. Any criticism is ignored because the guy obviously knows what he's doing and all other PHP programmers are amateurs. Then the PSR gets accepted for lack of alternatives, but it doesn't matter because in 1 year we'll have a new PSR and this time it will be even crappier. Example: why is Map not an interface but a class: http://php.net/manual/fr/class.ds-map.php But the whole DS collection "API" is a gem. Feel free to browse if you need a laugh.<|eor|><|sor|>Aren't PSRs just recommendations by the FIG? And while most of those are copies of features and practices from other languages (usually Java), at least they work well and help make PHP usable. Without the autolading PSR(s) and composer, PHP would be completely nonviable. Did you mean the RFC process? In that case, I agree. It often feels like the core devs have no common vision for the language. And there's this "not invented here" mentality when someone copies a feature from hack or another language, no matter how useful it is. Correctly working, clear and concise programs do not match with the PHP philosophy, hehehehe...<|eor|><|eoss|><|endoftext|>
9
lolphp
BilgeXA
ddwtgfo
<|soss|><|sot|>Yet another PHP Garbage class<|eot|><|sost|>I was recently working with some PHP and had to hunt down a weird bug, and yet again it was PHP related. Basically you can modify DateTimeImmutable (i repeat IMMUTABLE!) very easily. Just call the getTimeStamp method on it. Originally i had the assumption you cant modify anything within the immutable namespace, but hey PHP surprised me again. It seems like PHP is so full of these weird loop holes and crappy implementations its almost impossible to write anything other than throwaway prototypes with it. So i also found out there has been a open bug-report since 2014. Bug in action: https://3v4l.org/ShFpG<|eost|><|sor|>PHP is a programming language for amateurs lead by amateurs. The PSR process in a nutshell: One guy sees something another language does well and then makes a shitty copy of it. Any criticism is ignored because the guy obviously knows what he's doing and all other PHP programmers are amateurs. Then the PSR gets accepted for lack of alternatives, but it doesn't matter because in 1 year we'll have a new PSR and this time it will be even crappier. Example: why is Map not an interface but a class: http://php.net/manual/fr/class.ds-map.php But the whole DS collection "API" is a gem. Feel free to browse if you need a laugh.<|eor|><|sor|>What does PSR have to do with this topic?<|eor|><|eoss|><|endoftext|>
9
lolphp
nikic
ddyipa6
<|soss|><|sot|>Yet another PHP Garbage class<|eot|><|sost|>I was recently working with some PHP and had to hunt down a weird bug, and yet again it was PHP related. Basically you can modify DateTimeImmutable (i repeat IMMUTABLE!) very easily. Just call the getTimeStamp method on it. Originally i had the assumption you cant modify anything within the immutable namespace, but hey PHP surprised me again. It seems like PHP is so full of these weird loop holes and crappy implementations its almost impossible to write anything other than throwaway prototypes with it. So i also found out there has been a open bug-report since 2014. Bug in action: https://3v4l.org/ShFpG<|eost|><|sor|>PHP is a programming language for amateurs lead by amateurs. The PSR process in a nutshell: One guy sees something another language does well and then makes a shitty copy of it. Any criticism is ignored because the guy obviously knows what he's doing and all other PHP programmers are amateurs. Then the PSR gets accepted for lack of alternatives, but it doesn't matter because in 1 year we'll have a new PSR and this time it will be even crappier. Example: why is Map not an interface but a class: http://php.net/manual/fr/class.ds-map.php But the whole DS collection "API" is a gem. Feel free to browse if you need a laugh.<|eor|><|sor|>To clarify, ext/ds is a third-party extension. It is not part of PHP and, as such, did not go through the RFC process. The question why Map is a class rather than an interface is an interesting one, though judging by your portrayal of the issue, a nuanced discussion would not be appreciated here. Suffice it to say that a Map interface would have to impose stronger constraints on the keys than are necessitated by any implementation. In particular, a Map that can be either implemented either using a hash table or a binary search tree (or variation thereon) would require both the existence of a hash and a total order on the keys. This is stronger than the requirement for a hash table (hash and equivalence relation) or BST (total preorder). There are of course other reasons as well, but maybe this is enough to illustrate that the choice of class vs interface here is non-trivial.<|eor|><|eoss|><|endoftext|>
6
lolphp
BilgeXA
ddwthno
<|soss|><|sot|>Yet another PHP Garbage class<|eot|><|sost|>I was recently working with some PHP and had to hunt down a weird bug, and yet again it was PHP related. Basically you can modify DateTimeImmutable (i repeat IMMUTABLE!) very easily. Just call the getTimeStamp method on it. Originally i had the assumption you cant modify anything within the immutable namespace, but hey PHP surprised me again. It seems like PHP is so full of these weird loop holes and crappy implementations its almost impossible to write anything other than throwaway prototypes with it. So i also found out there has been a open bug-report since 2014. Bug in action: https://3v4l.org/ShFpG<|eost|><|sor|>>Submitted: 2014-07-16<|eor|><|eoss|><|endoftext|>
5
lolphp
BilgeXA
ddxpoq6
<|soss|><|sot|>Yet another PHP Garbage class<|eot|><|sost|>I was recently working with some PHP and had to hunt down a weird bug, and yet again it was PHP related. Basically you can modify DateTimeImmutable (i repeat IMMUTABLE!) very easily. Just call the getTimeStamp method on it. Originally i had the assumption you cant modify anything within the immutable namespace, but hey PHP surprised me again. It seems like PHP is so full of these weird loop holes and crappy implementations its almost impossible to write anything other than throwaway prototypes with it. So i also found out there has been a open bug-report since 2014. Bug in action: https://3v4l.org/ShFpG<|eost|><|sor|>[deleted]<|eor|><|sor|>`DateTime\DateTimeImmutable`<|eor|><|eoss|><|endoftext|>
5
lolphp
ConcernedInScythe
de0v1g5
<|soss|><|sot|>Yet another PHP Garbage class<|eot|><|sost|>I was recently working with some PHP and had to hunt down a weird bug, and yet again it was PHP related. Basically you can modify DateTimeImmutable (i repeat IMMUTABLE!) very easily. Just call the getTimeStamp method on it. Originally i had the assumption you cant modify anything within the immutable namespace, but hey PHP surprised me again. It seems like PHP is so full of these weird loop holes and crappy implementations its almost impossible to write anything other than throwaway prototypes with it. So i also found out there has been a open bug-report since 2014. Bug in action: https://3v4l.org/ShFpG<|eost|><|sor|>Don't miss the [hilarous lol on why DateTimeImmutable extends DateTime](http://comments.gmane.org/gmane.comp.php.devel/78803) and breaks Liskow's substitution principle!<|eor|><|sor|>To clarify, as a result of that discussion (which appears to be cut off) `DateTimeImmutable` no longer extends `DateTime` and instead both implement a common interface.<|eor|><|sor|>[Good to know that everything's sane now, then.](http://php.net/manual/en/datetimeimmutable.modify.php)<|eor|><|eoss|><|endoftext|>
5
lolphp
andsens
3cjgtl
<|sols|><|sot|>feof(): Returns TRUE if the file pointer is at EOF or an error occurs; otherwise returns FALSE. -- except when some other error occurs, then it returns FALSE<|eot|><|sol|>http://dk2.php.net/manual/en/function.feof.php#refsect1-function.feof-notes<|eol|><|eols|><|endoftext|>
75
lolphp
cbraga
csw9d4q
<|sols|><|sot|>feof(): Returns TRUE if the file pointer is at EOF or an error occurs; otherwise returns FALSE. -- except when some other error occurs, then it returns FALSE<|eot|><|sol|>http://dk2.php.net/manual/en/function.feof.php#refsect1-function.feof-notes<|eol|><|sor|>> Warning > If a connection opened by fsockopen() wasn't closed by the server, feof() will hang. To workaround this, see below example: WOW VERY UTILITY MUCH INTUITIVE SUCH FRIENDLY WOW<|eor|><|eols|><|endoftext|>
44
lolphp
kasnalin
csw5jo9
<|sols|><|sot|>feof(): Returns TRUE if the file pointer is at EOF or an error occurs; otherwise returns FALSE. -- except when some other error occurs, then it returns FALSE<|eot|><|sol|>http://dk2.php.net/manual/en/function.feof.php#refsect1-function.feof-notes<|eol|><|sor|>Well, no. It returns true if at end of file or file can't be read any more. Otherwise false. Basically a test to see if more of the file is available. Although arguably you can do this in other ways of course<|eor|><|sor|>It returns `FALSE` if you pass an invalid file handle. In any sane language, this would be an error, but instead PHP accepts the strong possibility of hanging indefinitely in the most common use case, checking for EOF in a read loop.<|eor|><|eols|><|endoftext|>
21
lolphp
Ironoxides
csw33pt
<|sols|><|sot|>feof(): Returns TRUE if the file pointer is at EOF or an error occurs; otherwise returns FALSE. -- except when some other error occurs, then it returns FALSE<|eot|><|sol|>http://dk2.php.net/manual/en/function.feof.php#refsect1-function.feof-notes<|eol|><|sor|>Well, no. It returns true if at end of file or file can't be read any more. Otherwise false. Basically a test to see if more of the file is available. Although arguably you can do this in other ways of course<|eor|><|eols|><|endoftext|>
8
lolphp
sli
csxvyk1
<|sols|><|sot|>feof(): Returns TRUE if the file pointer is at EOF or an error occurs; otherwise returns FALSE. -- except when some other error occurs, then it returns FALSE<|eot|><|sol|>http://dk2.php.net/manual/en/function.feof.php#refsect1-function.feof-notes<|eol|><|sor|>Again like the other feof() link here on /r/lolphp, report it to the bug tracker so there is a chance for it to get changed, else nothing will happen<|eor|><|sor|>Er, did it really take less than an hour for you already forget what you said about this? https://www.reddit.com/r/lolphp/comments/3cnx6d/feof_the_documentation_is_wrong/csxg0lu You guys said no ten years ago and right there in that comment you're implying you guys will say no again. Why should anyone bother?<|eor|><|eols|><|endoftext|>
6
lolphp
emcniece
csw6ocd
<|sols|><|sot|>feof(): Returns TRUE if the file pointer is at EOF or an error occurs; otherwise returns FALSE. -- except when some other error occurs, then it returns FALSE<|eot|><|sol|>http://dk2.php.net/manual/en/function.feof.php#refsect1-function.feof-notes<|eol|><|sor|>Well, no. It returns true if at end of file or file can't be read any more. Otherwise false. Basically a test to see if more of the file is available. Although arguably you can do this in other ways of course<|eor|><|sor|>It returns `FALSE` if you pass an invalid file handle. In any sane language, this would be an error, but instead PHP accepts the strong possibility of hanging indefinitely in the most common use case, checking for EOF in a read loop.<|eor|><|sor|>If you're in a read loop, shouldn't you already have checked if the file exists? Or do you mean a scenario where the file is deleted while it is being written to<|eor|><|eols|><|endoftext|>
5
lolphp
AdventOfScala
5xe6ez
<|sols|><|sot|>Test of JSON parsers - PHP's is almost the only one completely correct one.<|eot|><|sol|>http://seriot.ch/json/pruned_results.png<|eol|><|eols|><|endoftext|>
75
lolphp
yxpow
dehi1pz
<|sols|><|sot|>Test of JSON parsers - PHP's is almost the only one completely correct one.<|eot|><|sol|>http://seriot.ch/json/pruned_results.png<|eol|><|sor|>Ironic that the parser is almost to spec when if you want to use the API properly you have to wrap it in a class that will handle errors properly.<|eor|><|eols|><|endoftext|>
48
lolphp
iloveportalz0r
dehh3ij
<|sols|><|sot|>Test of JSON parsers - PHP's is almost the only one completely correct one.<|eot|><|sol|>http://seriot.ch/json/pruned_results.png<|eol|><|sor|>How is this lol php?<|eor|><|sor|>It's funny that one of the things PHP does correctly is parsing something based on a competing language<|eor|><|eols|><|endoftext|>
37
lolphp
sbditto85
dehg8h9
<|sols|><|sot|>Test of JSON parsers - PHP's is almost the only one completely correct one.<|eot|><|sol|>http://seriot.ch/json/pruned_results.png<|eol|><|sor|>How is this lol php?<|eor|><|eols|><|endoftext|>
17
lolphp
Lama-Lutomski
dehvc20
<|sols|><|sot|>Test of JSON parsers - PHP's is almost the only one completely correct one.<|eot|><|sol|>http://seriot.ch/json/pruned_results.png<|eol|><|sor|>How is this lol php?<|eor|><|sor|>Yeah, it belongs to /r/wowphp. Still funny though.<|eor|><|eols|><|endoftext|>
17
lolphp
kr094
dehxpwp
<|sols|><|sot|>Test of JSON parsers - PHP's is almost the only one completely correct one.<|eot|><|sol|>http://seriot.ch/json/pruned_results.png<|eol|><|sor|>How is this lol php?<|eor|><|sor|>Yeah, it belongs to /r/wowphp. Still funny though.<|eor|><|sor|>Fell for it. <|eor|><|eols|><|endoftext|>
14
lolphp
IlikeSalmiakki
dehvy17
<|sols|><|sot|>Test of JSON parsers - PHP's is almost the only one completely correct one.<|eot|><|sol|>http://seriot.ch/json/pruned_results.png<|eol|><|sor|>[Here's the article](http://seriot.ch/parsing_json.php). Worth the read.<|eor|><|eols|><|endoftext|>
12