subreddit
stringclasses 7
values | author
stringlengths 3
20
| id
stringlengths 5
7
| content
stringlengths 67
30.4k
| score
int64 0
140k
|
---|---|---|---|---|
lolphp | ealf | c36d69i | <|soss|><|sot|>guess what var_dump(unset($a)); outputs...<|eot|><|sost|><|eost|><|sor|>"Parse error: syntax error, unexpected T_UNSET, expecting ')' in php shell code on line 1"?<|eor|><|sor|>I don't see why this is surprising. The manual defines the type of unset(..) as void. PHP correctly spots that `fun1(unset(..))` is illegal (an `unset` cannot be in a parameter list) and barfs out.
I agree that the error message is cryptic, but GCC is no better in this regard.<|eor|><|sor|>No. In PHP, if a function returns void, you should expect var_dump to output `NULL`. `unset()` is not a function, it's a special case in the grammar. One of many, *many* special cases in the grammar.
[Here's the first actual function I could find that is documented to return void](http://us.php.net/manual/en/function.clearstatcache.php), if you [want to try it](http://codepad.org/a3j53Tq7).<|eor|><|eoss|><|endoftext|> | 12 |
lolphp | johlin | c367x4s | <|soss|><|sot|>guess what var_dump(unset($a)); outputs...<|eot|><|sost|><|eost|><|sor|>"Parse error: syntax error, unexpected T_UNSET, expecting ')' in php shell code on line 1"?<|eor|><|eoss|><|endoftext|> | 6 |
lolphp | milki_ | c395mn3 | <|soss|><|sot|>guess what var_dump(unset($a)); outputs...<|eot|><|sost|><|eost|><|sor|>unset() is not a function, but a language construct. It can only be used as statement, not in expression context. Equivalent to `echo` or `(if(if())` in other languages.
There is however the `(unset)` typecast which can. (Doesn't unset though, as there's an expression operand, no var argument.)<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | helgim | c36eb08 | <|soss|><|sot|>guess what var_dump(unset($a)); outputs...<|eot|><|sost|><|eost|><|sor|>"Parse error: syntax error, unexpected T_UNSET, expecting ')' in php shell code on line 1"?<|eor|><|sor|>I don't see why this is surprising. The manual defines the type of unset(..) as void. PHP correctly spots that `fun1(unset(..))` is illegal (an `unset` cannot be in a parameter list) and barfs out.
I agree that the error message is cryptic, but GCC is no better in this regard.<|eor|><|sor|>Unset is a language construct and as thus does not adhere to the rules of regular functions.
This is the case with unset, as well as what's detailed at [this stackoverflow post](http://stackoverflow.com/questions/1180184/what-is-the-difference-between-a-language-construct-and-a-built-in-function-in)<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | kenlubin | iyi5i | <|soss|><|sot|>$php = $sadness and $happiness<|eot|><|sost|>The 'and' operator has lower precedence than assignment. As a result, the following statement evaluates as true:
$var = true and false;
Is there any situation where this could be useful?<|eost|><|eoss|><|endoftext|> | 6 |
lolphp | bobindashadows | c2eezcg | <|soss|><|sot|>$php = $sadness and $happiness<|eot|><|sost|>The 'and' operator has lower precedence than assignment. As a result, the following statement evaluates as true:
$var = true and false;
Is there any situation where this could be useful?<|eost|><|sor|>This comes from perl, most likely. The idiom there is more often:
chdir '/foo' or die "Can't change dir\n"
The idea is that they're for combining statement expressions, often those with side-effects (which is why short-circuiting is used). Ruby has them too.
I never use them.<|eor|><|sor|>Perl has the && and || operators which operate with the higher level of precedence. What does PHP have?<|eor|><|sor|>... && and ||.<|eor|><|eoss|><|endoftext|> | 10 |
lolphp | m4nm34t | c28rt9v | <|soss|><|sot|>$php = $sadness and $happiness<|eot|><|sost|>The 'and' operator has lower precedence than assignment. As a result, the following statement evaluates as true:
$var = true and false;
Is there any situation where this could be useful?<|eost|><|sor|>yes
$php = getSomeResult() or $php = defaultValue;
<|eor|><|eoss|><|endoftext|> | 7 |
lolphp | bobindashadows | c27pyc7 | <|soss|><|sot|>$php = $sadness and $happiness<|eot|><|sost|>The 'and' operator has lower precedence than assignment. As a result, the following statement evaluates as true:
$var = true and false;
Is there any situation where this could be useful?<|eost|><|sor|>This comes from perl, most likely. The idiom there is more often:
chdir '/foo' or die "Can't change dir\n"
The idea is that they're for combining statement expressions, often those with side-effects (which is why short-circuiting is used). Ruby has them too.
I never use them.<|eor|><|eoss|><|endoftext|> | 7 |
lolphp | Altreus | c35pn0o | <|soss|><|sot|>$php = $sadness and $happiness<|eot|><|sost|>The 'and' operator has lower precedence than assignment. As a result, the following statement evaluates as true:
$var = true and false;
Is there any situation where this could be useful?<|eost|><|sor|>This comes from perl, most likely. The idiom there is more often:
chdir '/foo' or die "Can't change dir\n"
The idea is that they're for combining statement expressions, often those with side-effects (which is why short-circuiting is used). Ruby has them too.
I never use them.<|eor|><|sor|>Perl has the && and || operators which operate with the higher level of precedence. What does PHP have?<|eor|><|sor|>... && and ||.<|eor|><|sor|>Nope, these are boolean operators in PHP and hence cast to bool
print_r("a" && "b");
1
In Perl the truthiness of the operands is boolean enough, so the boolean operators return the operands themselves.
perl -E'say "a" && "b"'
b
This is important when your "a" and "b" are more complex expressions, as Perl will give you the result of one of the expressions (most useful with ||)<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | ealf | dy591 | <|sols|><|sot|>PHP can do string replacement in time |input| * |term|^2.<|eot|><|sol|>http://google.com/codesearch/p?hl=en#pFm0LxzAWvs/darwinsource/tarballs/other/apache_mod_php-18.4.tar.gz%7CVIZL9aL0wAg/apache_mod_php-18.4/php/ext/standard/string.c&q=php_strtr%20lang:c%20package:%22http://www.opensource.apple.com/darwinsource/tarballs/other/apache_mod_php-18.4.tar.gz%22&l=1882<|eol|><|eols|><|endoftext|> | 7 |
lolphp | ealf | dt0a6 | <|soss|><|sot|>Default varargs<|eot|><|sost|> function f($x){}
f(); // warning
f(1,2); // no warning
"'cause, who knows, they might want to call func\_get\_args(), we can't tell"<|eost|><|eoss|><|endoftext|> | 6 |
lolphp | Persism | vhhkop | <|sols|><|sot|>Show Thumbnails?<|eot|><|sol|>https://thedailywtf.com/articles/show-thumbnails<|eol|><|eols|><|endoftext|> | 5 |
lolphp | old-shaggy | id7cax8 | <|sols|><|sot|>Show Thumbnails?<|eot|><|sol|>https://thedailywtf.com/articles/show-thumbnails<|eol|><|sor|>How is it lolphp? PHP has nothing to do with bad programmers and you can do same stupid things in other langusges.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | notian | id7d95e | <|sols|><|sot|>Show Thumbnails?<|eot|><|sol|>https://thedailywtf.com/articles/show-thumbnails<|eol|><|sor|>The real wtf is the lack of parentheses, if they had done
`($show_image ?? false) == 1 ? '...' : '';` It would have been obvious to the maintainer what the issue was. The `'== 1'` is also obnoxious. You're doing a loose (==) comparison anyway, so just leave that out `($show_image ?? false ) ? '...' : ''`<|eor|><|eols|><|endoftext|> | 9 |
lolphp | Serialk | 2jumee | <|sols|><|sot|>Wrong on so many levels: "reset() rewinds array's internal pointer to the first element and returns the value of the first array element."<|eot|><|sol|>http://php.net/manual/en/function.reset.php<|eol|><|eols|><|endoftext|> | 5 |
lolphp | allthediamonds | clfy2yy | <|sols|><|sot|>Wrong on so many levels: "reset() rewinds array's internal pointer to the first element and returns the value of the first array element."<|eot|><|sol|>http://php.net/manual/en/function.reset.php<|eol|><|sor|>What's so wrong about it? <|eor|><|sor|>Internal pointers are *a thing*.
Let me do a quick overview of all *features* PHP "arrays" have, starting with the basics:
* They're lists of elements: `$x = [1, 2, 3];`
* And those elements have indices: `$x[0] == 1;`
From this, you would deduce that iterating over an array with three elements numbered 0, 1 and 2 would return those three elements in that order.
Well, guess again:
`$x = [2 => 1, 1 => 2, 0 => 3];`
`foreach ($x as $i) { echo $i; }`
`// prints 123, not 321`
That's right. PHP has an implicit ordering that does not necessarily match the order implied by its numerical indices. *Bazinga*.
But it gets worse, because these "arrays" are not just lists, they're also maps. And, due to the implicit ordering, they're also ordered maps. Keep in mind this is exactly the same data structure as the lists in the previous example, and is treated as one as the same by virtually every function in the PHP ecosystem:
`$y = ["foo" => "bar", 16 => false];`
And of course, you can mix it up:
`$z = ["foo" => "bar", 16 => "baz", "bacon", false];`
Of course, no operation fits nicely in this amalgamation of several data structures into one. Some operations will operate only on values by following the implicit ordering, resetting all keys to match the implicit ordering; others will iterate over values with sequentially numeric keys only and build an array out of that. Some expect you to pass a "list", others expect you to pass a "map", and most will break in subtle ways when you pass the wrong thing.
And then, this map, list or whatever also has an *internal pointer*. This is an invisible value that lives inside the array and points to one of they key-value pairs inside the array by their implicit ordering. Some functions use and mutate this value to simulate iteration. Using this value is a pain in the ass because you have to `reset()` it after every iteration. If you forget, your function is going to iterate over nothing.
Of course, this is PHP, so I've barely touched the surface of the gotchas you'll encounter with PHP arrays. A completely not extensive list of gotchas I can recall by heart:
* Using anything other than a string as a key will cause this to be casted to a string. Unless it's a float, which will be casted to an integer and *then* to a string.
* array_diff and array_intersect cast to string every value of the arrays you pass, which makes them mostly useless. You must use array_udiff and array_uintersect and pass a function wrapping actual equality as an argument.
* [Casting an object to an array causes all elements of the original object to have garbage appended to them for no particular reason.](http://php.net/manual/en/language.types.array.php#language.types.array.casting) This is a consequence of PHP developers lacking anything resembling a brain.
* All elements without explicit key following an element with an explicit numeric key in an array declaration will get numeric keys following the one of the element with an explicit numeric key. In the example above labeled `$z`, `"bacon"` and `false` have keys `17` and `18` respectively.<|eor|><|eols|><|endoftext|> | 20 |
lolphp | allthediamonds | clidyco | <|sols|><|sot|>Wrong on so many levels: "reset() rewinds array's internal pointer to the first element and returns the value of the first array element."<|eot|><|sol|>http://php.net/manual/en/function.reset.php<|eol|><|sor|>What's so wrong about it? <|eor|><|sor|>Internal pointers are *a thing*.
Let me do a quick overview of all *features* PHP "arrays" have, starting with the basics:
* They're lists of elements: `$x = [1, 2, 3];`
* And those elements have indices: `$x[0] == 1;`
From this, you would deduce that iterating over an array with three elements numbered 0, 1 and 2 would return those three elements in that order.
Well, guess again:
`$x = [2 => 1, 1 => 2, 0 => 3];`
`foreach ($x as $i) { echo $i; }`
`// prints 123, not 321`
That's right. PHP has an implicit ordering that does not necessarily match the order implied by its numerical indices. *Bazinga*.
But it gets worse, because these "arrays" are not just lists, they're also maps. And, due to the implicit ordering, they're also ordered maps. Keep in mind this is exactly the same data structure as the lists in the previous example, and is treated as one as the same by virtually every function in the PHP ecosystem:
`$y = ["foo" => "bar", 16 => false];`
And of course, you can mix it up:
`$z = ["foo" => "bar", 16 => "baz", "bacon", false];`
Of course, no operation fits nicely in this amalgamation of several data structures into one. Some operations will operate only on values by following the implicit ordering, resetting all keys to match the implicit ordering; others will iterate over values with sequentially numeric keys only and build an array out of that. Some expect you to pass a "list", others expect you to pass a "map", and most will break in subtle ways when you pass the wrong thing.
And then, this map, list or whatever also has an *internal pointer*. This is an invisible value that lives inside the array and points to one of they key-value pairs inside the array by their implicit ordering. Some functions use and mutate this value to simulate iteration. Using this value is a pain in the ass because you have to `reset()` it after every iteration. If you forget, your function is going to iterate over nothing.
Of course, this is PHP, so I've barely touched the surface of the gotchas you'll encounter with PHP arrays. A completely not extensive list of gotchas I can recall by heart:
* Using anything other than a string as a key will cause this to be casted to a string. Unless it's a float, which will be casted to an integer and *then* to a string.
* array_diff and array_intersect cast to string every value of the arrays you pass, which makes them mostly useless. You must use array_udiff and array_uintersect and pass a function wrapping actual equality as an argument.
* [Casting an object to an array causes all elements of the original object to have garbage appended to them for no particular reason.](http://php.net/manual/en/language.types.array.php#language.types.array.casting) This is a consequence of PHP developers lacking anything resembling a brain.
* All elements without explicit key following an element with an explicit numeric key in an array declaration will get numeric keys following the one of the element with an explicit numeric key. In the example above labeled `$z`, `"bacon"` and `false` have keys `17` and `18` respectively.<|eor|><|sor|>Wow, and I thought JavaScript arrays (which are in fact objects) are bad, but at least they preserve the illusion well enough that you almost never have to care about it.<|eor|><|sor|>JavaScript is bad as in "sloppy, dynamic design which thought type conversions were a nice idea". It has a lot of decisions I strongly disagree with, and I could argue against those decisions.
PHP is a different level of bad. PHP has no bad or good decisions, because it has no decisions at all. Most things are the way they are because it was coded sloppily in the internals and people depend on said sloppy behaviour now. There is no design and no thought behind any of PHP's features. Things just *are*. And for a programming language that runs 70% of the public internet, that's awful and terrifying.<|eor|><|eols|><|endoftext|> | 14 |
lolphp | allthediamonds | clfwtbe | <|sols|><|sot|>Wrong on so many levels: "reset() rewinds array's internal pointer to the first element and returns the value of the first array element."<|eot|><|sol|>http://php.net/manual/en/function.reset.php<|eol|><|sor|>I can't wait until PHP stops being relevant and the phrase "array's internal pointer" is never heard of again.<|eor|><|eols|><|endoftext|> | 10 |
lolphp | vytah | clfef6e | <|sols|><|sot|>Wrong on so many levels: "reset() rewinds array's internal pointer to the first element and returns the value of the first array element."<|eot|><|sol|>http://php.net/manual/en/function.reset.php<|eol|><|sor|>What's so wrong about it? <|eor|><|sor|>I think the worst thing is that the internal pointers exist in the first place.<|eor|><|eols|><|endoftext|> | 10 |
lolphp | allthediamonds | clfwuq7 | <|sols|><|sot|>Wrong on so many levels: "reset() rewinds array's internal pointer to the first element and returns the value of the first array element."<|eot|><|sol|>http://php.net/manual/en/function.reset.php<|eol|><|sor|>Pissing on stuff from the stone ages now?
This is from before foreach syntax. Since then, support for a bunch of things like iterators, stacks, heaps and fixed arrays were added.
If all you want is first() and last(), you can write them yourself with array_slice. If you want reset to clear the array, you can do that within a namespace. Not ideal, but you'll only have to do it once. It's a wart for sure, but not one that bugs any developer worth two shits at all.<|eor|><|sor|>Just the other day I realized that there wasn't an alternative to first() and end() without internal pointer shenanigans.
Fuck everything about PHP.<|eor|><|eols|><|endoftext|> | 9 |
lolphp | 495647h | clfdzfg | <|sols|><|sot|>Wrong on so many levels: "reset() rewinds array's internal pointer to the first element and returns the value of the first array element."<|eot|><|sol|>http://php.net/manual/en/function.reset.php<|eol|><|sor|>What's so wrong about it? <|eor|><|eols|><|endoftext|> | 7 |
lolphp | phasetwenty | clfepvw | <|sols|><|sot|>Wrong on so many levels: "reset() rewinds array's internal pointer to the first element and returns the value of the first array element."<|eot|><|sol|>http://php.net/manual/en/function.reset.php<|eol|><|sor|>What's so wrong about it? <|eor|><|sor|>I wouldn't consider it lolworthy but,
1. Non-obvious behavior
2. Leaky abstraction
<|eor|><|eols|><|endoftext|> | 7 |
lolphp | hyuvii | 2bujki | <|sols|><|sot|>array_merge hates numeric keys<|eot|><|sol|>http://stackoverflow.com/questions/7059721/array-merge-versus<|eol|><|eols|><|endoftext|> | 6 |
lolphp | HelloAnnyong | cj94b7c | <|sols|><|sot|>array_merge hates numeric keys<|eot|><|sol|>http://stackoverflow.com/questions/7059721/array-merge-versus<|eol|><|sor|>The wtf here is that PHP has a single data structure for arrays and hash tables.
Once you understand that fact, I wouldn't exactly call this a wtf. The name `merge` for a function with these semantics is pretty standard in other languages.<|eor|><|eols|><|endoftext|> | 13 |
lolphp | allthediamonds | cj9vt57 | <|sols|><|sot|>array_merge hates numeric keys<|eot|><|sol|>http://stackoverflow.com/questions/7059721/array-merge-versus<|eol|><|sor|>Always use a SALT !!<|eor|><|sor|>What does that have to do with anything?<|eor|><|sor|>prefix your numeric keys with K or N and it would all work out<|eor|><|sor|>That's, uh, not what a salt is.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | edave64 | cj933z5 | <|sols|><|sot|>array_merge hates numeric keys<|eot|><|sol|>http://stackoverflow.com/questions/7059721/array-merge-versus<|eol|><|sor|>Always use a SALT !!<|eor|><|sor|>What does that have to do with anything?<|eor|><|eols|><|endoftext|> | 10 |
lolphp | Plorkyeran | cjbqae4 | <|sols|><|sot|>array_merge hates numeric keys<|eot|><|sol|>http://stackoverflow.com/questions/7059721/array-merge-versus<|eol|><|sor|>The wtf here is that PHP has a single data structure for arrays and hash tables.
Once you understand that fact, I wouldn't exactly call this a wtf. The name `merge` for a function with these semantics is pretty standard in other languages.<|eor|><|sor|>Lua has a single data structure for arrays and hash tables, and nobody calls that a WTF.<|eor|><|sor|>Tables are by far the biggest source of WTFs and confusion in Lua based on my experience with supporting an embedded Lua scripting interface. They're usable once you know all the pitfalls, but practically every table operation has a pitfall of some kind related to that they're an array plus a hash table mashed together with a unified interface.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | allthediamonds | 289r9f | <|sols|><|sot|>"This is the best way to perform an SQL query" PHP's manual, on mysql_query (!)<|eot|><|sol|>http://www.php.net/manual/en/function.mysql-query.php<|eol|><|eols|><|endoftext|> | 4 |
lolphp | DoctorWaluigiTime | ci8te2o | <|sols|><|sot|>"This is the best way to perform an SQL query" PHP's manual, on mysql_query (!)<|eot|><|sol|>http://www.php.net/manual/en/function.mysql-query.php<|eol|><|sor|>It seems like that quote is in the context of using `mysql_query()`, as it's in a comment within an example. Further, there's a big red warning at the top announcing `mysql_query()`'s deprecation and future removal.
It does appear to be a bit silly and out of date, but not so much a lolphp here, in my opinion.<|eor|><|eols|><|endoftext|> | 39 |
lolphp | captainramen | cia5fxl | <|sols|><|sot|>"This is the best way to perform an SQL query" PHP's manual, on mysql_query (!)<|eot|><|sol|>http://www.php.net/manual/en/function.mysql-query.php<|eol|><|sor|>I'm too fucking shocked to parse the rest of the article because php is saying they are gonna deprecate something instead of leave it in for eternity.<|eor|><|sor|>Tbh, they don't say *when* it's actually going to disappear.<|eor|><|sor|>Probably in PHP 9.<|eor|><|sor|>Which will come out after PHPs 10-100 because of some strange type coercion bug.<|eor|><|eols|><|endoftext|> | 15 |
lolphp | allthediamonds | ci8tf0c | <|sols|><|sot|>"This is the best way to perform an SQL query" PHP's manual, on mysql_query (!)<|eot|><|sol|>http://www.php.net/manual/en/function.mysql-query.php<|eol|><|sor|>That "best way" is about building the query string and not mysql_* in general though..<|eor|><|soopr|>Building a query string with sprintf() and mysql_real_escape_string is still not the best way to build an SQL query.<|eoopr|><|eols|><|endoftext|> | 9 |
lolphp | Banane9 | ci8w9sm | <|sols|><|sot|>"This is the best way to perform an SQL query" PHP's manual, on mysql_query (!)<|eot|><|sol|>http://www.php.net/manual/en/function.mysql-query.php<|eol|><|sor|>I'm too fucking shocked to parse the rest of the article because php is saying they are gonna deprecate something instead of leave it in for eternity.<|eor|><|sor|>Tbh, they don't say *when* it's actually going to disappear.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | ealf | j2yzp | <|sols|><|sot|>/* Guess */ for($i=5; $i-->0; ) { switch($i) { case 3: continue; case true: echo 'x'; } echo $i; }<|eot|><|sol|>http://codepad.org/R61tGE1y<|eol|><|eols|><|endoftext|> | 5 |
lolphp | xeen | hm3mq | <|soss|><|sot|>Calling instance functions statically<|eot|><|sost|> class A {
function foo() { echo "foo\n"}
function foo2() { echo $this . "\n"; }
}
A::foo();
A::foo2();
Which will print
foo
A
Instead of at least giving a warning. These are the type of things the some people consider the language as a joke. <|eost|><|eoss|><|endoftext|> | 5 |
lolphp | ealf | elwdj | <|soss|><|sot|>html_entity_decode('& / ' / (') == '& / ' / ('<|eot|><|sost|>Like preg_quote, it has an optional parameter that is required to use it safely.<|eost|><|eoss|><|endoftext|> | 4 |
lolphp | ealf | dowqy | <|sols|><|sot|>__sleep<|eot|><|sol|>http://php.net/__sleep<|eol|><|eols|><|endoftext|> | 6 |
lolphp | 6f944ee6 | 89hrqu | <|sols|><|sot|>foo is true (foo=1)<|eot|><|sol|>https://3v4l.org/AUNE8<|eol|><|eols|><|endoftext|> | 6 |
lolphp | SelfDistinction | dwr5oi6 | <|sols|><|sot|>foo is true (foo=1)<|eot|><|sol|>https://3v4l.org/AUNE8<|eol|><|sor|>Not really a lolphp; more like a lol untyped. Both cases match, so PHP, like any decent language, chooses the first one.<|eor|><|eols|><|endoftext|> | 13 |
lolphp | mikeputerbaugh | dwrhmyq | <|sols|><|sot|>foo is true (foo=1)<|eot|><|sol|>https://3v4l.org/AUNE8<|eol|><|sor|>Not really a lolphp; more like a lol untyped. Both cases match, so PHP, like any decent language, chooses the first one.<|eor|><|soopr|>Your comment doesn't make any sense. Of course this is an lol php. Perhaps Python is the only case where we would see this. JavaScript === would solve the problem
<|eoopr|><|sor|>PHP === would solve the problem, too.
But if the language changed the comparison semantics of the switch statement to use strict comparison instead of loose comparison, a lot of code would break. And not just sloppily written WordPress plugins from 2007; modern code, being written today, by PHP developers who understand and use the language as intended.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | chinahawk | dwrq54a | <|sols|><|sot|>foo is true (foo=1)<|eot|><|sol|>https://3v4l.org/AUNE8<|eol|><|sor|>OP doesn't understand 'break;'. lolop<|eor|><|eols|><|endoftext|> | 5 |
lolphp | renatomefi | 55zd65 | <|sols|><|sot|>My code is confused whether 0 is float or not!<|eot|><|sol|>https://twitter.com/renatomefi/status/783651402363133953<|eol|><|eols|><|endoftext|> | 4 |
lolphp | AdventOfScala | d8kaxcs | <|sols|><|sot|>My code is confused whether 0 is float or not!<|eot|><|sol|>https://twitter.com/renatomefi/status/783651402363133953<|eol|><|sor|>This is not lolphp, but his IDE should be showing 0.0 for $value in the first row.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | nikic | d8gbsjy | <|sols|><|sot|>My code is confused whether 0 is float or not!<|eot|><|sol|>https://twitter.com/renatomefi/status/783651402363133953<|eol|><|sor|>in PHP an integer is not a float:
https://3v4l.org/2eXlN<|eor|><|sor|>the constant expression `0` is not a float, but the variable expression `$value = 0` apparently is<|eor|><|sor|>My best guess is that in this IDE screenshot the `$value = 0` really has value `0.0`, but the IDE does not display the zero fraction. It's fairly common for printers that are not serializers to omit zero fractions.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | FlyLo11 | d8ezxpf | <|sols|><|sot|>My code is confused whether 0 is float or not!<|eot|><|sol|>https://twitter.com/renatomefi/status/783651402363133953<|eol|><|sor|>in PHP an integer is not a float:
https://3v4l.org/2eXlN<|eor|><|eols|><|endoftext|> | 5 |
lolphp | Cuddlefluff_Grim | d8g9gvp | <|sols|><|sot|>My code is confused whether 0 is float or not!<|eot|><|sol|>https://twitter.com/renatomefi/status/783651402363133953<|eol|><|sor|>in PHP an integer is not a float:
https://3v4l.org/2eXlN<|eor|><|sor|>the constant expression `0` is not a float, but the variable expression `$value = 0` apparently is<|eor|><|eols|><|endoftext|> | 5 |
lolphp | cirk2 | 21eofr | <|soss|><|sot|>Argument 1 passed to myFunction() must be an instance of string, string given in /srv/www/file.php<|eot|><|sost|>Why can't php typecheck it's primitive types? It can for custom objects...<|eost|><|eoss|><|endoftext|> | 4 |
lolphp | _vec_ | cggi8ps | <|soss|><|sot|>Argument 1 passed to myFunction() must be an instance of string, string given in /srv/www/file.php<|eot|><|sost|>Why can't php typecheck it's primitive types? It can for custom objects...<|eost|><|sor|>PHP primitives are not objects. This is why the API is `strotupper($myString)` instead of `$myString->toUpper()` like in most other high level class-based languages. So the error is saying that Argument 1 must be an instance of a class named string, but instead a string primitive was given.
I'm not sure if this is better or worse, but `string` is a valid classname:
class string {}
function test(string $param) {
return 'bar';
};
$foo = new string();
print test($foo);
Prints 'bar'.<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | _sgtk | 1x7d1g | <|sols|><|sot|>file_put_contents: "This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE"<|eot|><|sol|>http://php.net/manual/en/function.file-put-contents.php<|eol|><|eols|><|endoftext|> | 4 |
lolphp | ForTheCraic | cf8qq0l | <|sols|><|sot|>file_put_contents: "This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE"<|eot|><|sol|>http://php.net/manual/en/function.file-put-contents.php<|eol|><|sor|>This seems reasonable. It may successfully write zero bytes, returning 0 or it may fail, returning false.<|eor|><|eols|><|endoftext|> | 24 |
lolphp | Various_Pickles | cf8s5y4 | <|sols|><|sot|>file_put_contents: "This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE"<|eot|><|sol|>http://php.net/manual/en/function.file-put-contents.php<|eol|><|sor|>This seems reasonable. It may successfully write zero bytes, returning 0 or it may fail, returning false.<|eor|><|sor|>Actually the prototype on that page says `int file_put_contents ...`, so I wouldn't expect a boolean return value.
If you want to signal an error, wouldn't it be better to throw an expection (which probably wasn't possible when this method was conceived) or return a negative value?<|eor|><|sor|>Better yet, throw both an object-oriented exception, trigger a platform error, and send an ERR/SIG/TERM signal.
Then evaluate a regexp replacement string as code :)<|eor|><|eols|><|endoftext|> | 11 |
lolphp | h0rst_ | cf8rum0 | <|sols|><|sot|>file_put_contents: "This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE"<|eot|><|sol|>http://php.net/manual/en/function.file-put-contents.php<|eol|><|sor|>This seems reasonable. It may successfully write zero bytes, returning 0 or it may fail, returning false.<|eor|><|sor|>Actually the prototype on that page says `int file_put_contents ...`, so I wouldn't expect a boolean return value.
If you want to signal an error, wouldn't it be better to throw an expection (which probably wasn't possible when this method was conceived) or return a negative value?<|eor|><|eols|><|endoftext|> | 8 |
lolphp | _vec_ | cf8yfx6 | <|sols|><|sot|>file_put_contents: "This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE"<|eot|><|sol|>http://php.net/manual/en/function.file-put-contents.php<|eol|><|sor|>This seems reasonable. It may successfully write zero bytes, returning 0 or it may fail, returning false.<|eor|><|sor|>This is one of my favorite things about Ruby, incidentally. `0` is truthy. So are `[]`, `''`, `{}`, and literally everything that isn't `false` or `nil`. Instead, most of the core types have an `#empty?` method that returns false if they're, well, empty.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | barubary | cf8u2ij | <|sols|><|sot|>file_put_contents: "This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE"<|eot|><|sol|>http://php.net/manual/en/function.file-put-contents.php<|eol|><|sor|>This seems reasonable. It may successfully write zero bytes, returning 0 or it may fail, returning false.<|eor|><|sor|>Ah, but it could return `"00"` instead of `0`. `"00"` is numerically zero, yet true. Then you couldn't confuse it with `FALSE`!<|eor|><|eols|><|endoftext|> | 7 |
lolphp | ealf | cfaihv7 | <|sols|><|sot|>file_put_contents: "This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE"<|eot|><|sol|>http://php.net/manual/en/function.file-put-contents.php<|eol|><|sor|>This seems reasonable. It may successfully write zero bytes, returning 0 or it may fail, returning false.<|eor|><|sor|>Ah, but it could return `"00"` instead of `0`. `"00"` is numerically zero, yet true. Then you couldn't confuse it with `FALSE`!<|eor|><|sor|>['0 but true'](http://perldoc.perl.org/functions/ioctl.html)<|eor|><|eols|><|endoftext|> | 5 |
lolphp | Porges | vcu8h | <|sols|><|sot|>PHP lets you dereference NULL and set properties on it<|eot|><|sol|>http://www.reddit.com/r/programminghorror/comments/v1bah/php_member_object_of_null_no_problem/<|eol|><|eols|><|endoftext|> | 4 |
lolphp | ealf | f4vgr | <|soss|><|sot|>preg_match('/foo/', 'foo', $m=array(42)); var_dump($m);<|eot|><|sost|><|eost|><|eoss|><|endoftext|> | 3 |
lolphp | ch0wn | empvc | <|soss|><|sot|>count(array() > 0)<|eot|><|sost|>1, obviously. ಠ\_ಠ
<|eost|><|eoss|><|endoftext|> | 4 |
lolphp | shitcanz | csth8w | <|sols|><|sot|>PHP isset/empty madness<|eot|><|sol|>https://repl.it/repls/HollowQuestionableProprietarysoftware<|eol|><|eols|><|endoftext|> | 4 |
lolphp | tdammers | exgzwrp | <|sols|><|sot|>PHP isset/empty madness<|eot|><|sol|>https://repl.it/repls/HollowQuestionableProprietarysoftware<|eol|><|soopr|>So PHP has two functions isset and empty. They are VERY similar and its already questionable why they both exists.
However empty can be used as an expression but isset cant.
True lolphp design.<|eoopr|><|sor|>This isn't design, it's an accident. Both constructs are part of the "verboten" part of PHP - the large set of language features that are best left alone and never even thought about; it's best to think of them as still existing strictly for backwards compatibility purposes.
Then again, the large set of language features that are best left alone is almost identical to the set of all PHP features, so there's that.<|eor|><|eols|><|endoftext|> | 12 |
lolphp | shitcanz | exgyhh6 | <|sols|><|sot|>PHP isset/empty madness<|eot|><|sol|>https://repl.it/repls/HollowQuestionableProprietarysoftware<|eol|><|soopr|>So PHP has two functions isset and empty. They are VERY similar and its already questionable why they both exists.
However empty can be used as an expression but isset cant.
True lolphp design.<|eoopr|><|eols|><|endoftext|> | 5 |
lolphp | teizhen | coku9l | <|sols|><|sot|>Powered by PHP<|eot|><|sol|>https://www.aikzik.com/index.php<|eol|><|eols|><|endoftext|> | 1 |
lolphp | cleeder | ewixo7d | <|sols|><|sot|>Powered by PHP<|eot|><|sol|>https://www.aikzik.com/index.php<|eol|><|sor|>/r/lolshittyprogrammer<|eor|><|eols|><|endoftext|> | 17 |
lolphp | Almamu | ewk57xw | <|sols|><|sot|>Powered by PHP<|eot|><|sol|>https://www.aikzik.com/index.php<|eol|><|sor|>More like lol shitty server configuration<|eor|><|eols|><|endoftext|> | 6 |
lolphp | pirogoeth | 3ess9r | <|sols|><|sot|>PHP File Manager Riddled With Vulnerabilities, Including Backdoor<|eot|><|sol|>https://threatpost.com/php-file-manager-riddled-with-vulnerabilities-including-backdoor/113969<|eol|><|eols|><|endoftext|> | 2 |
lolphp | DoctorWaluigiTime | cti95th | <|sols|><|sot|>PHP File Manager Riddled With Vulnerabilities, Including Backdoor<|eot|><|sol|>https://threatpost.com/php-file-manager-riddled-with-vulnerabilities-including-backdoor/113969<|eol|><|sor|>So is this subreddit about the language, or bad programming?
Because this seems to be about an application written in PHP, as opposed to PHP itself.<|eor|><|eols|><|endoftext|> | 39 |
lolphp | sloat | ctikonh | <|sols|><|sot|>PHP File Manager Riddled With Vulnerabilities, Including Backdoor<|eot|><|sol|>https://threatpost.com/php-file-manager-riddled-with-vulnerabilities-including-backdoor/113969<|eol|><|sor|>So is this subreddit about the language, or bad programming?
Because this seems to be about an application written in PHP, as opposed to PHP itself.<|eor|><|sor|>Some people see it as a problem endemic in the PHP community. Personally, I don't think PHP-core does enough to discourage bad practices, but that's just my opinion.
As far as this sub goes, I don't get why people get so upset about it. The moderators don't seem to be involved here anymore, and never set up any guidelines, so anything goes I guess.<|eor|><|eols|><|endoftext|> | 15 |
lolphp | Bl00dsoul | cti4rqk | <|sols|><|sot|>PHP File Manager Riddled With Vulnerabilities, Including Backdoor<|eot|><|sol|>https://threatpost.com/php-file-manager-riddled-with-vulnerabilities-including-backdoor/113969<|eol|><|sor|>That is the worst hidden backdoor ever...
backdoor user: ```****__DO_NOT_REMOVE_THIS_ENTRY__****```
backdoor hash: da26c70fc120d803e24bff0c5e5f6bdd
resulting password: travan44
How to fix: remove the first line from phpFileManager/db/valid.users
This won't protect you from the other dozen security issues though..
No one should be using md5 in 2015..
<|eor|><|eols|><|endoftext|> | 14 |
lolphp | mesoscalevortex | ctilmr4 | <|sols|><|sot|>PHP File Manager Riddled With Vulnerabilities, Including Backdoor<|eot|><|sol|>https://threatpost.com/php-file-manager-riddled-with-vulnerabilities-including-backdoor/113969<|eol|><|sor|>So is this subreddit about the language, or bad programming?
Because this seems to be about an application written in PHP, as opposed to PHP itself.<|eor|><|sor|>Some people see it as a problem endemic in the PHP community. Personally, I don't think PHP-core does enough to discourage bad practices, but that's just my opinion.
As far as this sub goes, I don't get why people get so upset about it. The moderators don't seem to be involved here anymore, and never set up any guidelines, so anything goes I guess.<|eor|><|sor|>I subscribe because I'm a full time PHP developer and I want to be aware of the weaknesses of the language I work in.<|eor|><|eols|><|endoftext|> | 14 |
lolphp | papers_ | ctiod3w | <|sols|><|sot|>PHP File Manager Riddled With Vulnerabilities, Including Backdoor<|eot|><|sol|>https://threatpost.com/php-file-manager-riddled-with-vulnerabilities-including-backdoor/113969<|eol|><|sor|>So is this subreddit about the language, or bad programming?
Because this seems to be about an application written in PHP, as opposed to PHP itself.<|eor|><|soopr|>Probably would have been better suited for /r/ShittyProgramming, but I figured this would work as well. It's a little about both.<|eoopr|><|sor|>No, it's just shitty programming. Has nothing to do with the language itself.<|eor|><|eols|><|endoftext|> | 13 |
lolphp | cythrawll | ctiglqb | <|sols|><|sot|>PHP File Manager Riddled With Vulnerabilities, Including Backdoor<|eot|><|sol|>https://threatpost.com/php-file-manager-riddled-with-vulnerabilities-including-backdoor/113969<|eol|><|sor|>So is this subreddit about the language, or bad programming?
Because this seems to be about an application written in PHP, as opposed to PHP itself.<|eor|><|soopr|>Probably would have been better suited for /r/ShittyProgramming, but I figured this would work as well. It's a little about both.<|eoopr|><|sor|>It seems overwhelmingly bad programming. Not sure where the lol php is....<|eor|><|eols|><|endoftext|> | 13 |
lolphp | beerdude26 | ctk0j5u | <|sols|><|sot|>PHP File Manager Riddled With Vulnerabilities, Including Backdoor<|eot|><|sol|>https://threatpost.com/php-file-manager-riddled-with-vulnerabilities-including-backdoor/113969<|eol|><|sor|>I subscribe because I'm a full time PHP developer and I want to be aware of the weaknesses of the language I work in.<|eor|><|sor|>Invest in learning HHVM, would be my advice.<|eor|><|sor|>HHVM doesn't fix much. It's a bit faster and has few wtfs less, but it's still PHP.<|eor|><|sor|>Of course. But it's probably the best PHP you're going to get. (Which says a lot)<|eor|><|sor|>[deleted]<|eor|><|sor|>I don't care a single lick about PHP's speed. I care about its robustness, its composability, and its ease of development (refactoring, architecturing, code reusability). PHP scores very, very badly on all of these things.<|eor|><|sor|>[deleted]<|eor|><|sor|>[Language Safety Score](http://deliberate-software.com/safety-rank-part-2/).
PHP: -1. Compare with C#, Rust or Haskell.
Happy to help.
<|eor|><|eols|><|endoftext|> | 8 |
lolphp | myaut | ctj1fg5 | <|sols|><|sot|>PHP File Manager Riddled With Vulnerabilities, Including Backdoor<|eot|><|sol|>https://threatpost.com/php-file-manager-riddled-with-vulnerabilities-including-backdoor/113969<|eol|><|sor|>That is the worst hidden backdoor ever...
backdoor user: ```****__DO_NOT_REMOVE_THIS_ENTRY__****```
backdoor hash: da26c70fc120d803e24bff0c5e5f6bdd
resulting password: travan44
How to fix: remove the first line from phpFileManager/db/valid.users
This won't protect you from the other dozen security issues though..
No one should be using md5 in 2015..
<|eor|><|sor|>- Knock, knock.
- Whos there?
- `****__DO_NOT_REMOVE_THIS_ENTRY__****`
- Asterisk-asterisk-asterisk-underscore-who?
- Shut up, just let me in.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | vytah | ctitks3 | <|sols|><|sot|>PHP File Manager Riddled With Vulnerabilities, Including Backdoor<|eot|><|sol|>https://threatpost.com/php-file-manager-riddled-with-vulnerabilities-including-backdoor/113969<|eol|><|sor|>So is this subreddit about the language, or bad programming?
Because this seems to be about an application written in PHP, as opposed to PHP itself.<|eor|><|sor|>Some people see it as a problem endemic in the PHP community. Personally, I don't think PHP-core does enough to discourage bad practices, but that's just my opinion.
As far as this sub goes, I don't get why people get so upset about it. The moderators don't seem to be involved here anymore, and never set up any guidelines, so anything goes I guess.<|eor|><|sor|>I subscribe because I'm a full time PHP developer and I want to be aware of the weaknesses of the language I work in.<|eor|><|sor|>Invest in learning HHVM, would be my advice.<|eor|><|sor|>HHVM doesn't fix much. It's a bit faster and has few wtfs less, but it's still PHP.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | lracicot | 1d5j9z | <|soss|><|sot|>PHP Catchable fatal error: Argument 1 passed to stringTest() must be an instance of string, string given.<|eot|><|sost|><|eost|><|eoss|><|endoftext|> | 3 |
lolphp | Serialk | 1bxhww | <|sols|><|sot|>Matrix transposition in PHP<|eot|><|sol|>http://rosettacode.org/wiki/Matrix_transposition#PHP<|eol|><|eols|><|endoftext|> | 3 |
lolphp | hahainternet | c9b0408 | <|sols|><|sot|>Matrix transposition in PHP<|eot|><|sol|>http://rosettacode.org/wiki/Matrix_transposition#PHP<|eol|><|sor|>I thought /r/lolphp was about "weird" constructions in the language itself, not about stupid things people write in PHP.<|eor|><|sor|>Surely this is an indictment of the language.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | nstory | qoauc | <|soss|><|sot|>The peculiar case of fgetcsv()<|eot|><|sost|>So, fgetcsv() is broken, but only in that particular way where it will bite you in the ass when you least enjoy that sort of behavior, and you find yourself forced to re-implement what should be standard-fucking-shit.
If you read [the manual entry for fgetcsv()](http://php.net/manual/en/function.fgetcsv.php) you'll see that it accepts a parameter *$escape$* (default '\'). That sounds all well and good, except if you consider that CSV as is somewhat standardized in [this RFC](http://tools.ietf.org/html/rfc4180) does not recognize an escape character... quoting (surrounding fields with double-quotes) is used instead (and fgetcsv() **also** supports this!)
So, the function supports two redundant mechanisms for escaping fields, one of which, backslash escapes, is not recognized by any CSV consumer that matters i.e. Excel. Damnably, this backslash functionality is not even supported by fgetcsv()'s sister function fputcsv(). [Read the manual](http://us3.php.net/manual/en/function.fputcsv.php); it has no parameter for specifying an escape character!
So, how this ends up working out is if you encounter data (possibly created using PHP's fputcsv() function) that happens to write a row, one of the field's of which happens to end in a backslash, fgetcsv() will diligently escape the comma or quote that follows, and **fuck-that-row's-shit-up**. A problem that will only appear in one-in-one-million input. Yeah, the sort of problem that only appears when you think your code is fucking solid.
Oh, two things that make this even better:
The escape character can't be turned off. Pass an empty string in its place? PHP will claim that **YOU** are the fuck up. Really?
Also, even better, [this is a known issue](https://www.google.com/webhp?q=site:bugs.php.net+fgetcsv+backslash).
WTF?<|eost|><|eoss|><|endoftext|> | 3 |
lolphp | ealf | cqqqs | <|soss|><|sot|>It's not a bug, it's a feature: ini_set('user_agent', "PHP\r\nX-MyCustomHeader: Foo") is a documented way to send extra headers<|eot|><|sost|>[Doc link](http://www.php.net/manual/en/wrappers.http.php)<|eost|><|eoss|><|endoftext|> | 3 |
lolphp | Takeoded | j0ptq2 | <|sols|><|sot|>basename("/tmp","tmp") fails<|eot|><|sol|>https://bugs.php.net/bug.php?id=80155<|eol|><|eols|><|endoftext|> | 2 |
lolphp | ArisenDrake | g6ul8ji | <|sols|><|sot|>basename("/tmp","tmp") fails<|eot|><|sol|>https://bugs.php.net/bug.php?id=80155<|eol|><|sor|>More like
"LOL GNU"
Have you even read the answers?
Probably not, because PHP bad amirite?<|eor|><|eols|><|endoftext|> | 9 |
lolphp | farsightxr20 | g6x2byu | <|sols|><|sot|>basename("/tmp","tmp") fails<|eot|><|sol|>https://bugs.php.net/bug.php?id=80155<|eol|><|sor|>"not a bug because GNU does the same thing"
Then why tf doesn't the PHP docs just like to GNU manpages. The whole point of higher-level modern languages is that they abstract all of this weirdness/legacy stuff away...<|eor|><|eols|><|endoftext|> | 8 |
lolphp | ArisenDrake | g6v704s | <|sols|><|sot|>basename("/tmp","tmp") fails<|eot|><|sol|>https://bugs.php.net/bug.php?id=80155<|eol|><|sor|>More like
"LOL GNU"
Have you even read the answers?
Probably not, because PHP bad amirite?<|eor|><|sor|>Why do PHP apologists always shift the blame? I mean common, this is about PHP and not about some GNU behavior. This is too common, bugs are closed because it just seem to be that way in 35+ year old C functions so we go with it ok bye!
The interface PHP exposes could just instead be a exec that calls C directly, why even bother have language level functions if they inherit all legacy crap from years ago?<|eor|><|sor|>Because these functions have the exact same name as their GNU counterparts. You'd expect their behavior to be the same.
If this was some "File" Library - then yes, that would be stupid.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | ArisenDrake | g6vamqj | <|sols|><|sot|>basename("/tmp","tmp") fails<|eot|><|sol|>https://bugs.php.net/bug.php?id=80155<|eol|><|sor|>More like
"LOL GNU"
Have you even read the answers?
Probably not, because PHP bad amirite?<|eor|><|sor|>Why do PHP apologists always shift the blame? I mean common, this is about PHP and not about some GNU behavior. This is too common, bugs are closed because it just seem to be that way in 35+ year old C functions so we go with it ok bye!
The interface PHP exposes could just instead be a exec that calls C directly, why even bother have language level functions if they inherit all legacy crap from years ago?<|eor|><|sor|>Because these functions have the exact same name as their GNU counterparts. You'd expect their behavior to be the same.
If this was some "File" Library - then yes, that would be stupid.<|eor|><|sor|>Why include them in the first place if they just wrap a C function? Why not just have exec and call the c function?<|eor|><|sor|>Try to run the code with the exec on a Windows machine.
PHP is supposed to be multi-platfrom.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | ArisenDrake | g6vg5w3 | <|sols|><|sot|>basename("/tmp","tmp") fails<|eot|><|sol|>https://bugs.php.net/bug.php?id=80155<|eol|><|sor|>More like
"LOL GNU"
Have you even read the answers?
Probably not, because PHP bad amirite?<|eor|><|sor|>Why do PHP apologists always shift the blame? I mean common, this is about PHP and not about some GNU behavior. This is too common, bugs are closed because it just seem to be that way in 35+ year old C functions so we go with it ok bye!
The interface PHP exposes could just instead be a exec that calls C directly, why even bother have language level functions if they inherit all legacy crap from years ago?<|eor|><|sor|>Because these functions have the exact same name as their GNU counterparts. You'd expect their behavior to be the same.
If this was some "File" Library - then yes, that would be stupid.<|eor|><|sor|>Why include them in the first place if they just wrap a C function? Why not just have exec and call the c function?<|eor|><|sor|>Try to run the code with the exec on a Windows machine.
PHP is supposed to be multi-platfrom.<|eor|><|sor|>Supposed to be, but its not. If there is no available counterpart on windows then you are screwed anyway. Running PHP on windows must be a real blessing.<|eor|><|sor|>I don't see your point here.
basename (the PHP function) works perfectly fine on windows. Just like most other stuff (not everything works, that's correct).<|eor|><|eols|><|endoftext|> | 7 |
lolphp | Takeoded | g6uleo2 | <|sols|><|sot|>basename("/tmp","tmp") fails<|eot|><|sol|>https://bugs.php.net/bug.php?id=80155<|eol|><|sor|>More like
"LOL GNU"
Have you even read the answers?
Probably not, because PHP bad amirite?<|eor|><|soopr|>> Have you even read the answers?
I have now - i was the one who submitted that bugreport, and that answer came after this was posted
but yes, it's origins is apparently `LOL GNU`, and PHP decided to copy the LOL, it seems.
edit: added a new response to sjon,
> nowhere in the documentation do i see anything like "if the suffix is the whole name, it will not be cut off", perhaps it is a documentation issue then?
> wonder what the GNU basename documentation says about it, I'll take a look at that<|eoopr|><|eols|><|endoftext|> | 6 |
lolphp | dotted | g6y39bv | <|sols|><|sot|>basename("/tmp","tmp") fails<|eot|><|sol|>https://bugs.php.net/bug.php?id=80155<|eol|><|sor|>It's in the [initial (git) commit...](https://github.com/coreutils/coreutils/commit/ccbd1d7dc5189f4637468a8136f672e60ee0e531#diff-7e1d046275675c503b38ac011e2d058cR61-R78), so at least a 28 year old behaviour.<|eor|><|sor|>[Its 41 year old behaviour](https://en.wikipedia.org/wiki/Basename)<|eor|><|sor|>[deleted]<|eor|><|sor|>From my link
>basename can also be used to remove the end of the base name, **but not the complete base name**
Is that not the EXACT same behavior described in the bug report?<|eor|><|eols|><|endoftext|> | 5 |
lolphp | Takeoded | 99r4ie | <|soss|><|sot|>so.. what are the plans for PHP9?<|eot|><|sost|><|eost|><|eoss|><|endoftext|> | 1 |
lolphp | 4z01235 | e4ptlxv | <|soss|><|sot|>so.. what are the plans for PHP9?<|eot|><|sost|><|eost|><|sor|>> PHP
> plans
Do you have any historical evidence for this assumption?<|eor|><|eoss|><|endoftext|> | 83 |
lolphp | maweki | e4rfrqo | <|soss|><|sot|>so.. what are the plans for PHP9?<|eot|><|sost|><|eost|><|sor|>Are there any nice language features from Python to steal and then implement in a slightly incorrect manner that makes it very much less useful?
Then that's the plan.<|eor|><|eoss|><|endoftext|> | 22 |
lolphp | dotancohen | e5b8gxf | <|soss|><|sot|>so.. what are the plans for PHP9?<|eot|><|sost|><|eost|><|sor|>There will not be a PHP version 9 because that would conflict with legacy code that checks the version string for "PHP 9\*" to identify PHP 95 and PHP 98.
The current RFC is proposing PHP 2000 or PHP XP, however due to poor IIS support it seems that we'll just see PHP Precise Hardy Pangolin instead.<|eor|><|eoss|><|endoftext|> | 22 |
lolphp | olsner | e4pylz7 | <|soss|><|sot|>so.. what are the plans for PHP9?<|eot|><|sost|><|eost|><|sor|>[deleted]<|eor|><|sor|>Oh, PHP 5 is out already? Great news!<|eor|><|eoss|><|endoftext|> | 21 |
lolphp | squiggleslash | e4q1e2f | <|soss|><|sot|>so.. what are the plans for PHP9?<|eot|><|sost|><|eost|><|sor|>[deleted]<|eor|><|soopr|>jokes on you, .php files execute as 5.6, .php7 files execute as 7... 7.0.30<|eoopr|><|sor|>So .php7 meaning "Run using PHP7" must imply that the extension format is ".php{version number}, but that means "" now equals 5.6 as well as null, false, and "0"!<|eor|><|eoss|><|endoftext|> | 17 |
lolphp | SeriTools | e4q2vy4 | <|soss|><|sot|>so.. what are the plans for PHP9?<|eot|><|sost|><|eost|><|sor|>What do you mean?<|eor|><|soopr|>(if you wonder what the initial joke was: if the successor to PHP5 is PHP7, then the PHP7 successor will probably be PHP9, right?)<|eoopr|><|sor|>I honestly wouldn't be surprised.<|eor|><|sor|>My guess would be PHPNaN<|eor|><|eoss|><|endoftext|> | 16 |
lolphp | Takeoded | e4pwopi | <|soss|><|sot|>so.. what are the plans for PHP9?<|eot|><|sost|><|eost|><|sor|>What do you mean?<|eor|><|soopr|>(if you wonder what the initial joke was: if the successor to PHP5 is PHP7, then the PHP7 successor will probably be PHP9, right?)<|eoopr|><|eoss|><|endoftext|> | 14 |
lolphp | carlos_vini | e4r1z1f | <|soss|><|sot|>so.. what are the plans for PHP9?<|eot|><|sost|><|eost|><|sor|>What do you mean?<|eor|><|soopr|>(if you wonder what the initial joke was: if the successor to PHP5 is PHP7, then the PHP7 successor will probably be PHP9, right?)<|eoopr|><|sor|>Nah, it will obviously be PHP 8, and then PHP 10.
​<|eor|><|eoss|><|endoftext|> | 12 |
lolphp | dr3dz1k | e4r7fhn | <|soss|><|sot|>so.. what are the plans for PHP9?<|eot|><|sost|><|eost|><|sor|>What do you mean?<|eor|><|soopr|>(if you wonder what the initial joke was: if the successor to PHP5 is PHP7, then the PHP7 successor will probably be PHP9, right?)<|eoopr|><|sor|>Nah, it will obviously be PHP 8, and then PHP 10.
​<|eor|><|sor|>PHP X<|eor|><|eoss|><|endoftext|> | 10 |
lolphp | Takeoded | e4pv23j | <|soss|><|sot|>so.. what are the plans for PHP9?<|eot|><|sost|><|eost|><|sor|>[deleted]<|eor|><|soopr|>jokes on you, .php files execute as 5.6, .php7 files execute as 7... 7.0.30<|eoopr|><|eoss|><|endoftext|> | 9 |
lolphp | SaraMG | e5djc4j | <|soss|><|sot|>so.. what are the plans for PHP9?<|eot|><|sost|><|eost|><|sor|>Unicode.<|eor|><|sor|>Or more accurately, since a 9 is an upside down 6...
pou :6 H<|eor|><|eoss|><|endoftext|> | 9 |
lolphp | stesch | e61jb9s | <|soss|><|sot|>so.. what are the plans for PHP9?<|eot|><|sost|><|eost|><|sor|>[deleted]<|eor|><|sor|>Still had to maintain 2 big PHP 4 projects at my last job. 2017.
<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | phplovesong | 8pr7bk | <|sols|><|sot|>PHP as a profession<|eot|><|sol|>http://php.net/manual/en/function.delete.php<|eol|><|eols|><|endoftext|> | 4 |