subreddit stringclasses 7 values | author stringlengths 3 20 | id stringlengths 5 7 | content stringlengths 67 30.4k | score int64 0 140k |
|---|---|---|---|---|
lolphp | barubary | czbb03b | <|sols|><|sot|>Php proposes code of conduct<|eot|><|sol|>https://wiki.php.net/rfc/adopt-code-of-conduct<|eol|><|soopr|>One of the points is:
"Thoughtless use of pronouns"
What a world we live in!<|eoopr|><|sor|>As much as you all seem to love that quote, it's not in the text itself.
(It's also not a non-issue, but that's another matter.)<|eor|><|sor|>It's in the [description of the Contributor Covenant](http://contributor-covenant.org/) that the RFC proposes to adopt, but not in the [text of the Contributor Covenant](http://contributor-covenant.org/version/1/3/0/) itself.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | hey_aaapple | czbe9li | <|sols|><|sot|>Php proposes code of conduct<|eot|><|sol|>https://wiki.php.net/rfc/adopt-code-of-conduct<|eol|><|sor|>Our previous discussion on the topic: https://www.reddit.com/r/lolphp/comments/3zikur/grap_your_popcorns_for_a_bit_of_phpdrama_and/<|eor|><|sor|>There's not enough popcorn in the history of the planet; after spending half my adult life in societies which celebrate people with one or more traits that I share being on the bottom of the pile, I can appreciate the idea behind CoC, and even the folks behind contributor-covenant.org.
Because two facts tend to get lost on people in these discussions: first, external differences which are not individuals' personal responsibility *does* impact their ability to contribute to their full "meritocratic" potential, and second, we are all, or nearly all here, *human* and deserve to be treated (and to treat others) as such. Living in a self-glorifyingly racist culture, I have taken to writing "HUMAN" in each of the interminable Government and Government-linked-company forms that have, as typically the very first space on the form, "RACE".<|eor|><|sor|>Well, to be fair, I don't think that a CoC is strictly necessary for any community, but considering on what level (and with what kind of language) the discussion about the CoC is held, it seems not a bad idea for this particular one.<|eor|><|sor|>That's a bit circular tho. Also, no CoC might be better than a bad CoC.<|eor|><|sor|>Well, lot of the first reactions where along the lines of "those Nazis are going to reprimand us for our language". That's not the basis for a discussion though, right?
If the reaction would have been "I don't think it is necessary, we have all been civil here" and if that then also were true...<|eor|><|sor|>Talking on the internet is a free action. Calling people you don't like "literally Nazis" without any hint of irony is so common it's not even worth mentioning. On top of that, if your logic applies then people who want the CoC would want to make as many flame-baiting and offensive comments against the CoC as they can, because that would make their position stronger.
Again, circular logic is one hell of a drug.
As an aside, isn't CoC also the acronym for some weird text-based porn game created on /v/ or something?<|eor|><|eols|><|endoftext|> | 7 |
lolphp | fgous | czchq1e | <|sols|><|sot|>Php proposes code of conduct<|eot|><|sol|>https://wiki.php.net/rfc/adopt-code-of-conduct<|eol|><|sor|>Funny thing is [no one can point to an instance of abuse](https://www.reddit.com/r/PHP/comments/41vuja/rfc_reproposed_adopt_code_of_conduct/cz6pecs) in the internals in the past.....<|eor|><|sor|>We've banned at least two people from internals before. It's rare, but we do have problems sometimes.<|eor|><|sor|>Do you have a link?<|eor|><|eols|><|endoftext|> | 5 |
lolphp | hey_aaapple | czbduzo | <|sols|><|sot|>Php proposes code of conduct<|eot|><|sol|>https://wiki.php.net/rfc/adopt-code-of-conduct<|eol|><|sor|>Our previous discussion on the topic: https://www.reddit.com/r/lolphp/comments/3zikur/grap_your_popcorns_for_a_bit_of_phpdrama_and/<|eor|><|sor|>There's not enough popcorn in the history of the planet; after spending half my adult life in societies which celebrate people with one or more traits that I share being on the bottom of the pile, I can appreciate the idea behind CoC, and even the folks behind contributor-covenant.org.
Because two facts tend to get lost on people in these discussions: first, external differences which are not individuals' personal responsibility *does* impact their ability to contribute to their full "meritocratic" potential, and second, we are all, or nearly all here, *human* and deserve to be treated (and to treat others) as such. Living in a self-glorifyingly racist culture, I have taken to writing "HUMAN" in each of the interminable Government and Government-linked-company forms that have, as typically the very first space on the form, "RACE".<|eor|><|sor|>Well, to be fair, I don't think that a CoC is strictly necessary for any community, but considering on what level (and with what kind of language) the discussion about the CoC is held, it seems not a bad idea for this particular one.<|eor|><|sor|>That's a bit circular tho. Also, no CoC might be better than a bad CoC.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | the_alias_of_andrea | czbwk0p | <|sols|><|sot|>Php proposes code of conduct<|eot|><|sol|>https://wiki.php.net/rfc/adopt-code-of-conduct<|eol|><|soopr|>One of the points is:
"Thoughtless use of pronouns"
What a world we live in!<|eoopr|><|sor|>As much as you all seem to love that quote, it's not in the text itself.
(It's also not a non-issue, but that's another matter.)<|eor|><|sor|>It's in the [description of the Contributor Covenant](http://contributor-covenant.org/) that the RFC proposes to adopt, but not in the [text of the Contributor Covenant](http://contributor-covenant.org/version/1/3/0/) itself.<|eor|><|sor|>> but not in the text of the Contributor Covenant itself
Yes, precisely.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | joehillen | 3847ob | <|sols|><|sot|>These are the fundamentals we are teaching our children<|eot|><|sol|>http://online.stanford.edu/course/beginning-programming-php<|eol|><|eols|><|endoftext|> | 16 |
lolphp | tdammers | crs5n2v | <|sols|><|sot|>These are the fundamentals we are teaching our children<|eot|><|sol|>http://online.stanford.edu/course/beginning-programming-php<|eol|><|sor|>> Students will come away with a fundamental understanding of PHP
That must be one hell of a course. After 15 years of programming PHP, much of it professionally, I still don't understand the fundamentals at all.<|eor|><|eols|><|endoftext|> | 37 |
lolphp | urquan | crsyjkr | <|sols|><|sot|>These are the fundamentals we are teaching our children<|eot|><|sol|>http://online.stanford.edu/course/beginning-programming-php<|eol|><|sor|>PHP is great in the sense that the feedback loop of writing some code -> tangible result is extremely short. You can write your first hello world in literally 10 seconds and have a result in the browser. I think that can be a strong motivator for self experimentation, which is essential for learning.
On the other hand PHP has a lot of idiosyncrasies, inconsistencies and weirdness that make it not ideal for learning. Especially for an introductory course with no previous programming experience that can overload what students have to memorize. Let's hope the teachers can navigate around that.<|eor|><|eols|><|endoftext|> | 19 |
lolphp | andsens | crs6n0t | <|sols|><|sot|>These are the fundamentals we are teaching our children<|eot|><|sol|>http://online.stanford.edu/course/beginning-programming-php<|eol|><|sor|>> Students will come away with a fundamental understanding of PHP
That must be one hell of a course. After 15 years of programming PHP, much of it professionally, I still don't understand the fundamentals at all.<|eor|><|sor|>Mostly because there isn't a foundation I reckon?<|eor|><|eols|><|endoftext|> | 19 |
lolphp | SnowdogU77 | crsv1i4 | <|sols|><|sot|>These are the fundamentals we are teaching our children<|eot|><|sol|>http://online.stanford.edu/course/beginning-programming-php<|eol|><|sor|>> Students will come away with a fundamental understanding of PHP
That must be one hell of a course. After 15 years of programming PHP, much of it professionally, I still don't understand the fundamentals at all.<|eor|><|sor|>Mostly because there isn't a foundation I reckon?<|eor|><|sor|>Foundation of salt and sand.<|eor|><|eols|><|endoftext|> | 15 |
lolphp | beerdude26 | crv4ola | <|sols|><|sot|>These are the fundamentals we are teaching our children<|eot|><|sol|>http://online.stanford.edu/course/beginning-programming-php<|eol|><|sor|>PHP is great in the sense that the feedback loop of writing some code -> tangible result is extremely short. You can write your first hello world in literally 10 seconds and have a result in the browser. I think that can be a strong motivator for self experimentation, which is essential for learning.
On the other hand PHP has a lot of idiosyncrasies, inconsistencies and weirdness that make it not ideal for learning. Especially for an introductory course with no previous programming experience that can overload what students have to memorize. Let's hope the teachers can navigate around that.<|eor|><|sor|>I have a feeling that an intro course won't run into much of those things. For all its faults, PHP won't misconstrue how basic things like if statements, while loops, etc. work.<|eor|><|sor|>Being more of a functional programming guy, I think that teaching problem solving and how to work with abstractions is the most important thing and PHP is really bad for that. Functions are second-class citizens, variable scope is wonky, the syntax (and everything else) is inconsistent, etc...<|eor|><|sor|>[deleted]<|eor|><|sor|>> isset/empty
You forgot array_key_exists.<|eor|><|sor|>[deleted]<|eor|><|sor|>No, no. There was first key_exists, and then array_key_exists. I guess it's a bit sad that your joke is not far off from reality.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | gu3st12 | crsm5w4 | <|sols|><|sot|>These are the fundamentals we are teaching our children<|eot|><|sol|>http://online.stanford.edu/course/beginning-programming-php<|eol|><|sor|>Good. They'll learn problem solving.
Hopefully they don't learn the same entitled whining that most posters here have. <|eor|><|eols|><|endoftext|> | 10 |
lolphp | smog_alado | crt1n4q | <|sols|><|sot|>These are the fundamentals we are teaching our children<|eot|><|sol|>http://online.stanford.edu/course/beginning-programming-php<|eol|><|sor|>PHP is great in the sense that the feedback loop of writing some code -> tangible result is extremely short. You can write your first hello world in literally 10 seconds and have a result in the browser. I think that can be a strong motivator for self experimentation, which is essential for learning.
On the other hand PHP has a lot of idiosyncrasies, inconsistencies and weirdness that make it not ideal for learning. Especially for an introductory course with no previous programming experience that can overload what students have to memorize. Let's hope the teachers can navigate around that.<|eor|><|sor|>I have a feeling that an intro course won't run into much of those things. For all its faults, PHP won't misconstrue how basic things like if statements, while loops, etc. work.<|eor|><|sor|>Being more of a functional programming guy, I think that teaching problem solving and how to work with abstractions is the most important thing and PHP is really bad for that. Functions are second-class citizens, variable scope is wonky, the syntax (and everything else) is inconsistent, etc...<|eor|><|eols|><|endoftext|> | 10 |
lolphp | beerdude26 | crv4m2e | <|sols|><|sot|>These are the fundamentals we are teaching our children<|eot|><|sol|>http://online.stanford.edu/course/beginning-programming-php<|eol|><|sor|>PHP is great in the sense that the feedback loop of writing some code -> tangible result is extremely short. You can write your first hello world in literally 10 seconds and have a result in the browser. I think that can be a strong motivator for self experimentation, which is essential for learning.
On the other hand PHP has a lot of idiosyncrasies, inconsistencies and weirdness that make it not ideal for learning. Especially for an introductory course with no previous programming experience that can overload what students have to memorize. Let's hope the teachers can navigate around that.<|eor|><|sor|>I have a feeling that an intro course won't run into much of those things. For all its faults, PHP won't misconstrue how basic things like if statements, while loops, etc. work.<|eor|><|sor|>Being more of a functional programming guy, I think that teaching problem solving and how to work with abstractions is the most important thing and PHP is really bad for that. Functions are second-class citizens, variable scope is wonky, the syntax (and everything else) is inconsistent, etc...<|eor|><|sor|>[deleted]<|eor|><|sor|>> isset/empty
You forgot array_key_exists.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | DoctorWaluigiTime | crt0pa4 | <|sols|><|sot|>These are the fundamentals we are teaching our children<|eot|><|sol|>http://online.stanford.edu/course/beginning-programming-php<|eol|><|sor|>PHP is great in the sense that the feedback loop of writing some code -> tangible result is extremely short. You can write your first hello world in literally 10 seconds and have a result in the browser. I think that can be a strong motivator for self experimentation, which is essential for learning.
On the other hand PHP has a lot of idiosyncrasies, inconsistencies and weirdness that make it not ideal for learning. Especially for an introductory course with no previous programming experience that can overload what students have to memorize. Let's hope the teachers can navigate around that.<|eor|><|sor|>I have a feeling that an intro course won't run into much of those things. For all its faults, PHP won't misconstrue how basic things like if statements, while loops, etc. work.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | allthediamonds | cs2ecko | <|sols|><|sot|>These are the fundamentals we are teaching our children<|eot|><|sol|>http://online.stanford.edu/course/beginning-programming-php<|eol|><|sor|>PHP is great in the sense that the feedback loop of writing some code -> tangible result is extremely short. You can write your first hello world in literally 10 seconds and have a result in the browser. I think that can be a strong motivator for self experimentation, which is essential for learning.
On the other hand PHP has a lot of idiosyncrasies, inconsistencies and weirdness that make it not ideal for learning. Especially for an introductory course with no previous programming experience that can overload what students have to memorize. Let's hope the teachers can navigate around that.<|eor|><|sor|>I have a feeling that an intro course won't run into much of those things. For all its faults, PHP won't misconstrue how basic things like if statements, while loops, etc. work.<|eor|><|sor|>Being more of a functional programming guy, I think that teaching problem solving and how to work with abstractions is the most important thing and PHP is really bad for that. Functions are second-class citizens, variable scope is wonky, the syntax (and everything else) is inconsistent, etc...<|eor|><|sor|>> Functions are second-class citizens
We've had first-class functions since PHP 5.3, like few years ago.
And we've had objects for longer than this, which are pretty good stand-ins for first-class functions (pass "closed over" vars to constructor, have a single method), in terms of raw capability.
> variable scope is wonky
Variables in functions have function scope. It's not ideal but "wonky" is not the word I'd use. You won't get surprise scope on your variables. Either they're function-scope, or if explicitly imported, global, which no one does anymore so... they're function scope. That's all.
> the syntax (and everything else) is inconsistent
It's butt-ugly, but not inconsistent, there's a difference.<|eor|><|sor|>> We've had first-class functions since PHP 5.3, like few years ago.
No, you have not. You have an anonymous function syntax literal that generates "closure objects", which do not behave like PHP objects in any way, but behave more like their own kind of primitive. No, seriously, check it out; open `php -a` and start playing with them. The only thing closure objects and functions have in common is that they are called with the same syntax; the only thing regular objects and closure objects have in common is that both of them claim to be objects.
Setting these closures aside, functions are still not first-class in PHP. You can't take, say, `array_slice` or `my_silly_function` or `my_object->my_method` and put them on variables; it is just not a thing that you can do. Functions are definitely, absolutely, undoubtedly not first-class primitives in PHP. There is simply no way around it.
There are some magical, hardcoded "closure objects" you can use the same way you use functions, and those are first-class indeed. But that doesn't mean functions are closure objects; if you have a horse and some wheels, you still don't have a car.
> And we've had objects for longer than this, which are pretty good stand-ins for first-class functions (pass "closed over" vars to constructor, have a single method), in terms of raw capability.
I... I can't even respond to this. It's technically correct, yet so irrelevant and far-removed from the way actual humans use programming languages that I find myself unable to reason about it.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | beerdude26 | crv4o9e | <|sols|><|sot|>These are the fundamentals we are teaching our children<|eot|><|sol|>http://online.stanford.edu/course/beginning-programming-php<|eol|><|sor|>Good. They'll learn problem solving.
Hopefully they don't learn the same entitled whining that most posters here have. <|eor|><|sor|>Yeah I was about to say this. PHP is not a bad "first language" to learn, especially if the end goal is "make a site that's not just HTML and teach them something other than JS."
PHP has a lot of flaws, but I highly doubt that an introductary programming course will run into them.<|eor|><|sor|>It matches a beginner's expectations. Isn't that the reason for things like `"5" == 5`? "They're the same thing, why wouldn't they be equal!?"<|eor|><|sor|>They're not equal to a computer. PHP tries to abstract over that and fails in a laughable manner.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | OneWingedShark | crumswu | <|sols|><|sot|>These are the fundamentals we are teaching our children<|eot|><|sol|>http://online.stanford.edu/course/beginning-programming-php<|eol|><|sor|>PHP is great in the sense that the feedback loop of writing some code -> tangible result is extremely short. You can write your first hello world in literally 10 seconds and have a result in the browser. I think that can be a strong motivator for self experimentation, which is essential for learning.
On the other hand PHP has a lot of idiosyncrasies, inconsistencies and weirdness that make it not ideal for learning. Especially for an introductory course with no previous programming experience that can overload what students have to memorize. Let's hope the teachers can navigate around that.<|eor|><|sor|>I have a feeling that an intro course won't run into much of those things. For all its faults, PHP won't misconstrue how basic things like if statements, while loops, etc. work.<|eor|><|sor|>Being more of a functional programming guy, I think that teaching problem solving and how to work with abstractions is the most important thing and PHP is really bad for that. Functions are second-class citizens, variable scope is wonky, the syntax (and everything else) is inconsistent, etc...<|eor|><|sor|>[deleted]<|eor|><|sor|>I hear what you're saying, though for me it's been the other way around: I taught myself Pascal with the manual and the compiler, did C (and a bit of C++) in school and immediately realized how error-prone it was comparatively, then the school did Java which was "meh - alright", then in a languages course I found Ada; after graduating I got a job where I did programming in PHP (to include things handling multi-thousand dollar assets and medical/insurance records) which made me really appreciate Ada.
In fact, I would definitely recommend learning it to people who use PHP: it's philosophy is essentially the exact opposite: incorrectness is not allowed, strong/static types [and subtypes] help you to know where you're messing up, and the module system's division of specification and implementation really encourage *designing*.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | berkes | 1uj7lo | <|sols|><|sot|>5 quotes by the creator of PHP, Rasmus Lerdorf: I don't like programming, and I'm not a real programmer.<|eot|><|sol|>http://axonflux.com/5-quotes-by-the-creator-of-php-rasmus-lerdorf<|eol|><|eols|><|endoftext|> | 18 |
lolphp | notwolverine | 1lak1l | <|soss|><|sot|>Unknown functions? Well I'm not saying!<|eot|><|sost|>This just bit me in a PHP script I'm supporting. The mysql-extension was not installed because the script was moved to a new server, and when running it, the script would simply die. No error, warning or notice of any kind.
Turns out, that's _always_ the case!
Look at this sample:
<?
# Please inform us about everything, mm'kay?
error_reporting(E_ALL);
print("before");
unknown_func();
print("after");
?>
$ php -f phail.php
before
Well that's just great... are they even trying any more!?<|eost|><|eoss|><|endoftext|> | 15 |
lolphp | merreborn | cbxdjt1 | <|soss|><|sot|>Unknown functions? Well I'm not saying!<|eot|><|sost|>This just bit me in a PHP script I'm supporting. The mysql-extension was not installed because the script was moved to a new server, and when running it, the script would simply die. No error, warning or notice of any kind.
Turns out, that's _always_ the case!
Look at this sample:
<?
# Please inform us about everything, mm'kay?
error_reporting(E_ALL);
print("before");
unknown_func();
print("after");
?>
$ php -f phail.php
before
Well that's just great... are they even trying any more!?<|eost|><|sor|>Working fine here
$ cat x.php
<?
# Please inform us about everything, mm'kay?
error_reporting(E_ALL);
print("before");
unknown_func();
print("after");
$ php -f x.php
beforePHP Fatal error: Call to undefined function unknown_func() in x.php on line 5
$ php -v
PHP 5.3.8 (cli) (built: Dec 6 2011 09:52:48)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Xdebug v2.2.0, Copyright (c) 2002-2012, by Derick Rethans
Also works fine on my ubuntu system running `PHP 5.3.10-1ubuntu3.5`
Maybe this is less lolphp and more lolyourlousyubuntubuild<|eor|><|eoss|><|endoftext|> | 20 |
lolphp | notwolverine | cbxb03s | <|soss|><|sot|>Unknown functions? Well I'm not saying!<|eot|><|sost|>This just bit me in a PHP script I'm supporting. The mysql-extension was not installed because the script was moved to a new server, and when running it, the script would simply die. No error, warning or notice of any kind.
Turns out, that's _always_ the case!
Look at this sample:
<?
# Please inform us about everything, mm'kay?
error_reporting(E_ALL);
print("before");
unknown_func();
print("after");
?>
$ php -f phail.php
before
Well that's just great... are they even trying any more!?<|eost|><|soopr|>It seems this was fixed somewhere between php 5.3.3-7+squeeze16 and 5.4.9-4ubuntu2.2.
Although the script still returns exit status 255 which is completely undocumented. Well, except that under exit() in the manuel, there's a mention:
If status is an integer, that value will also be used as the exit status.
Exit statuses should be in the range 0 to 254, **the exit status 255 is
reserved by PHP and shall not be used**. The status 0 is used to
terminate the program successfully.
So yeah, it's an code reserved for PHP (which in itself is fair enough), but it's not clear when it's used. Googling will reveal many frustrated users, and the best guess seems to center around "bad silent error", which certainly fits this scenario.
/rage off..<|eoopr|><|eoss|><|endoftext|> | 9 |
lolphp | nikic | cbxq6dq | <|soss|><|sot|>Unknown functions? Well I'm not saying!<|eot|><|sost|>This just bit me in a PHP script I'm supporting. The mysql-extension was not installed because the script was moved to a new server, and when running it, the script would simply die. No error, warning or notice of any kind.
Turns out, that's _always_ the case!
Look at this sample:
<?
# Please inform us about everything, mm'kay?
error_reporting(E_ALL);
print("before");
unknown_func();
print("after");
?>
$ php -f phail.php
before
Well that's just great... are they even trying any more!?<|eost|><|sor|>You clearly disabled `display_errors` - which is totally fine if this is a production environment and you enabled error logging instead. So, did you check your error log?<|eor|><|eoss|><|endoftext|> | 7 |
lolphp | notwolverine | cbxlweu | <|soss|><|sot|>Unknown functions? Well I'm not saying!<|eot|><|sost|>This just bit me in a PHP script I'm supporting. The mysql-extension was not installed because the script was moved to a new server, and when running it, the script would simply die. No error, warning or notice of any kind.
Turns out, that's _always_ the case!
Look at this sample:
<?
# Please inform us about everything, mm'kay?
error_reporting(E_ALL);
print("before");
unknown_func();
print("after");
?>
$ php -f phail.php
before
Well that's just great... are they even trying any more!?<|eost|><|sor|>Working fine here
$ cat x.php
<?
# Please inform us about everything, mm'kay?
error_reporting(E_ALL);
print("before");
unknown_func();
print("after");
$ php -f x.php
beforePHP Fatal error: Call to undefined function unknown_func() in x.php on line 5
$ php -v
PHP 5.3.8 (cli) (built: Dec 6 2011 09:52:48)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Xdebug v2.2.0, Copyright (c) 2002-2012, by Derick Rethans
Also works fine on my ubuntu system running `PHP 5.3.10-1ubuntu3.5`
Maybe this is less lolphp and more lolyourlousyubuntubuild<|eor|><|soopr|>I stand by my original statement: It seems to be fixed between 5.3.3-7+squeeze16 and 5.4.9-4ubuntu2.2.
You're running 5.3.10-1ubuntu3.5 and 5.3.8 - both of which are between 5.3.3-7+squeeze16 and 5.4.9-4ubuntu2.2.
The ubuntu version is the one that _works_ btw. The debian version had the bug.<|eoopr|><|eoss|><|endoftext|> | 5 |
lolphp | TLUL | ywk69 | <|sols|><|sot|>$ternary_operator? TRUE : $logic? FALSE : FILE_NOT_FOUND<|eot|><|sol|>http://www.phpsadness.com/sad/30<|eol|><|eols|><|endoftext|> | 15 |
lolphp | skztr | c5zge15 | <|sols|><|sot|>$ternary_operator? TRUE : $logic? FALSE : FILE_NOT_FOUND<|eot|><|sol|>http://www.phpsadness.com/sad/30<|eol|><|sor|>There is an argument to be made that PHP is wrong, because it inherits a ridiculous syntax which no two people would have ever independently come up with, while not inheriting the precedence. That is: it is consistent with other languages where it does not at all matter, and inconsistent where it might matter.
I happen to agree with that argument.
However, I believe there is an equally-valid argument that anyone who writes things in the form:
$x = condition ? condition ? value : value : value;
ought to be shot<|eor|><|eols|><|endoftext|> | 9 |
lolphp | FireyFly | c5zm709 | <|sols|><|sot|>$ternary_operator? TRUE : $logic? FALSE : FILE_NOT_FOUND<|eot|><|sol|>http://www.phpsadness.com/sad/30<|eol|><|sor|>There is an argument to be made that PHP is wrong, because it inherits a ridiculous syntax which no two people would have ever independently come up with, while not inheriting the precedence. That is: it is consistent with other languages where it does not at all matter, and inconsistent where it might matter.
I happen to agree with that argument.
However, I believe there is an equally-valid argument that anyone who writes things in the form:
$x = condition ? condition ? value : value : value;
ought to be shot<|eor|><|sor|>It's much better if you format it a bit like Lisp:
$x = condition ?
value : condition ?
value : value;
Well, using proper operator precedence.<|eor|><|sor|>Another variant is
$x = condition? value
: condition? value
: /*otherwise*/ value
...giving it a bit of a `cond`-style look (again, assuming proper operator precedence).<|eor|><|eols|><|endoftext|> | 5 |
lolphp | Jinxuan | eli61p | <|soss|><|sot|>Getting ::class from instance will give an Parser error<|eot|><|sost|>In php, `::class` looks like a constant. However, php parser decide to make it different in the following situation
<?php
class A {
const X = 1;
}
echo A::class;
$a = new A;
echo $a::X;
echo $a::class; // PHP Fatal error: Cannot use ::class with dynamic class name
echo (new A)::class; // But this works!
I know there is a function named `get_class`, but it is still strange that php treats `::class` inconsistently.
Why it is parser error when it claims to be a fatal error? Because if you run `php -l` with the code, it will give you the error.<|eost|><|eoss|><|endoftext|> | 16 |
lolphp | pease_pudding | fdigzey | <|soss|><|sot|>Getting ::class from instance will give an Parser error<|eot|><|sost|>In php, `::class` looks like a constant. However, php parser decide to make it different in the following situation
<?php
class A {
const X = 1;
}
echo A::class;
$a = new A;
echo $a::X;
echo $a::class; // PHP Fatal error: Cannot use ::class with dynamic class name
echo (new A)::class; // But this works!
I know there is a function named `get_class`, but it is still strange that php treats `::class` inconsistently.
Why it is parser error when it claims to be a fatal error? Because if you run `php -l` with the code, it will give you the error.<|eost|><|sor|>::class is evaluated at compile time, so it cannot evaluate a variable (even if it seems obvious what it ought to refer to)<|eor|><|eoss|><|endoftext|> | 20 |
lolphp | nikic | fdkcslx | <|soss|><|sot|>Getting ::class from instance will give an Parser error<|eot|><|sost|>In php, `::class` looks like a constant. However, php parser decide to make it different in the following situation
<?php
class A {
const X = 1;
}
echo A::class;
$a = new A;
echo $a::X;
echo $a::class; // PHP Fatal error: Cannot use ::class with dynamic class name
echo (new A)::class; // But this works!
I know there is a function named `get_class`, but it is still strange that php treats `::class` inconsistently.
Why it is parser error when it claims to be a fatal error? Because if you run `php -l` with the code, it will give you the error.<|eost|><|sor|>https://github.com/php/php-src/pull/5065<|eor|><|eoss|><|endoftext|> | 8 |
lolphp | mr-strange | 6o7djw | <|sols|><|sot|>You changed the code, you didn't refactor the code.<|eot|><|sol|>https://dev.to/gonedark/you-changed-the-code-you-didnt-refactor-the-code<|eol|><|eols|><|endoftext|> | 15 |
lolphp | Grimy_ | dkfa3lx | <|sols|><|sot|>You changed the code, you didn't refactor the code.<|eot|><|sol|>https://dev.to/gonedark/you-changed-the-code-you-didnt-refactor-the-code<|eol|><|sor|>Why is this an lolphp? This was just a bad refactor regardless of the language.<|eor|><|sor|>Its a refactor that looked obviously correct, but turned out to be incorrect because in PHP, `empty("0")` is true, which is incredibly idiotic.
Also, `empty` is only needed in the first place because the developer doing the refactoring wanted to preserve the misfeature/bug that calling `before` with an empty needle returns the entire haystack, which makes no sense.<|eor|><|eols|><|endoftext|> | 39 |
lolphp | cleeder | dkf7k3s | <|sols|><|sot|>You changed the code, you didn't refactor the code.<|eot|><|sol|>https://dev.to/gonedark/you-changed-the-code-you-didnt-refactor-the-code<|eol|><|sor|>Why is this an lolphp? This was just a bad refactor regardless of the language.<|eor|><|eols|><|endoftext|> | 19 |
lolphp | mr-strange | dkfdcvq | <|sols|><|sot|>You changed the code, you didn't refactor the code.<|eot|><|sol|>https://dev.to/gonedark/you-changed-the-code-you-didnt-refactor-the-code<|eol|><|sor|>Why is this an lolphp? This was just a bad refactor regardless of the language.<|eor|><|sor|>Its a refactor that looked obviously correct, but turned out to be incorrect because in PHP, `empty("0")` is true, which is incredibly idiotic.
Also, `empty` is only needed in the first place because the developer doing the refactoring wanted to preserve the misfeature/bug that calling `before` with an empty needle returns the entire haystack, which makes no sense.<|eor|><|soopr|>Thanks for spelling it out. I naively thought it needed no explanation.<|eoopr|><|eols|><|endoftext|> | 7 |
lolphp | squiggleslash | dkgd73v | <|sols|><|sot|>You changed the code, you didn't refactor the code.<|eot|><|sol|>https://dev.to/gonedark/you-changed-the-code-you-didnt-refactor-the-code<|eol|><|sor|>Why is this an lolphp? This was just a bad refactor regardless of the language.<|eor|><|sor|>Yeah. It's an LOL (including the post criticizing it, which invents a new definition of "refactor", namely allowing something to be completely different code to be a refactor if it generates the same result) but not really a LOLPHP even if rewrite had a bug in it caused by PHP's stupid "Let's call a function one thing that does something else, that you already can do easily without the function" choices.<|eor|><|sor|>Wait, "writing completely different code that generates the same result" *is performing a refactor*. What definition of "refactor" do you use that excludes that?<|eor|><|sor|>That's a rewrite. A refactor is moving existing code around into a new structure - for example, splitting out part of a monolithic application into a library. Since when has refactor meant rewrite? That's just destroying a word and thus making it harder to describe the same concept without adding anything.
<|eor|><|eols|><|endoftext|> | 7 |
lolphp | squiggleslash | dkfkd39 | <|sols|><|sot|>You changed the code, you didn't refactor the code.<|eot|><|sol|>https://dev.to/gonedark/you-changed-the-code-you-didnt-refactor-the-code<|eol|><|sor|>Why is this an lolphp? This was just a bad refactor regardless of the language.<|eor|><|sor|>Yeah. It's an LOL (including the post criticizing it, which invents a new definition of "refactor", namely allowing something to be completely different code to be a refactor if it generates the same result) but not really a LOLPHP even if rewrite had a bug in it caused by PHP's stupid "Let's call a function one thing that does something else, that you already can do easily without the function" choices.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | iglocska | dl0h84v | <|sols|><|sot|>You changed the code, you didn't refactor the code.<|eot|><|sol|>https://dev.to/gonedark/you-changed-the-code-you-didnt-refactor-the-code<|eol|><|sor|>Why is this an lolphp? This was just a bad refactor regardless of the language.<|eor|><|sor|>Its a refactor that looked obviously correct, but turned out to be incorrect because in PHP, `empty("0")` is true, which is incredibly idiotic.
Also, `empty` is only needed in the first place because the developer doing the refactoring wanted to preserve the misfeature/bug that calling `before` with an empty needle returns the entire haystack, which makes no sense.<|eor|><|sor|>empty("0") is indeed something that belongs here, however, there are many other cases where empty($var) would be true that don't look nearly as stupid (such as 0, null, false) and break compatibility with the old behaviour.
But yeah just seeing empty("0") evaluate to true give me a headache.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | Sjoerder | 67mzuj | <|sols|><|sot|>Checking whether files exist outside open_basedir<|eot|><|sol|>http://www.sjoerdlangkemper.nl/2017/04/26/php-open-basedir/<|eol|><|eols|><|endoftext|> | 15 |
lolphp | yxpow | dgrpbql | <|sols|><|sot|>Checking whether files exist outside open_basedir<|eot|><|sol|>http://www.sjoerdlangkemper.nl/2017/04/26/php-open-basedir/<|eol|><|sor|>the best LOL is that it emits a warning instead of an error when trying to access a file outside of the basedir, but then again I was half expecting it to so...<|eor|><|eols|><|endoftext|> | 11 |
lolphp | Danack | dgrxh1p | <|sols|><|sot|>Checking whether files exist outside open_basedir<|eot|><|sol|>http://www.sjoerdlangkemper.nl/2017/04/26/php-open-basedir/<|eol|><|sor|>The real lolphp here is that the code in PHP that attempts to make it be 'secure' within a shared environment hasn't been removed yet.
Although shared hosting was kind of a reasonable thing to do, up until the early 2000's. However VPS servers are so cheap these days, or isolation can be performed at the OS level, that anyone who is still using shared hosting needs their head examining.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | pascalhofmann | 617zt6 | <|soss|><|sot|>Strange return value of datefmt_parse. Can somebody explain why?<|eot|><|sost|> php > var_dump(datefmt_parse(new \IntlDateFormatter('en_US', \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE), 'NaN-NaN-NaN'));
int(-62170156800) // wtf? (that's -0001-11-28 as DateTime)
php > var_dump(datefmt_parse(new \IntlDateFormatter('en_US', \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE), 'NaN-NaN-NbN'));
bool(false) // makes sense
php > var_dump(datefmt_parse(new \IntlDateFormatter('en_US', \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE), '0-0-0'));
int(-62170156800) // wtf again
php > var_dump(datefmt_parse(new \IntlDateFormatter('en_US', \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE), '0000-00-00'));
int(943920000) // 1999-11-30<|eost|><|eoss|><|endoftext|> | 15 |
lolphp | ealf | dfdyet9 | <|soss|><|sot|>Strange return value of datefmt_parse. Can somebody explain why?<|eot|><|sost|> php > var_dump(datefmt_parse(new \IntlDateFormatter('en_US', \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE), 'NaN-NaN-NaN'));
int(-62170156800) // wtf? (that's -0001-11-28 as DateTime)
php > var_dump(datefmt_parse(new \IntlDateFormatter('en_US', \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE), 'NaN-NaN-NbN'));
bool(false) // makes sense
php > var_dump(datefmt_parse(new \IntlDateFormatter('en_US', \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE), '0-0-0'));
int(-62170156800) // wtf again
php > var_dump(datefmt_parse(new \IntlDateFormatter('en_US', \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE), '0000-00-00'));
int(943920000) // 1999-11-30<|eost|><|sor|>That *is* weird -- I would have expected the 0th of Nullary to be the *30th* of November.<|eor|><|eoss|><|endoftext|> | 7 |
lolphp | Sarcastinator | dfcwbnq | <|soss|><|sot|>Strange return value of datefmt_parse. Can somebody explain why?<|eot|><|sost|> php > var_dump(datefmt_parse(new \IntlDateFormatter('en_US', \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE), 'NaN-NaN-NaN'));
int(-62170156800) // wtf? (that's -0001-11-28 as DateTime)
php > var_dump(datefmt_parse(new \IntlDateFormatter('en_US', \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE), 'NaN-NaN-NbN'));
bool(false) // makes sense
php > var_dump(datefmt_parse(new \IntlDateFormatter('en_US', \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE), '0-0-0'));
int(-62170156800) // wtf again
php > var_dump(datefmt_parse(new \IntlDateFormatter('en_US', \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE), '0000-00-00'));
int(943920000) // 1999-11-30<|eost|><|sor|>Uh, where's `datefmt_parse` from? [The manual doesn't seem to mention it.](http://php.net/manual-lookup.php?pattern=datefmt_parse)<|eor|><|sor|>http://docs.php.net/manual/da/intldateformatter.parse.php<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | phpcoder05 | 4oc2y5 | <|sols|><|sot|>Still sucking<|eot|><|sol|>https://evertpot.com/PHP-Sucks/<|eol|><|eols|><|endoftext|> | 15 |
lolphp | probuLing | 40omfc | <|soss|><|sot|>Unset(tling) iteration by reference.<|eot|><|sost|>I bumped into this bug today: https://bugs.php.net/bug.php?id=29992. Glad to know it's still alive in 2015 and causing unexpected headaches ~
TLDR suppose
$arr = array(array('id' => 1, 'attr' => 'a'), array('id' => 2, 'attr' => 'b'), array('id' => 3, 'attr' => 'c'));
Now you do
foreach ($arr as &$item){
$item['attr2'] = $item['id'].$item['attr'];
}
You might expect that $arr's value is now
array(
array('id' => 1, 'attr' => 'a', 'attr2' => '1a'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
array('id' => 3, 'attr' => 'c', 'attr2' => '3c'),
)
But actually you'll have (when you try iterating over it again)
array(
array('id' => 1, 'attr' => 'a', 'attr2' => '1a'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
)
Apparently it's expected behavior. Right... until it's not, just unset($item) after iteration ~.~
P.S. Reddit formatting is weird to me (where's the preview button x.x) so I hope I didn't mess up my made up example.<|eost|><|eoss|><|endoftext|> | 14 |
lolphp | carlos_vini | cyvy0zk | <|soss|><|sot|>Unset(tling) iteration by reference.<|eot|><|sost|>I bumped into this bug today: https://bugs.php.net/bug.php?id=29992. Glad to know it's still alive in 2015 and causing unexpected headaches ~
TLDR suppose
$arr = array(array('id' => 1, 'attr' => 'a'), array('id' => 2, 'attr' => 'b'), array('id' => 3, 'attr' => 'c'));
Now you do
foreach ($arr as &$item){
$item['attr2'] = $item['id'].$item['attr'];
}
You might expect that $arr's value is now
array(
array('id' => 1, 'attr' => 'a', 'attr2' => '1a'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
array('id' => 3, 'attr' => 'c', 'attr2' => '3c'),
)
But actually you'll have (when you try iterating over it again)
array(
array('id' => 1, 'attr' => 'a', 'attr2' => '1a'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
)
Apparently it's expected behavior. Right... until it's not, just unset($item) after iteration ~.~
P.S. Reddit formatting is weird to me (where's the preview button x.x) so I hope I didn't mess up my made up example.<|eost|><|sor|>The lesson we can get from this is don't use references. It's pretty hard to debug code with references and there's no real reason to use them.<|eor|><|eoss|><|endoftext|> | 9 |
lolphp | n0rs | cywik7i | <|soss|><|sot|>Unset(tling) iteration by reference.<|eot|><|sost|>I bumped into this bug today: https://bugs.php.net/bug.php?id=29992. Glad to know it's still alive in 2015 and causing unexpected headaches ~
TLDR suppose
$arr = array(array('id' => 1, 'attr' => 'a'), array('id' => 2, 'attr' => 'b'), array('id' => 3, 'attr' => 'c'));
Now you do
foreach ($arr as &$item){
$item['attr2'] = $item['id'].$item['attr'];
}
You might expect that $arr's value is now
array(
array('id' => 1, 'attr' => 'a', 'attr2' => '1a'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
array('id' => 3, 'attr' => 'c', 'attr2' => '3c'),
)
But actually you'll have (when you try iterating over it again)
array(
array('id' => 1, 'attr' => 'a', 'attr2' => '1a'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
)
Apparently it's expected behavior. Right... until it's not, just unset($item) after iteration ~.~
P.S. Reddit formatting is weird to me (where's the preview button x.x) so I hope I didn't mess up my made up example.<|eost|><|sor|>Reddit uses a variation of markdown called snudown. Reddit Enhancement Suite comes with a preview feature.<|eor|><|eoss|><|endoftext|> | 7 |
lolphp | phpguy2 | cywffls | <|soss|><|sot|>Unset(tling) iteration by reference.<|eot|><|sost|>I bumped into this bug today: https://bugs.php.net/bug.php?id=29992. Glad to know it's still alive in 2015 and causing unexpected headaches ~
TLDR suppose
$arr = array(array('id' => 1, 'attr' => 'a'), array('id' => 2, 'attr' => 'b'), array('id' => 3, 'attr' => 'c'));
Now you do
foreach ($arr as &$item){
$item['attr2'] = $item['id'].$item['attr'];
}
You might expect that $arr's value is now
array(
array('id' => 1, 'attr' => 'a', 'attr2' => '1a'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
array('id' => 3, 'attr' => 'c', 'attr2' => '3c'),
)
But actually you'll have (when you try iterating over it again)
array(
array('id' => 1, 'attr' => 'a', 'attr2' => '1a'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
)
Apparently it's expected behavior. Right... until it's not, just unset($item) after iteration ~.~
P.S. Reddit formatting is weird to me (where's the preview button x.x) so I hope I didn't mess up my made up example.<|eost|><|sor|>It surprises to me to no end that a language that ships with such basic features fundamentally broken is in use in 2016...<|eor|><|eoss|><|endoftext|> | 6 |
lolphp | nikic | cywgjdj | <|soss|><|sot|>Unset(tling) iteration by reference.<|eot|><|sost|>I bumped into this bug today: https://bugs.php.net/bug.php?id=29992. Glad to know it's still alive in 2015 and causing unexpected headaches ~
TLDR suppose
$arr = array(array('id' => 1, 'attr' => 'a'), array('id' => 2, 'attr' => 'b'), array('id' => 3, 'attr' => 'c'));
Now you do
foreach ($arr as &$item){
$item['attr2'] = $item['id'].$item['attr'];
}
You might expect that $arr's value is now
array(
array('id' => 1, 'attr' => 'a', 'attr2' => '1a'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
array('id' => 3, 'attr' => 'c', 'attr2' => '3c'),
)
But actually you'll have (when you try iterating over it again)
array(
array('id' => 1, 'attr' => 'a', 'attr2' => '1a'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
)
Apparently it's expected behavior. Right... until it's not, just unset($item) after iteration ~.~
P.S. Reddit formatting is weird to me (where's the preview button x.x) so I hope I didn't mess up my made up example.<|eost|><|sor|>Your example is wrong. This applies only to *two* consecutive loops, where the first one does iteration by reference, then second one by value and both reuse the same variable.
But regardless, I don't like the behavior and would prefer if the reference was broken after the loop. It's an odd place for PHP to choose consistency over convenience.<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | carlos_vini | cywkyiz | <|soss|><|sot|>Unset(tling) iteration by reference.<|eot|><|sost|>I bumped into this bug today: https://bugs.php.net/bug.php?id=29992. Glad to know it's still alive in 2015 and causing unexpected headaches ~
TLDR suppose
$arr = array(array('id' => 1, 'attr' => 'a'), array('id' => 2, 'attr' => 'b'), array('id' => 3, 'attr' => 'c'));
Now you do
foreach ($arr as &$item){
$item['attr2'] = $item['id'].$item['attr'];
}
You might expect that $arr's value is now
array(
array('id' => 1, 'attr' => 'a', 'attr2' => '1a'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
array('id' => 3, 'attr' => 'c', 'attr2' => '3c'),
)
But actually you'll have (when you try iterating over it again)
array(
array('id' => 1, 'attr' => 'a', 'attr2' => '1a'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
)
Apparently it's expected behavior. Right... until it's not, just unset($item) after iteration ~.~
P.S. Reddit formatting is weird to me (where's the preview button x.x) so I hope I didn't mess up my made up example.<|eost|><|sor|>Your example is wrong. This applies only to *two* consecutive loops, where the first one does iteration by reference, then second one by value and both reuse the same variable.
But regardless, I don't like the behavior and would prefer if the reference was broken after the loop. It's an odd place for PHP to choose consistency over convenience.<|eor|><|sor|>Even if we don't use references the $item variable will continue to exist after the foreach block, one could say that the variables for $key and $value should be local to that block. I mean, if the variable was local this problem wouldn't happen<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | aneesiqbal | 3qac2s | <|sols|><|sot|>Q: Embedding a PHP Server in Chromium (Electron)<|eot|><|sol|>https://github.com/atom/electron/issues/1484<|eol|><|eols|><|endoftext|> | 15 |
lolphp | ElusiveGuy | cwh0l9s | <|sols|><|sot|>Q: Embedding a PHP Server in Chromium (Electron)<|eot|><|sol|>https://github.com/atom/electron/issues/1484<|eol|><|sor|>> It would be nice if php was a thing here, but it would be all the more difficult because of servers. There are many js things for it though. I will try to find a MySQL script.
Can I get a translation here? Difficult "because of servers"? What's MySQL suddenly got to do with this?<|eor|><|eols|><|endoftext|> | 10 |
lolphp | FionaSarah | cwevzc5 | <|sols|><|sot|>Q: Embedding a PHP Server in Chromium (Electron)<|eot|><|sol|>https://github.com/atom/electron/issues/1484<|eol|><|sor|>Reminds me of the people writing TrackMania server controllers in PHP...<|eor|><|sor|>I once wrote an IRC bot in PHP.
lol what a fucking idiot I was. <|eor|><|eols|><|endoftext|> | 8 |
lolphp | Banane9 | cwqp5jy | <|sols|><|sot|>Q: Embedding a PHP Server in Chromium (Electron)<|eot|><|sol|>https://github.com/atom/electron/issues/1484<|eol|><|sor|>Reminds me of the people writing TrackMania server controllers in PHP...<|eor|><|sor|>I once wrote an IRC bot in PHP.
lol what a fucking idiot I was. <|eor|><|sor|>Yeaa... I'm still surprised PHP does sockets xD<|eor|><|sor|>I had to maintain a mission critical piece of PHP software that did raw sockets against an invented-here piece of C that couldn't handle UTF-8. Good times.<|eor|><|sor|>Well, neither can PHP, so it's all good ;)<|eor|><|eols|><|endoftext|> | 7 |
lolphp | Banane9 | cwezjw6 | <|sols|><|sot|>Q: Embedding a PHP Server in Chromium (Electron)<|eot|><|sol|>https://github.com/atom/electron/issues/1484<|eol|><|sor|>Reminds me of the people writing TrackMania server controllers in PHP...<|eor|><|sor|>I once wrote an IRC bot in PHP.
lol what a fucking idiot I was. <|eor|><|sor|>Yeaa... I'm still surprised PHP does sockets xD<|eor|><|eols|><|endoftext|> | 6 |
lolphp | FionaSarah | cwf1fsd | <|sols|><|sot|>Q: Embedding a PHP Server in Chromium (Electron)<|eot|><|sol|>https://github.com/atom/electron/issues/1484<|eol|><|sor|>Reminds me of the people writing TrackMania server controllers in PHP...<|eor|><|sor|>I once wrote an IRC bot in PHP.
lol what a fucking idiot I was. <|eor|><|sor|>Yeaa... I'm still surprised PHP does sockets xD<|eor|><|sor|>It has opengl bindings. <|eor|><|eols|><|endoftext|> | 6 |
lolphp | Banane9 | cwf25w1 | <|sols|><|sot|>Q: Embedding a PHP Server in Chromium (Electron)<|eot|><|sol|>https://github.com/atom/electron/issues/1484<|eol|><|sor|>Reminds me of the people writing TrackMania server controllers in PHP...<|eor|><|sor|>I once wrote an IRC bot in PHP.
lol what a fucking idiot I was. <|eor|><|sor|>Yeaa... I'm still surprised PHP does sockets xD<|eor|><|sor|>It has opengl bindings. <|eor|><|sor|>\*sigh\*<|eor|><|eols|><|endoftext|> | 5 |
lolphp | gerrymandered | 3fq373 | <|soss|><|sot|>var_dump(nonExistentClass::class); // string<|eot|><|sost|>::class can give you the name of a class that does not exist.<|eost|><|eoss|><|endoftext|> | 15 |
lolphp | callcifer | ctqwyaa | <|soss|><|sot|>var_dump(nonExistentClass::class); // string<|eot|><|sost|>::class can give you the name of a class that does not exist.<|eost|><|sor|>Can you imagine the overhead, if every ::class should require a included file?<|eor|><|sor|>And yet, sane languages don't have this problem. This is the result of PHP's namespaces being barely more than compiler assisted copy paste.
`namespace Foo\Bar; class Baz {}` is just `class Foo\\Bar\\Baz {}` in the global namespace. The *proper* way would be to enforce an actual directory structure and have consistent name resolution, which would trivially fix this problem.<|eor|><|eoss|><|endoftext|> | 14 |
lolphp | Schmittfried | ctqy0xp | <|soss|><|sot|>var_dump(nonExistentClass::class); // string<|eot|><|sost|>::class can give you the name of a class that does not exist.<|eost|><|sor|>Can you imagine the overhead, if every ::class should require a included file?<|eor|><|sor|>And yet, sane languages don't have this problem. This is the result of PHP's namespaces being barely more than compiler assisted copy paste.
`namespace Foo\Bar; class Baz {}` is just `class Foo\\Bar\\Baz {}` in the global namespace. The *proper* way would be to enforce an actual directory structure and have consistent name resolution, which would trivially fix this problem.<|eor|><|sor|>I hate languages which force the directory structure to match the namespaces (even though I do that normally). Java is shit. Also, it's not that hard to write an autoloader that does the same, so the only difference is the missing compile time check.
I think the actual problem here is passing classes and methods is just a mere passing of class names and method names. That sucks. Writing *doSomeReflectionWithThis(Classname::class);*
still better than writing *doSomeReflectionWithThis('classname');*
but anyway, I want them to be real first-class citizens. I want tokens to be passed that enforce existence and allow direct access to reflection (I have to instantiate ReflectionClass and it can even fail due to possible non-existent names being passed, wtf).
That's the real lolphp for me. They still haven't managed to introduce proper tokens and stay with passing strings around.<|eor|><|eoss|><|endoftext|> | 10 |
lolphp | Schmittfried | ctqzmye | <|soss|><|sot|>var_dump(nonExistentClass::class); // string<|eot|><|sost|>::class can give you the name of a class that does not exist.<|eost|><|sor|>Can you imagine the overhead, if every ::class should require a included file?<|eor|><|sor|>And yet, sane languages don't have this problem. This is the result of PHP's namespaces being barely more than compiler assisted copy paste.
`namespace Foo\Bar; class Baz {}` is just `class Foo\\Bar\\Baz {}` in the global namespace. The *proper* way would be to enforce an actual directory structure and have consistent name resolution, which would trivially fix this problem.<|eor|><|sor|>I hate languages which force the directory structure to match the namespaces (even though I do that normally). Java is shit. Also, it's not that hard to write an autoloader that does the same, so the only difference is the missing compile time check.
I think the actual problem here is passing classes and methods is just a mere passing of class names and method names. That sucks. Writing *doSomeReflectionWithThis(Classname::class);*
still better than writing *doSomeReflectionWithThis('classname');*
but anyway, I want them to be real first-class citizens. I want tokens to be passed that enforce existence and allow direct access to reflection (I have to instantiate ReflectionClass and it can even fail due to possible non-existent names being passed, wtf).
That's the real lolphp for me. They still haven't managed to introduce proper tokens and stay with passing strings around.<|eor|><|sor|>> I hate languages which force the directory structure to match the namespaces (even though I do that normally)
Well, why do you do it if you hate it so much?
> so the only difference is the missing compile time check
That'a *big* difference.
> [tokens]
Sure, proper tokens in PHP would be nice, but that's never gonna happen. It is *much* easier to solve this specific problem by enforcing structure though.<|eor|><|sor|>No, I said I hate languages that force me to do so. That should be the developer's choice, because sometimes there is a reason not to do so. It just doesn't make sense to make it a compiler error.
>That'a big difference.
Well, since PHP is an interpreted language there are no real compile-time checks, so this is something you have to deal with when using PHP anyway. Therefore, it is not directly related to this discussion.
>Sure, proper tokens in PHP would be nice, but that's never gonna happen. It is much easier to solve this specific problem by enforcing structure though.
In fact this alone wouldn't solve anything in this case. One would still have to enforce autoloading which is not enabled by default (usually I would say there surely is a good reason for that decision, but lol, it's PHP). Anyway, if the PHP developers decided to make autoloading optional, generally enforcing a certain structure is just nonsense. The default autoloader implementation does require that structure and if you write your own one, you can do so, too, so I don't see a problem or lolphp here.
As I said, the lack of tokens is the actual problem here (and tokens would be the only clean solution). And even if we can't have tokens (why not? let those old get_class-like functions stay in the old core for BC and create a completely new one), they could at least check, if the accessed class is known in the current scope instead of just returning a string with a non-existent class name.
I start to like my approach of just adding a *const CLASSNAME = \_\_CLASS\_\_;* to every class. If I access that, at least I know the class exists.<|eor|><|eoss|><|endoftext|> | 10 |
lolphp | callcifer | ctqyskv | <|soss|><|sot|>var_dump(nonExistentClass::class); // string<|eot|><|sost|>::class can give you the name of a class that does not exist.<|eost|><|sor|>Can you imagine the overhead, if every ::class should require a included file?<|eor|><|sor|>And yet, sane languages don't have this problem. This is the result of PHP's namespaces being barely more than compiler assisted copy paste.
`namespace Foo\Bar; class Baz {}` is just `class Foo\\Bar\\Baz {}` in the global namespace. The *proper* way would be to enforce an actual directory structure and have consistent name resolution, which would trivially fix this problem.<|eor|><|sor|>I hate languages which force the directory structure to match the namespaces (even though I do that normally). Java is shit. Also, it's not that hard to write an autoloader that does the same, so the only difference is the missing compile time check.
I think the actual problem here is passing classes and methods is just a mere passing of class names and method names. That sucks. Writing *doSomeReflectionWithThis(Classname::class);*
still better than writing *doSomeReflectionWithThis('classname');*
but anyway, I want them to be real first-class citizens. I want tokens to be passed that enforce existence and allow direct access to reflection (I have to instantiate ReflectionClass and it can even fail due to possible non-existent names being passed, wtf).
That's the real lolphp for me. They still haven't managed to introduce proper tokens and stay with passing strings around.<|eor|><|sor|>> I hate languages which force the directory structure to match the namespaces (even though I do that normally)
Well, why do you do it if you hate it so much?
> so the only difference is the missing compile time check
That'a *big* difference.
> [tokens]
Sure, proper tokens in PHP would be nice, but that's never gonna happen. It is *much* easier to solve this specific problem by enforcing structure though.<|eor|><|eoss|><|endoftext|> | 8 |
lolphp | callcifer | cts7ezt | <|soss|><|sot|>var_dump(nonExistentClass::class); // string<|eot|><|sost|>::class can give you the name of a class that does not exist.<|eost|><|sor|>Can you imagine the overhead, if every ::class should require a included file?<|eor|><|sor|>And yet, sane languages don't have this problem. This is the result of PHP's namespaces being barely more than compiler assisted copy paste.
`namespace Foo\Bar; class Baz {}` is just `class Foo\\Bar\\Baz {}` in the global namespace. The *proper* way would be to enforce an actual directory structure and have consistent name resolution, which would trivially fix this problem.<|eor|><|sor|>Well then - use composer autoloader with a PSR (4) standard. I can't remeber, when was the last time I had to write a custom auto loader, it just works.
IDEs help too, you instantly see, if you have entered an unknown class.<|eor|><|sor|>Yes, I know, I agree. But for ::class resolution to work *properly* (i.e error out if no such class exists) something like PSR-4 *must* be enforced at the language level so the runtime will know where to look *without* `require()`ing the file.
This is obviously never gonna happen, so PHP will never be able to tell whether `Foo\Bar\Baz::class` actually exists or not.<|eor|><|sor|>Still, I don't remember the last time I saw an error - class not found. Use the right tools and this problem just doesn't exist.<|eor|><|sor|>Ah yes, the classic "just don't do it like that" answer to every PHP problem ever.<|eor|><|eoss|><|endoftext|> | 6 |
lolphp | andsens | 340ro7 | <|sols|><|sot|>Because export(parse_str($str)) is just too much of a hassle<|eot|><|sol|>http://php.net/parse_str<|eol|><|eols|><|endoftext|> | 16 |
lolphp | andsens | cqq5tkb | <|sols|><|sot|>Because export(parse_str($str)) is just too much of a hassle<|eot|><|sol|>http://php.net/parse_str<|eol|><|soopr|>> Parses str as if it were the query string passed via a URL and sets variables in the current scope.
Also calling it `parse_str` is more than enough - it's all the parsing you'll ever need. *Obviously* it expects it in the query string format, because how else would you ever want to encode/format your strings?<|eoopr|><|eols|><|endoftext|> | 8 |
lolphp | myaut | cqqo82t | <|sols|><|sot|>Because export(parse_str($str)) is just too much of a hassle<|eot|><|sol|>http://php.net/parse_str<|eol|><|soopr|>> Parses str as if it were the query string passed via a URL and sets variables in the current scope.
Also calling it `parse_str` is more than enough - it's all the parsing you'll ever need. *Obviously* it expects it in the query string format, because how else would you ever want to encode/format your strings?<|eoopr|><|sor|>You're making fun of a function that was around since PHP's birth. And back then, given PHP's web focus, sure, it was the only string parsing at all in the library and it was called parse_str(). PHP has arguably evolved more from its origin than any other language I can think of (maybe Python is a close second).
The standard library of any language has odd bits like that which are left in for BC. See C, C++, Java.<|eor|><|sor|>Oh, PHP standard library.
C11 has removed `gets()` finally. And speaking of K&R C, it was built in times when linkers cannot parse identifiers larger than 8 characters, it has some decent names because of that. But PHP is a dynamic language here, so there is no sane reason for calling function `gzgetss()`.
Speaking of Java, it has some downsides (like redesigning calendars several times), but IMO it is example how API can be _designed_ with _beauty_ in it, not just collecting a random functions with random parameters.
Actually they have a chance to fix that with PHP7, but again... wasted it: http://www.reddit.com/r/lolphp/comments/2xrk10/chump_tries_to_have_phps_functions_be_renamed_to/<|eor|><|eols|><|endoftext|> | 7 |
lolphp | hylje | 2w2mwy | <|sols|><|sot|>Author of Scalar Type Hint, Spaceship/Combined Comparison Operator, Void Return Type & Big Integer Support RFCS quits PHP (xpost /r/php)<|eot|><|sol|>http://news.php.net/php.internals/82750<|eol|><|eols|><|endoftext|> | 13 |
lolphp | willfe42 | con1vpp | <|sols|><|sot|>Author of Scalar Type Hint, Spaceship/Combined Comparison Operator, Void Return Type & Big Integer Support RFCS quits PHP (xpost /r/php)<|eot|><|sol|>http://news.php.net/php.internals/82750<|eol|><|sor|>This doesn't look like lolphp material - all that mail is saying is that the author doesn't have enough time to devote to PHP anymore. That could happen to every contributor to every other language as well.<|eor|><|sor|>Don't be too quick to judge -- there's some good drama brewing in that thread.<|eor|><|eols|><|endoftext|> | 20 |
lolphp | hylje | con1z8v | <|sols|><|sot|>Author of Scalar Type Hint, Spaceship/Combined Comparison Operator, Void Return Type & Big Integer Support RFCS quits PHP (xpost /r/php)<|eot|><|sol|>http://news.php.net/php.internals/82750<|eol|><|sor|>This doesn't look like lolphp material - all that mail is saying is that the author doesn't have enough time to devote to PHP anymore. That could happen to every contributor to every other language as well.<|eor|><|soopr|>If it has anything to do with php-internals drama like /r/php speculates, it's a lolphp. Good enough for me.<|eoopr|><|eols|><|endoftext|> | 10 |
lolphp | that_which_is_lain | cousz41 | <|sols|><|sot|>Author of Scalar Type Hint, Spaceship/Combined Comparison Operator, Void Return Type & Big Integer Support RFCS quits PHP (xpost /r/php)<|eot|><|sol|>http://news.php.net/php.internals/82750<|eol|><|sor|>Plenty of popcorn happening in the internal mailing list.
>I constantly see people giving you shit in here, on Reddit,
StackOverflow Chat and wherever else and it sickens me. They're
condescending, patronising or at the very least missing some P's and
Q's which are fairly important when giving feedback as harsh as they
often give.
> The lack of respect between contributors here in general sickens me,
and I'm not known as somebody who is wildly polite at all times.
http://news.php.net/php.internals/82754
> Unfortunately, the 'toxic kindergarden' claimed another victim. Not the first one, probably not the last one.
> And nobody says that's enough. Nobody says it cannot continue this way, losing the best ones. No reaction. No leadership. No education. No balls.
> It really gets me tired and angry. Who's next ?
http://news.php.net/php.internals/82766
> Andrea Faulds is one of the very good coder , **even she is a beauty
girl.** Push her out now completely. Now you guys feel better, the world got peace? I feel very sad, because the PHP lost a good contributor
http://news.php.net/php.internals/82768
What the fuck does her being a beauty girl have to do with it?
> Again this is really frustrating,
I was already celebrating and planning how I could use/make the best of
scalar type hints on existing code. Even salivating on all those
optimizations planned by other individuals on the community.
http://news.php.net/php.internals/82848
Salivating over having type hints in 2015? There have been strongly typed languages with full type safety for 30+ years. Poor PHP devs.
> Any proposal to the scalar hints problem that doesn't definitively error
out in the `(int) "apple"` case is a non-starter for me;
http://news.php.net/php.internals/82851
(int) "apple" passes in php? lololol
Bonus from another thread:
> We do not have Scalar type hints for years. we code in php for years
> without any type check. it's ok. not the primary things.
>
> Look at other dynamic programming language, they may not have the type
> check either.
>
> It is ok, and it is fine.
>
> Besides php, there be always other choice.
>
> If you really really need type check now. Take a look HHVM.
>
> I guest hacklang will match your need.
>
> If the PHP keep current states, my code will running till the earth dead.
> It works like a ancient rock. What ever , i just care my code work or not.
> Appreciate your time.
>>Do you understand that such condescending and non-constructive attitude pushed Andrea to leave, like many others before her ? but I guess you don't care and won't change your attitude. Really sad.
http://news.php.net/php.internals/82810
<|eor|><|sor|>> [**even she is a beauty girl**](https://pbs.twimg.com/profile_images/568815692539912192/B_OCVR2t.jpeg)
^((she is actually a man)^)<|eor|><|sor|>I think the lesson here is that gender has nothing to do with programming language design.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | FionaSarah | conkr6h | <|sols|><|sot|>Author of Scalar Type Hint, Spaceship/Combined Comparison Operator, Void Return Type & Big Integer Support RFCS quits PHP (xpost /r/php)<|eot|><|sol|>http://news.php.net/php.internals/82750<|eol|><|sor|>This doesn't look like lolphp material - all that mail is saying is that the author doesn't have enough time to devote to PHP anymore. That could happen to every contributor to every other language as well.<|eor|><|soopr|>If it has anything to do with php-internals drama like /r/php speculates, it's a lolphp. Good enough for me.<|eoopr|><|sor|>Wow reading the comments for the original post... The internals team sounds like such a buncha babies.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | FionaSarah | conlatd | <|sols|><|sot|>Author of Scalar Type Hint, Spaceship/Combined Comparison Operator, Void Return Type & Big Integer Support RFCS quits PHP (xpost /r/php)<|eot|><|sol|>http://news.php.net/php.internals/82750<|eol|><|sor|>This doesn't look like lolphp material - all that mail is saying is that the author doesn't have enough time to devote to PHP anymore. That could happen to every contributor to every other language as well.<|eor|><|soopr|>If it has anything to do with php-internals drama like /r/php speculates, it's a lolphp. Good enough for me.<|eoopr|><|sor|>Wow reading the comments for the original post... The internals team sounds like such a buncha babies.<|eor|><|sor|>How do you think PHP has gotten to be such a joke when at v5.3 they had the perfect opportunity to fix everything when namespaces were introduced?<|eor|><|sor|>Yeaaa, I was deep in the community for years, professional for way too long (as much as you can be writing PHP), and going to plenty of conventions and stuff. I left not long after namespaces were introduced, I couldn't believe how pathetically and terribly it was all handled.
I should have really said "the internals team **still** sound like a buncha babies."<|eor|><|eols|><|endoftext|> | 6 |
lolphp | iftpadfs | coswczq | <|sols|><|sot|>Author of Scalar Type Hint, Spaceship/Combined Comparison Operator, Void Return Type & Big Integer Support RFCS quits PHP (xpost /r/php)<|eot|><|sol|>http://news.php.net/php.internals/82750<|eol|><|sor|>Plenty of popcorn happening in the internal mailing list.
>I constantly see people giving you shit in here, on Reddit,
StackOverflow Chat and wherever else and it sickens me. They're
condescending, patronising or at the very least missing some P's and
Q's which are fairly important when giving feedback as harsh as they
often give.
> The lack of respect between contributors here in general sickens me,
and I'm not known as somebody who is wildly polite at all times.
http://news.php.net/php.internals/82754
> Unfortunately, the 'toxic kindergarden' claimed another victim. Not the first one, probably not the last one.
> And nobody says that's enough. Nobody says it cannot continue this way, losing the best ones. No reaction. No leadership. No education. No balls.
> It really gets me tired and angry. Who's next ?
http://news.php.net/php.internals/82766
> Andrea Faulds is one of the very good coder , **even she is a beauty
girl.** Push her out now completely. Now you guys feel better, the world got peace? I feel very sad, because the PHP lost a good contributor
http://news.php.net/php.internals/82768
What the fuck does her being a beauty girl have to do with it?
> Again this is really frustrating,
I was already celebrating and planning how I could use/make the best of
scalar type hints on existing code. Even salivating on all those
optimizations planned by other individuals on the community.
http://news.php.net/php.internals/82848
Salivating over having type hints in 2015? There have been strongly typed languages with full type safety for 30+ years. Poor PHP devs.
> Any proposal to the scalar hints problem that doesn't definitively error
out in the `(int) "apple"` case is a non-starter for me;
http://news.php.net/php.internals/82851
(int) "apple" passes in php? lololol
Bonus from another thread:
> We do not have Scalar type hints for years. we code in php for years
> without any type check. it's ok. not the primary things.
>
> Look at other dynamic programming language, they may not have the type
> check either.
>
> It is ok, and it is fine.
>
> Besides php, there be always other choice.
>
> If you really really need type check now. Take a look HHVM.
>
> I guest hacklang will match your need.
>
> If the PHP keep current states, my code will running till the earth dead.
> It works like a ancient rock. What ever , i just care my code work or not.
> Appreciate your time.
>>Do you understand that such condescending and non-constructive attitude pushed Andrea to leave, like many others before her ? but I guess you don't care and won't change your attitude. Really sad.
http://news.php.net/php.internals/82810
<|eor|><|sor|>>(int) "apple" passes in php? lololol
Of course!
http://3v4l.org/6ReiY<|eor|><|eols|><|endoftext|> | 5 |
lolphp | FionaSarah | coobu7n | <|sols|><|sot|>Author of Scalar Type Hint, Spaceship/Combined Comparison Operator, Void Return Type & Big Integer Support RFCS quits PHP (xpost /r/php)<|eot|><|sol|>http://news.php.net/php.internals/82750<|eol|><|sor|>This doesn't look like lolphp material - all that mail is saying is that the author doesn't have enough time to devote to PHP anymore. That could happen to every contributor to every other language as well.<|eor|><|soopr|>If it has anything to do with php-internals drama like /r/php speculates, it's a lolphp. Good enough for me.<|eoopr|><|sor|>Wow reading the comments for the original post... The internals team sounds like such a buncha babies.<|eor|><|sor|>How do you think PHP has gotten to be such a joke when at v5.3 they had the perfect opportunity to fix everything when namespaces were introduced?<|eor|><|sor|>Yeaaa, I was deep in the community for years, professional for way too long (as much as you can be writing PHP), and going to plenty of conventions and stuff. I left not long after namespaces were introduced, I couldn't believe how pathetically and terribly it was all handled.
I should have really said "the internals team **still** sound like a buncha babies."<|eor|><|sor|>Seriously. It's not that PHP is a bad language IN CONCEPT. Just execution. And it's all the fault of a bunch of narcissistic, egotistical devs.<|eor|><|sor|>I'd argue that any language with weak typing as it's design in bad in concept.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | OneWingedShark | cooy4k4 | <|sols|><|sot|>Author of Scalar Type Hint, Spaceship/Combined Comparison Operator, Void Return Type & Big Integer Support RFCS quits PHP (xpost /r/php)<|eot|><|sol|>http://news.php.net/php.internals/82750<|eol|><|sor|>This doesn't look like lolphp material - all that mail is saying is that the author doesn't have enough time to devote to PHP anymore. That could happen to every contributor to every other language as well.<|eor|><|soopr|>If it has anything to do with php-internals drama like /r/php speculates, it's a lolphp. Good enough for me.<|eoopr|><|sor|>Wow reading the comments for the original post... The internals team sounds like such a buncha babies.<|eor|><|sor|>How do you think PHP has gotten to be such a joke when at v5.3 they had the perfect opportunity to fix everything when namespaces were introduced?<|eor|><|sor|>Yeaaa, I was deep in the community for years, professional for way too long (as much as you can be writing PHP), and going to plenty of conventions and stuff. I left not long after namespaces were introduced, I couldn't believe how pathetically and terribly it was all handled.
I should have really said "the internals team **still** sound like a buncha babies."<|eor|><|sor|>Seriously. It's not that PHP is a bad language IN CONCEPT. Just execution. And it's all the fault of a bunch of narcissistic, egotistical devs.<|eor|><|sor|>I'd argue that any language with weak typing as it's design in bad in concept.<|eor|><|sor|>> I'd argue that any language with weak typing as it's design in bad in concept.
I would agree.
Dynamic typing doesn't *have* to be weak. Lisp, for example, has some good typing and error-handling facilities and is dynamically typed. Conversely, something like Ada is statically typed, with a good typing system. (And there's others w/ good/interesting type-systems like Haskell, Agda, and Coq.)
The weak typing (esp implicit conversions) in conjunction with poor subprogram spec-ing simply kill the usefulness of the the language's usability for any sort of non-trivial or non-small project.
(By "*subprogram spec-ing*", I mean that you cannot be assured the return type, if it returns, the parameter-types, and therefore cannot be assured of *anything* by looking at the function header: it reduces ***every*** act of code inspection to an exercise in tracing the code.)<|eor|><|eols|><|endoftext|> | 5 |
lolphp | Altreus | 1k9lhn | <|sols|><|sot|>An object is turned into an array with no resemblance to the object - posted on irc.freenode.net ##php<|eot|><|sol|>http://viper-7.com/aD7xnX<|eol|><|eols|><|endoftext|> | 17 |
lolphp | cythrawll | cbmsdbm | <|sols|><|sot|>An object is turned into an array with no resemblance to the object - posted on irc.freenode.net ##php<|eot|><|sol|>http://viper-7.com/aD7xnX<|eol|><|sor|>This is documented behavior: http://www.php.net/manual/en/language.types.array.php#language.types.array.casting
>The keys are the member variable names, with a few notable exceptions: integer properties are unaccessible; private variables have the class name prepended to the variable name; protected variables have a '*' prepended to the variable name. These prepended values have null bytes on either side. This can result in some unexpected behaviour
http://viper-7.com/OKGmCp
edit: added example link<|eor|><|eols|><|endoftext|> | 9 |
lolphp | d3m0n_ | cbmt4g7 | <|sols|><|sot|>An object is turned into an array with no resemblance to the object - posted on irc.freenode.net ##php<|eot|><|sol|>http://viper-7.com/aD7xnX<|eol|><|sor|>Now, the real fun is happening here: http://viper-7.com/7NOQx0
When the object has a second member, called Foobar the resulting array will have two fields, both called "Foobar", with different values.
As a different user already postet, this is because the first Foobar has null bytes between the names.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | infinull | cbmr622 | <|sols|><|sot|>An object is turned into an array with no resemblance to the object - posted on irc.freenode.net ##php<|eot|><|sol|>http://viper-7.com/aD7xnX<|eol|><|sor|>At least it got the 5 right.
Can someone explain why this might happen internally? I cannot for the life of my figure out why this behaviour would be a good thing, but then again that sentence applies to all of PHP.<|eor|><|sor|>Python uses `__` variables to "hide" data, it's not really for making data private, but to keep cached copies of helpers that subclasses can't override.
so `self.__Foo` is translated to `self.__ClassName_Foo` internally (if you insepct the `__dict__` on the object (or use `vars`)
It looks like PHP does something similar, it prefixes private variable names with the class name to keep it private.
A nice follow-up would be to see if:
class Foo {
private bar = 5;
}
$a = new Foo();
Edit: it doesn't that would make too much sense (but also be terrible in it's own way).
echo $a->Foobar; //5?
works.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | Serialk | 1bfcin | <|sols|><|sot|>Monads in PHP<|eot|><|sol|>http://blog.clement.delafargue.name/posts/2013-04-01-delicious-burritos-in-php-with-phpz.html<|eol|><|eols|><|endoftext|> | 15 |
lolphp | ArseAssassin | c96mhn6 | <|sols|><|sot|>Monads in PHP<|eot|><|sol|>http://blog.clement.delafargue.name/posts/2013-04-01-delicious-burritos-in-php-with-phpz.html<|eol|><|sor|>Well, I don't see how it could make PHP any worse.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | abadidea | 117j3l | <|sols|><|sot|>PHP Manual Masterpieces (I was told this belongs here)<|eot|><|sol|>http://phpmanualmasterpieces.tumblr.com<|eol|><|eols|><|endoftext|> | 14 |
lolphp | kristovaher | y1oyq | <|sols|><|sot|>Did you know that you cannot make cURL POST request in PHP by having @ symbol as the first value?<|eot|><|sol|>https://plus.google.com/102632377636999004385/posts/j3GTr9TK842<|eol|><|eols|><|endoftext|> | 15 |
lolphp | ealf | c5rt7d2 | <|sols|><|sot|>Did you know that you cannot make cURL POST request in PHP by having @ symbol as the first value?<|eot|><|sol|>https://plus.google.com/102632377636999004385/posts/j3GTr9TK842<|eol|><|sor|>> **[2009-01-21 19:56 UTC] jani@php.****net**
> It's security hole only if you don't filter the input..
... jesus wept<|eor|><|eols|><|endoftext|> | 10 |
lolphp | Rhomboid | c5rqndl | <|sols|><|sot|>Did you know that you cannot make cURL POST request in PHP by having @ symbol as the first value?<|eot|><|sol|>https://plus.google.com/102632377636999004385/posts/j3GTr9TK842<|eol|><|sor|>CLI curl does this too. It's how you send a file instead of raw data.
Not really PHP's fault.<|eor|><|sor|>No, it is entirely PHP's fault. libcurl has no such limitation, in fact it does not implement this '@'-behavior at all. It's implemented in the PHP bindings. And command-line curl has an option to turn off the '@'-interpretation, which was not copied by the PHP bindings.<|eor|><|eols|><|endoftext|> | 9 |
lolphp | huf | c5rivyu | <|sols|><|sot|>Did you know that you cannot make cURL POST request in PHP by having @ symbol as the first value?<|eot|><|sol|>https://plus.google.com/102632377636999004385/posts/j3GTr9TK842<|eol|><|sor|>yes, we found this one too, and the bug is naturally in libcurl's php bindings. we ended up prefixing the '@' with a space and hoping the other side does a trim...
typical php.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | ealf | c5rsa5w | <|sols|><|sot|>Did you know that you cannot make cURL POST request in PHP by having @ symbol as the first value?<|eot|><|sol|>https://plus.google.com/102632377636999004385/posts/j3GTr9TK842<|eol|><|sor|>I think this is my favorite example of how PHP manages to sneak security problems into the most innocent of functions.
In any case, if you're not sending any files, you probably want to use
curl_setopt(_, CURLOPT_POSTFIELDS, http_build_query($array));
Besides not accidentally leaking files, it also uses application/x-www-form-urlencoded rather than multipart/form-data, saving a few bytes.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | Altreus | c5rp4sk | <|sols|><|sot|>Did you know that you cannot make cURL POST request in PHP by having @ symbol as the first value?<|eot|><|sol|>https://plus.google.com/102632377636999004385/posts/j3GTr9TK842<|eol|><|sor|>"I love PHP but" is such a common phrase.
If you loved it you'd let it die in peace<|eor|><|eols|><|endoftext|> | 5 |
lolphp | verifex | x4a1z | <|sols|><|sot|>php.js - A PHP VM using Javascript. Behold!<|eot|><|sol|>http://phpjs.hertzen.com/<|eol|><|eols|><|endoftext|> | 14 |
lolphp | ThisIsADogHello | c5j21tj | <|sols|><|sot|>php.js - A PHP VM using Javascript. Behold!<|eot|><|sol|>http://phpjs.hertzen.com/<|eol|><|sor|>> Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting identifier in /console.htm on line 3
Looks legit!<|eor|><|eols|><|endoftext|> | 21 |
lolphp | esquilax | c5j3enh | <|sols|><|sot|>php.js - A PHP VM using Javascript. Behold!<|eot|><|sol|>http://phpjs.hertzen.com/<|eol|><|sor|>Yo dawg, we heard you hate PHP and Javascript...<|eor|><|eols|><|endoftext|> | 8 |
lolphp | jherazob | q5dlu | <|soss|><|sot|>Page with summary of PHP's "features"?<|eot|><|sost|>Is there any page that summarizes all the "features" PHP has that you can hand to people when they ask "So, what's wrong with PHP then?" and your memory fails you?<|eost|><|eoss|><|endoftext|> | 15 |
lolphp | sjustinas | c3uuuhn | <|soss|><|sot|>Page with summary of PHP's "features"?<|eot|><|sost|>Is there any page that summarizes all the "features" PHP has that you can hand to people when they ask "So, what's wrong with PHP then?" and your memory fails you?<|eost|><|sor|>[PHP Sadness](http://phpsadness.com/), I guess.<|eor|><|eoss|><|endoftext|> | 13 |
lolphp | ManchegoObfuscator | c3uw6lb | <|soss|><|sot|>Page with summary of PHP's "features"?<|eot|><|sost|>Is there any page that summarizes all the "features" PHP has that you can hand to people when they ask "So, what's wrong with PHP then?" and your memory fails you?<|eost|><|sor|>[PHP Sadness](http://phpsadness.com/), I guess.<|eor|><|sor|>I did not know of this site, thanks -- the first thing I clicked on blew my mind:
http://phpsadness.com/sad/16
The fact that that is possible is super sad indeed.<|eor|><|eoss|><|endoftext|> | 9 |
lolphp | infinull | c3uxi1t | <|soss|><|sot|>Page with summary of PHP's "features"?<|eot|><|sost|>Is there any page that summarizes all the "features" PHP has that you can hand to people when they ask "So, what's wrong with PHP then?" and your memory fails you?<|eost|><|sor|>[PHP WTF](http://www.phpwtf.org/) you can also just give the [/top of this subreddit](http://www.reddit.com/r/lolphp/top/).
And someone already mentioned PHP Sadness.<|eor|><|eoss|><|endoftext|> | 6 |
lolphp | huf | ptnlk | <|soss|><|sot|>call_user_func_array() vs reference parameters vs php 5.3<|eot|><|sost|>so why does this:
call_user_func_array('z', array(1));
$x = array(1);
call_user_func_array('z', $x);
function z(&$x) {
echo "CALLED\n";
}
say this:
CALLED
PHP Warning: Parameter 1 to z() expected to be a reference, value given in /home/huf/tmp/x.php on line 5
PHP Stack trace:
PHP 1. {main}() /home/huf/tmp/x.php:0
PHP 2. call_user_func_array() /home/huf/tmp/x.php:5
what's the difference? also what a neat idea to *not* call the function you wanted and also *not* die, but just throw a warning and continue on your merry way. yaay.
<|eost|><|eoss|><|endoftext|> | 14 |
lolphp | infinull | c3s5910 | <|soss|><|sot|>call_user_func_array() vs reference parameters vs php 5.3<|eot|><|sost|>so why does this:
call_user_func_array('z', array(1));
$x = array(1);
call_user_func_array('z', $x);
function z(&$x) {
echo "CALLED\n";
}
say this:
CALLED
PHP Warning: Parameter 1 to z() expected to be a reference, value given in /home/huf/tmp/x.php on line 5
PHP Stack trace:
PHP 1. {main}() /home/huf/tmp/x.php:0
PHP 2. call_user_func_array() /home/huf/tmp/x.php:5
what's the difference? also what a neat idea to *not* call the function you wanted and also *not* die, but just throw a warning and continue on your merry way. yaay.
<|eost|><|sor|>So here's the thing. If you told me that one of these worked and the other didn't, my guess would be that `call_user_func_array('z', array(1));` would be the one that caused the error. And I would lose $5.<|eor|><|eoss|><|endoftext|> | 14 |
lolphp | huf | c3s5r3q | <|soss|><|sot|>call_user_func_array() vs reference parameters vs php 5.3<|eot|><|sost|>so why does this:
call_user_func_array('z', array(1));
$x = array(1);
call_user_func_array('z', $x);
function z(&$x) {
echo "CALLED\n";
}
say this:
CALLED
PHP Warning: Parameter 1 to z() expected to be a reference, value given in /home/huf/tmp/x.php on line 5
PHP Stack trace:
PHP 1. {main}() /home/huf/tmp/x.php:0
PHP 2. call_user_func_array() /home/huf/tmp/x.php:5
what's the difference? also what a neat idea to *not* call the function you wanted and also *not* die, but just throw a warning and continue on your merry way. yaay.
<|eost|><|sor|>So here's the thing. If you told me that one of these worked and the other didn't, my guess would be that `call_user_func_array('z', array(1));` would be the one that caused the error. And I would lose $5.<|eor|><|soopr|>i know :)
i cant even form a consistent mental model of what the everliving fuck it thinks it's doing<|eoopr|><|eoss|><|endoftext|> | 8 |
lolphp | huf | c3s6nxl | <|soss|><|sot|>call_user_func_array() vs reference parameters vs php 5.3<|eot|><|sost|>so why does this:
call_user_func_array('z', array(1));
$x = array(1);
call_user_func_array('z', $x);
function z(&$x) {
echo "CALLED\n";
}
say this:
CALLED
PHP Warning: Parameter 1 to z() expected to be a reference, value given in /home/huf/tmp/x.php on line 5
PHP Stack trace:
PHP 1. {main}() /home/huf/tmp/x.php:0
PHP 2. call_user_func_array() /home/huf/tmp/x.php:5
what's the difference? also what a neat idea to *not* call the function you wanted and also *not* die, but just throw a warning and continue on your merry way. yaay.
<|eost|><|sor|>This is not restricted to call_user_func case
function z (&$x) { print "hi";}
z(1);
which gives you
Fatal error: Only variables can be passed by reference
When a function takes references you need to supply an LVALUE not an RVALUE.
By requiring &$x, the function z is requesting something it may want to mutate. consider this :
function zz (&$x) { $x[] = 1;}
but I did find another lolphp while testing
<|eor|><|soopr|>except if you actually read the example, this has nothing to with rvalue/lvalue-ness
the case you expect *not* to work at all is the one that does.<|eoopr|><|eoss|><|endoftext|> | 7 |
lolphp | audaxxx | c3s9jl9 | <|soss|><|sot|>call_user_func_array() vs reference parameters vs php 5.3<|eot|><|sost|>so why does this:
call_user_func_array('z', array(1));
$x = array(1);
call_user_func_array('z', $x);
function z(&$x) {
echo "CALLED\n";
}
say this:
CALLED
PHP Warning: Parameter 1 to z() expected to be a reference, value given in /home/huf/tmp/x.php on line 5
PHP Stack trace:
PHP 1. {main}() /home/huf/tmp/x.php:0
PHP 2. call_user_func_array() /home/huf/tmp/x.php:5
what's the difference? also what a neat idea to *not* call the function you wanted and also *not* die, but just throw a warning and continue on your merry way. yaay.
<|eost|><|sor|>This is not restricted to call_user_func case
function z (&$x) { print "hi";}
z(1);
which gives you
Fatal error: Only variables can be passed by reference
When a function takes references you need to supply an LVALUE not an RVALUE.
By requiring &$x, the function z is requesting something it may want to mutate. consider this :
function zz (&$x) { $x[] = 1;}
but I did find another lolphp while testing
<|eor|><|soopr|>except if you actually read the example, this has nothing to with rvalue/lvalue-ness
the case you expect *not* to work at all is the one that does.<|eoopr|><|sor|>http://writecodeonline.com/php/ executes yours without error, it crashed it this morning
<|eor|><|sor|>It probably depends on the time of the day.<|eor|><|eoss|><|endoftext|> | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.