subreddit stringclasses 7
values | author stringlengths 3 20 | id stringlengths 5 7 | content stringlengths 67 30.4k | score int64 0 140k |
|---|---|---|---|---|
lolphp | cfreak2399 | dvx1ti5 | <|sols|><|sot|>Throw an error on bad SQL, but only if it's the first statement!<|eot|><|sol|>https://bugs.php.net/bug.php?id=61613<|eol|><|sor|>Once again PHP proves it can't move forward due to its toxic community.<|eor|><|eols|><|endoftext|> | 25 |
lolphp | Hacre | dvwx9jh | <|sols|><|sot|>Throw an error on bad SQL, but only if it's the first statement!<|eot|><|sol|>https://bugs.php.net/bug.php?id=61613<|eol|><|soopr|>What do you mean it's not obvious that you should use nextRowset() on DELETE or UPDATE queries? WONTFIX<|eoopr|><|eols|><|endoftext|> | 22 |
lolphp | andsens | dvxk96q | <|sols|><|sot|>Throw an error on bad SQL, but only if it's the first statement!<|eot|><|sol|>https://bugs.php.net/bug.php?id=61613<|eol|><|sor|>They should add a new label to their bug tracker: "Working as feared"<|eor|><|eols|><|endoftext|> | 17 |
lolphp | Wouter10123 | dvxr5el | <|sols|><|sot|>Throw an error on bad SQL, but only if it's the first statement!<|eot|><|sol|>https://bugs.php.net/bug.php?id=61613<|eol|><|sor|>"just don't place multiple statements in a single query and then wonder why debug it don't work that well - it's that easy"
Of course! Let's just not use the feature because it hasa bug in it, rather than fixing it.<|eor|><|eols|><|endoftext|> | 13 |
lolphp | roodammy44 | dvxh22o | <|sols|><|sot|>Throw an error on bad SQL, but only if it's the first statement!<|eot|><|sol|>https://bugs.php.net/bug.php?id=61613<|eol|><|sor|>The only way you could consider this not a bug is if you dont know how to write good code. And these guys are in charge of the language.<|eor|><|eols|><|endoftext|> | 13 |
lolphp | AyrA_ch | dvxjdpm | <|sols|><|sot|>Throw an error on bad SQL, but only if it's the first statement!<|eot|><|sol|>https://bugs.php.net/bug.php?id=61613<|eol|><|soopr|>What do you mean it's not obvious that you should use nextRowset() on DELETE or UPDATE queries? WONTFIX<|eoopr|><|sor|>They could at least mention in the docs that the engine has lazy execution of statements. I assume PDO is not designed to execute multiple queries<|eor|><|eols|><|endoftext|> | 9 |
lolphp | AyrA_ch | dvxk9vf | <|sols|><|sot|>Throw an error on bad SQL, but only if it's the first statement!<|eot|><|sol|>https://bugs.php.net/bug.php?id=61613<|eol|><|soopr|>What do you mean it's not obvious that you should use nextRowset() on DELETE or UPDATE queries? WONTFIX<|eoopr|><|sor|>They could at least mention in the docs that the engine has lazy execution of statements. I assume PDO is not designed to execute multiple queries<|eor|><|soopr|>I'm not sure what you mean, PDO absolutely allows you to run multiple queries separated by ; and also will execute queries from a file_get_contents("file.sql") object. The fact that it remains silent without a nextRowset if the first statement is fine is crazy. It'll execute everything fine assuming no errors in the SQL and no calls to nextRowset required. Unless you mean this use case just wasn't considered and simply "happens to work (except when it doesn't)"?<|eoopr|><|sor|>The PDO engine uses lazy execution, which means it evaluates a statement only if needed. This is similar to how LINQ with Entity Framework Tables works in .NET and is actually a nice feature once you get used to it. It's why this is expected behaviour for me but maybe not someone else.
Somebody in the bug report actually mentions the "single query only":
> For example, if you exec() a string containing multiple INSERT statements, only the first statement will be executed. No exception is thrown (PHP 5.5.17, MySQL server 5.5.38).
The docs also say "PDO::exec Execute an SQL statement and return the number of affected rows"
It depends on what you interpret as "an SQL statement". It's ambiguously worded but hints at the fact that you should issue multiple PDO commands, one for each statement. You can do that by the means of transactions as someone demonstrated in the bug:
$pdo->beginTransaction();
try {
$statement = $pdo->prepare($sql);
$statement->execute();
while ($statement->nextRowset()) {/* https://bugs.php.net/bug.php?id=61613 */};
$pdo->commit();
} catch (\PDOException $e) {
$pdo->rollBack();
throw $e;
}
When executing multiple statements you should almost always use transactions anyways.
The "nextRowset()" docs page also only talks about stored procedures and not multiple statements. Which further hints at the fact that this was not designed for multiple statements in one call.
it looks like multiple statements just work because they were never explicitly checked for but were never implemented properly.
In the end, the solution is to update the docs rather than the code.
If the SQL Server is MySQL, you can use `EXPLAIN` to test the query without actually executing it.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | pacotes | 6t09ek | <|sols|><|sot|>PHP no longer considers unserialize() bugs as security issues...<|eot|><|sol|>https://externals.io/message/100147<|eol|><|eols|><|endoftext|> | 37 |
lolphp | Danack | dlh6efk | <|sols|><|sot|>PHP no longer considers unserialize() bugs as security issues...<|eot|><|sol|>https://externals.io/message/100147<|eol|><|sor|>unserialize runs code, based on the input string.
Which is to say, if you pass unserialize a string that can be touched by an attacker, you're allowing remote code execution. How would you expect that to be secure?
And how is that different from Java, which has the same behaviour right? https://foxglovesecurity.com/2015/11/06/what-do-weblogic-websphere-jboss-jenkins-opennms-and-your-application-have-in-common-this-vulnerability/
Or any other language with built-in serialize/deserialize function?<|eor|><|eols|><|endoftext|> | 53 |
lolphp | ReversedGif | dlh74f8 | <|sols|><|sot|>PHP no longer considers unserialize() bugs as security issues...<|eot|><|sol|>https://externals.io/message/100147<|eol|><|sor|>> Treating unserialoze issues as security creates the false sense that we expect it to be secure, when we absolutely don't.
Hooooolllllyyyyy fuuuuuccckkkkkk....<|eor|><|sor|>From Python's `pickle` module:
>Warning
>
>The pickle module is not secure against erroneous or maliciously constructed data. Never unpickle data received from an untrusted or unauthenticated source.
This isn't unusual. There are lots of things very wrong with PHP; this isn't one of them.<|eor|><|eols|><|endoftext|> | 33 |
lolphp | Innominate8 | dlhabnh | <|sols|><|sot|>PHP no longer considers unserialize() bugs as security issues...<|eot|><|sol|>https://externals.io/message/100147<|eol|><|sor|>unserialize runs code, based on the input string.
Which is to say, if you pass unserialize a string that can be touched by an attacker, you're allowing remote code execution. How would you expect that to be secure?
And how is that different from Java, which has the same behaviour right? https://foxglovesecurity.com/2015/11/06/what-do-weblogic-websphere-jboss-jenkins-opennms-and-your-application-have-in-common-this-vulnerability/
Or any other language with built-in serialize/deserialize function?<|eor|><|sor|>As far as I understand, it's not because of remote code execution, which is normal, if the serialized string is unsafe.
From what I understand these bugs are considered security issues because `unserialize()` causes memory corruption and segfaults/crashes with specific crafted inputs.
It's a bit unclear, but I assume the decision to consider these bugs non-security is to avoid fixing them in older PHP versions that still have security support.
It looks like there are/will be plenty of bug reports, until `unserialize()` receives a more robust implementation.<|eor|><|sor|>> unserialize() causes memory corruption and segfaults/crashes with specific crafted inputs.
Like he said, if you're passing `unserialize()` anything that can be touched by an attacker, you're already at game over and any and all effects are possible.
Now, if you can pass those things to `serialize()` and get an output that breaks `unserialize()` that's another story, and would be a legitimate bug but the bug is in `serialize()`.<|eor|><|eols|><|endoftext|> | 19 |
lolphp | FlyLo11 | dlh8jny | <|sols|><|sot|>PHP no longer considers unserialize() bugs as security issues...<|eot|><|sol|>https://externals.io/message/100147<|eol|><|sor|>unserialize runs code, based on the input string.
Which is to say, if you pass unserialize a string that can be touched by an attacker, you're allowing remote code execution. How would you expect that to be secure?
And how is that different from Java, which has the same behaviour right? https://foxglovesecurity.com/2015/11/06/what-do-weblogic-websphere-jboss-jenkins-opennms-and-your-application-have-in-common-this-vulnerability/
Or any other language with built-in serialize/deserialize function?<|eor|><|sor|>As far as I understand, it's not because of remote code execution, which is normal, if the serialized string is unsafe.
From what I understand these bugs are considered security issues because `unserialize()` causes memory corruption and segfaults/crashes with specific crafted inputs.
It's a bit unclear, but I assume the decision to consider these bugs non-security is to avoid fixing them in older PHP versions that still have security support.
It looks like there are/will be plenty of bug reports, until `unserialize()` receives a more robust implementation.<|eor|><|eols|><|endoftext|> | 18 |
lolphp | mayobutter | dlhkfal | <|sols|><|sot|>PHP no longer considers unserialize() bugs as security issues...<|eot|><|sol|>https://externals.io/message/100147<|eol|><|sor|>I've been passing $_SERVER['QUERY_STRING'] straight into eval() in all my PHP scripts. Do you think that also might not be secure?<|eor|><|eols|><|endoftext|> | 15 |
lolphp | the_alias_of_andrea | dli4gt3 | <|sols|><|sot|>PHP no longer considers unserialize() bugs as security issues...<|eot|><|sol|>https://externals.io/message/100147<|eol|><|sor|>unserialize runs code, based on the input string.
Which is to say, if you pass unserialize a string that can be touched by an attacker, you're allowing remote code execution. How would you expect that to be secure?
And how is that different from Java, which has the same behaviour right? https://foxglovesecurity.com/2015/11/06/what-do-weblogic-websphere-jboss-jenkins-opennms-and-your-application-have-in-common-this-vulnerability/
Or any other language with built-in serialize/deserialize function?<|eor|><|sor|>As far as I understand, it's not because of remote code execution, which is normal, if the serialized string is unsafe.
From what I understand these bugs are considered security issues because `unserialize()` causes memory corruption and segfaults/crashes with specific crafted inputs.
It's a bit unclear, but I assume the decision to consider these bugs non-security is to avoid fixing them in older PHP versions that still have security support.
It looks like there are/will be plenty of bug reports, until `unserialize()` receives a more robust implementation.<|eor|><|sor|>> unserialize() causes memory corruption and segfaults/crashes with specific crafted inputs.
Like he said, if you're passing `unserialize()` anything that can be touched by an attacker, you're already at game over and any and all effects are possible.
Now, if you can pass those things to `serialize()` and get an output that breaks `unserialize()` that's another story, and would be a legitimate bug but the bug is in `serialize()`.<|eor|><|sor|>> you're already at game over and any and all effects are possible
Ehh. In theory, the PHP interpreter is supposed to provide some kind of sandboxing (you can disable functions, for example) which this could override. Personally, I'm uncomfortable with having any kind of stack/heap corruption stuff in the interpreter anyway.
In practice, though, you may be right.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | Danack | dlhgni1 | <|sols|><|sot|>PHP no longer considers unserialize() bugs as security issues...<|eot|><|sol|>https://externals.io/message/100147<|eol|><|sor|>unserialize runs code, based on the input string.
Which is to say, if you pass unserialize a string that can be touched by an attacker, you're allowing remote code execution. How would you expect that to be secure?
And how is that different from Java, which has the same behaviour right? https://foxglovesecurity.com/2015/11/06/what-do-weblogic-websphere-jboss-jenkins-opennms-and-your-application-have-in-common-this-vulnerability/
Or any other language with built-in serialize/deserialize function?<|eor|><|sor|>As far as I understand, it's not because of remote code execution, which is normal, if the serialized string is unsafe.
From what I understand these bugs are considered security issues because `unserialize()` causes memory corruption and segfaults/crashes with specific crafted inputs.
It's a bit unclear, but I assume the decision to consider these bugs non-security is to avoid fixing them in older PHP versions that still have security support.
It looks like there are/will be plenty of bug reports, until `unserialize()` receives a more robust implementation.<|eor|><|sor|>> I assume the decision to consider these bugs non-security
I think it's actually more around the process of managing bug reports.
Anything that is classified as a security issue is locked down and not available to view on the bug-tracker, except to the members of the PHP security team, which means that very few people can be aware that the bug needs fixing.
Marking an issue as security related also sets the expectation for people who make the report that the issue will be treated with some urgency. Having the issues be just normal classification makes it clearer that the PHP team isn't going to prioritize fixing them, and that anyone who is putting user controller data through unserialize should change their application.
> unserialize() causes memory corruption and segfaults/crashes with specific crafted inputs.
Most of those should be fixed, as they are general errors in memory access. However even then, unserialize will almost certainly still be vulnerable to making a DOS attack, due to the nature of PHP.
> until unserialize() receives a more robust implementation.
I suspect that will never happen, and that people who want to avoid this potential issue, should instead use some code written in userland to save and then restore the state of data.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | coredumperror | dlh777u | <|sols|><|sot|>PHP no longer considers unserialize() bugs as security issues...<|eot|><|sol|>https://externals.io/message/100147<|eol|><|sor|>> Treating unserialoze issues as security creates the false sense that we expect it to be secure, when we absolutely don't.
Hooooolllllyyyyy fuuuuuccckkkkkk....<|eor|><|sor|>From Python's `pickle` module:
>Warning
>
>The pickle module is not secure against erroneous or maliciously constructed data. Never unpickle data received from an untrusted or unauthenticated source.
This isn't unusual. There are lots of things very wrong with PHP; this isn't one of them.<|eor|><|sor|>Well, shoot.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | Capaj | 5nircq | <|sols|><|sot|>This Czech groupon is so dumbfounded by their app error they are even asking people on Twitter<|eot|><|sol|>https://twitter.com/SlevomatLIVE/status/819487524418650112?s=09<|eol|><|eols|><|endoftext|> | 39 |
lolphp | Cuddlefluff_Grim | dcbxy9p | <|sols|><|sot|>This Czech groupon is so dumbfounded by their app error they are even asking people on Twitter<|eot|><|sol|>https://twitter.com/SlevomatLIVE/status/819487524418650112?s=09<|eol|><|sor|>The guy who says he "fixed it" just decided to ignore the issue of the key mapping and return the transaction directly, so the problem will likely just pop up elsewhere instead.<|eor|><|eols|><|endoftext|> | 15 |
lolphp | the_alias_of_andrea | dcc0ua0 | <|sols|><|sot|>This Czech groupon is so dumbfounded by their app error they are even asking people on Twitter<|eot|><|sol|>https://twitter.com/SlevomatLIVE/status/819487524418650112?s=09<|eol|><|sor|>This is interesting. They're storing a value in (what appears to be) an array with a particular key, but when they look up the value for the key they apparently just inserted, it's not found.
This works fine:
$ php -r '$arr = []; $key = ''; $arr[$key] = 2; var_dump($arr[$key]);'
int(2)
So I wonder what the issue is.
Is `$this->savePoints` actually an array? It could be an object implementing `ArrayAccess` where they're doing something weird. That could explain the problem.
Or, is there a bug in the PHP interpreter for certain special values? Maybe it's a reference-handling bug. These things crop up from time to time, it's a difficult-to-avoid consequence of massively changing the PHP internals in the previous release.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | vytah | dcbwvcb | <|sols|><|sot|>This Czech groupon is so dumbfounded by their app error they are even asking people on Twitter<|eot|><|sol|>https://twitter.com/SlevomatLIVE/status/819487524418650112?s=09<|eol|><|sor|>A similar problem: http://stackoverflow.com/questions/11199090/php-weird-undefined-index-error<|eor|><|eols|><|endoftext|> | 7 |
lolphp | the_alias_of_andrea | dcc155c | <|sols|><|sot|>This Czech groupon is so dumbfounded by their app error they are even asking people on Twitter<|eot|><|sol|>https://twitter.com/SlevomatLIVE/status/819487524418650112?s=09<|eol|><|sor|>A similar problem: http://stackoverflow.com/questions/11199090/php-weird-undefined-index-error<|eor|><|sor|>In that case they're not looking up a key they inserted themselves, at least.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | poizan42 | dci5mkb | <|sols|><|sot|>This Czech groupon is so dumbfounded by their app error they are even asking people on Twitter<|eot|><|sol|>https://twitter.com/SlevomatLIVE/status/819487524418650112?s=09<|eol|><|sor|>A similar problem: http://stackoverflow.com/questions/11199090/php-weird-undefined-index-error<|eor|><|sor|>The explanation for the fix doesn't makes sense. Strings in PHP don't "know" about their encoding, and converting pure ASCII from one ASCII extension to another should be a no-operation. But serialize/deserialize worked as well.
The poster never seemed to try just copying it to another array with something like:
$headersRaw = getallheaders();
$headers = array();
foreach($headersRaw as $key => $value)
{
$headers[$key] = $value;
}
I have a suspicion that the hashcode used for the "SystemTime" entry somehow ended up wrong, so the entry got into the wrong bucket so it couldn't find it when looking up by the key.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | barubary | 3cnx6d | <|soss|><|sot|>feof(): the documentation is wrong<|eot|><|sost|>The [`feof()` documentation](http://php.net/feof) states:
> Returns **TRUE** if the file pointer is at EOF or an error occurs
This means after opening a 10-byte file and reading 10 bytes, `feof()` should return `TRUE` because the file pointer is "at EOF".
But according to https://bugs.php.net/bug.php?id=35136 `feof()` only returns true after trying to read past the end of the file once, which is apparently "not a bug" despite contradicting the documentation. I suspect this is because the implementation mimics C but the author of the documentation didn't know this.
*Background information about C*
The `feof()` function originates in C (and C has its roots in Unix). C/Unix has file descriptors, which are raw unbuffered communication channels. These are wrapped by `FILE` handles, which provide a more high-level interface. In addition to a file descriptor a `FILE` contains a buffer and some state flags. `feof()` queries the end-of-file flag, `ferror()` queries the error flag.
The intended usage is that after a read operation has failed (e.g. `fread` returning a short count), you can then use `ferror` and `feof` to see whether the failure was due to an error or simply because the end of the file was reached. That is, `feof` does not predict whether the next read operation will fail; it can give you more information after a read operation has already failed.<|eost|><|eoss|><|endoftext|> | 37 |
lolphp | barubary | csxi7ll | <|soss|><|sot|>feof(): the documentation is wrong<|eot|><|sost|>The [`feof()` documentation](http://php.net/feof) states:
> Returns **TRUE** if the file pointer is at EOF or an error occurs
This means after opening a 10-byte file and reading 10 bytes, `feof()` should return `TRUE` because the file pointer is "at EOF".
But according to https://bugs.php.net/bug.php?id=35136 `feof()` only returns true after trying to read past the end of the file once, which is apparently "not a bug" despite contradicting the documentation. I suspect this is because the implementation mimics C but the author of the documentation didn't know this.
*Background information about C*
The `feof()` function originates in C (and C has its roots in Unix). C/Unix has file descriptors, which are raw unbuffered communication channels. These are wrapped by `FILE` handles, which provide a more high-level interface. In addition to a file descriptor a `FILE` contains a buffer and some state flags. `feof()` queries the end-of-file flag, `ferror()` queries the error flag.
The intended usage is that after a read operation has failed (e.g. `fread` returning a short count), you can then use `ferror` and `feof` to see whether the failure was due to an error or simply because the end of the file was reached. That is, `feof` does not predict whether the next read operation will fail; it can give you more information after a read operation has already failed.<|eost|><|sor|>Report a bug instead of complaining the documentation is wrong so nothing would be done about it, even a patch at the editor would be great.<|eor|><|soopr|>There already is a bug report (I linked to it above). According to the PHP developers, this issue is not a bug.<|eoopr|><|sor|>That bug report is 10 years old, it is not even targetting a supported version of PHP.
As a PHP Core dev, it is hard to change this because it will break backwards compatibility, even such cases are hard to catch and most likely won't be changed, but I think the documentation should be updated to reflect the implementation if you believe it is wrong.
You can also send in a patch at the editor: http://edit.php.net/ and mail to me after for review (or pop on #php.doc @ EFNet)
// mail
echo substr(strtolower($reddit_username), 0, 5) . '@php.net';<|eor|><|soopr|>Wait, you're a PHP core dev, but you want *me* to fix your documentation?<|eoopr|><|eoss|><|endoftext|> | 41 |
lolphp | barubary | csxedrw | <|soss|><|sot|>feof(): the documentation is wrong<|eot|><|sost|>The [`feof()` documentation](http://php.net/feof) states:
> Returns **TRUE** if the file pointer is at EOF or an error occurs
This means after opening a 10-byte file and reading 10 bytes, `feof()` should return `TRUE` because the file pointer is "at EOF".
But according to https://bugs.php.net/bug.php?id=35136 `feof()` only returns true after trying to read past the end of the file once, which is apparently "not a bug" despite contradicting the documentation. I suspect this is because the implementation mimics C but the author of the documentation didn't know this.
*Background information about C*
The `feof()` function originates in C (and C has its roots in Unix). C/Unix has file descriptors, which are raw unbuffered communication channels. These are wrapped by `FILE` handles, which provide a more high-level interface. In addition to a file descriptor a `FILE` contains a buffer and some state flags. `feof()` queries the end-of-file flag, `ferror()` queries the error flag.
The intended usage is that after a read operation has failed (e.g. `fread` returning a short count), you can then use `ferror` and `feof` to see whether the failure was due to an error or simply because the end of the file was reached. That is, `feof` does not predict whether the next read operation will fail; it can give you more information after a read operation has already failed.<|eost|><|sor|>Report a bug instead of complaining the documentation is wrong so nothing would be done about it, even a patch at the editor would be great.<|eor|><|soopr|>There already is a bug report (I linked to it above). According to the PHP developers, this issue is not a bug.<|eoopr|><|eoss|><|endoftext|> | 30 |
lolphp | ZiggyTheHamster | csxmq51 | <|soss|><|sot|>feof(): the documentation is wrong<|eot|><|sost|>The [`feof()` documentation](http://php.net/feof) states:
> Returns **TRUE** if the file pointer is at EOF or an error occurs
This means after opening a 10-byte file and reading 10 bytes, `feof()` should return `TRUE` because the file pointer is "at EOF".
But according to https://bugs.php.net/bug.php?id=35136 `feof()` only returns true after trying to read past the end of the file once, which is apparently "not a bug" despite contradicting the documentation. I suspect this is because the implementation mimics C but the author of the documentation didn't know this.
*Background information about C*
The `feof()` function originates in C (and C has its roots in Unix). C/Unix has file descriptors, which are raw unbuffered communication channels. These are wrapped by `FILE` handles, which provide a more high-level interface. In addition to a file descriptor a `FILE` contains a buffer and some state flags. `feof()` queries the end-of-file flag, `ferror()` queries the error flag.
The intended usage is that after a read operation has failed (e.g. `fread` returning a short count), you can then use `ferror` and `feof` to see whether the failure was due to an error or simply because the end of the file was reached. That is, `feof` does not predict whether the next read operation will fail; it can give you more information after a read operation has already failed.<|eost|><|sor|>Report a bug instead of complaining the documentation is wrong so nothing would be done about it, even a patch at the editor would be great.<|eor|><|soopr|>There already is a bug report (I linked to it above). According to the PHP developers, this issue is not a bug.<|eoopr|><|sor|>That bug report is 10 years old, it is not even targetting a supported version of PHP.
As a PHP Core dev, it is hard to change this because it will break backwards compatibility, even such cases are hard to catch and most likely won't be changed, but I think the documentation should be updated to reflect the implementation if you believe it is wrong.
You can also send in a patch at the editor: http://edit.php.net/ and mail to me after for review (or pop on #php.doc @ EFNet)
// mail
echo substr(strtolower($reddit_username), 0, 5) . '@php.net';<|eor|><|soopr|>Wait, you're a PHP core dev, but you want *me* to fix your documentation?<|eoopr|><|sor|>This is the real /r/lolphp.
You know it's wrong, and it's a doc issue. Spend 3.5 minutes to make a PR that clears up the docs. You clearly cannot change the C-based behavior because you're wrapping it and doing what they do.
That said, though, `man 3 feof` sucks just as badly on MacOS X:
> The function feof() tests the end-of-file indicator for the stream pointed to by stream, returning non-zero if it is set. The end-of-file indicator may be cleared by explicitly calling clearerr(), or as a side-effect of other operations, e.g. fseek().<|eor|><|eoss|><|endoftext|> | 26 |
lolphp | barubary | csyd556 | <|soss|><|sot|>feof(): the documentation is wrong<|eot|><|sost|>The [`feof()` documentation](http://php.net/feof) states:
> Returns **TRUE** if the file pointer is at EOF or an error occurs
This means after opening a 10-byte file and reading 10 bytes, `feof()` should return `TRUE` because the file pointer is "at EOF".
But according to https://bugs.php.net/bug.php?id=35136 `feof()` only returns true after trying to read past the end of the file once, which is apparently "not a bug" despite contradicting the documentation. I suspect this is because the implementation mimics C but the author of the documentation didn't know this.
*Background information about C*
The `feof()` function originates in C (and C has its roots in Unix). C/Unix has file descriptors, which are raw unbuffered communication channels. These are wrapped by `FILE` handles, which provide a more high-level interface. In addition to a file descriptor a `FILE` contains a buffer and some state flags. `feof()` queries the end-of-file flag, `ferror()` queries the error flag.
The intended usage is that after a read operation has failed (e.g. `fread` returning a short count), you can then use `ferror` and `feof` to see whether the failure was due to an error or simply because the end of the file was reached. That is, `feof` does not predict whether the next read operation will fail; it can give you more information after a read operation has already failed.<|eost|><|sor|>Report a bug instead of complaining the documentation is wrong so nothing would be done about it, even a patch at the editor would be great.<|eor|><|soopr|>There already is a bug report (I linked to it above). According to the PHP developers, this issue is not a bug.<|eoopr|><|sor|>That bug report is 10 years old, it is not even targetting a supported version of PHP.
As a PHP Core dev, it is hard to change this because it will break backwards compatibility, even such cases are hard to catch and most likely won't be changed, but I think the documentation should be updated to reflect the implementation if you believe it is wrong.
You can also send in a patch at the editor: http://edit.php.net/ and mail to me after for review (or pop on #php.doc @ EFNet)
// mail
echo substr(strtolower($reddit_username), 0, 5) . '@php.net';<|eor|><|soopr|>Wait, you're a PHP core dev, but you want *me* to fix your documentation?<|eoopr|><|sor|>Yes, I would much rather have people contribute to making it better, than complaining about no change is ever happening, without any effort to even try change it, then it is most likely not happening.
It doesn't take long to do an svn checkout of phpdoc (yes, phpdoc is in svn), find where its wrong, fix it and send in a patch or do it from the editor in no time.
So instead of complaining PHP or its documentation is bad, then help improve it instead.<|eor|><|soopr|>I'm not complaining that no change is happening, and I have no desire to see PHP improve. I'm here to point and laugh at it.
> It doesn't take long to do an svn checkout of phpdoc
WTF, now you want me to install svn, too? Go climb a source tree.<|eoopr|><|eoss|><|endoftext|> | 21 |
lolphp | MaxNanasy | csy9wp9 | <|soss|><|sot|>feof(): the documentation is wrong<|eot|><|sost|>The [`feof()` documentation](http://php.net/feof) states:
> Returns **TRUE** if the file pointer is at EOF or an error occurs
This means after opening a 10-byte file and reading 10 bytes, `feof()` should return `TRUE` because the file pointer is "at EOF".
But according to https://bugs.php.net/bug.php?id=35136 `feof()` only returns true after trying to read past the end of the file once, which is apparently "not a bug" despite contradicting the documentation. I suspect this is because the implementation mimics C but the author of the documentation didn't know this.
*Background information about C*
The `feof()` function originates in C (and C has its roots in Unix). C/Unix has file descriptors, which are raw unbuffered communication channels. These are wrapped by `FILE` handles, which provide a more high-level interface. In addition to a file descriptor a `FILE` contains a buffer and some state flags. `feof()` queries the end-of-file flag, `ferror()` queries the error flag.
The intended usage is that after a read operation has failed (e.g. `fread` returning a short count), you can then use `ferror` and `feof` to see whether the failure was due to an error or simply because the end of the file was reached. That is, `feof` does not predict whether the next read operation will fail; it can give you more information after a read operation has already failed.<|eost|><|sor|>The closed bug says:
> Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you.
boo<|eor|><|eoss|><|endoftext|> | 18 |
lolphp | DoctorWaluigiTime | csy42l5 | <|soss|><|sot|>feof(): the documentation is wrong<|eot|><|sost|>The [`feof()` documentation](http://php.net/feof) states:
> Returns **TRUE** if the file pointer is at EOF or an error occurs
This means after opening a 10-byte file and reading 10 bytes, `feof()` should return `TRUE` because the file pointer is "at EOF".
But according to https://bugs.php.net/bug.php?id=35136 `feof()` only returns true after trying to read past the end of the file once, which is apparently "not a bug" despite contradicting the documentation. I suspect this is because the implementation mimics C but the author of the documentation didn't know this.
*Background information about C*
The `feof()` function originates in C (and C has its roots in Unix). C/Unix has file descriptors, which are raw unbuffered communication channels. These are wrapped by `FILE` handles, which provide a more high-level interface. In addition to a file descriptor a `FILE` contains a buffer and some state flags. `feof()` queries the end-of-file flag, `ferror()` queries the error flag.
The intended usage is that after a read operation has failed (e.g. `fread` returning a short count), you can then use `ferror` and `feof` to see whether the failure was due to an error or simply because the end of the file was reached. That is, `feof` does not predict whether the next read operation will fail; it can give you more information after a read operation has already failed.<|eost|><|sor|>Report a bug instead of complaining the documentation is wrong so nothing would be done about it, even a patch at the editor would be great.<|eor|><|soopr|>There already is a bug report (I linked to it above). According to the PHP developers, this issue is not a bug.<|eoopr|><|sor|>That bug report is 10 years old, it is not even targetting a supported version of PHP.
As a PHP Core dev, it is hard to change this because it will break backwards compatibility, even such cases are hard to catch and most likely won't be changed, but I think the documentation should be updated to reflect the implementation if you believe it is wrong.
You can also send in a patch at the editor: http://edit.php.net/ and mail to me after for review (or pop on #php.doc @ EFNet)
// mail
echo substr(strtolower($reddit_username), 0, 5) . '@php.net';<|eor|><|soopr|>Wait, you're a PHP core dev, but you want *me* to fix your documentation?<|eoopr|><|sor|>Yes, I would much rather have people contribute to making it better, than complaining about no change is ever happening, without any effort to even try change it, then it is most likely not happening.
It doesn't take long to do an svn checkout of phpdoc (yes, phpdoc is in svn), find where its wrong, fix it and send in a patch or do it from the editor in no time.
So instead of complaining PHP or its documentation is bad, then help improve it instead.<|eor|><|sor|>Raising awareness to something that's defective is indeed a way to make it better. I wouldn't go biting people's heads off for that.
After all, it gave you a chance to advertise that anyone can help out.<|eor|><|eoss|><|endoftext|> | 17 |
lolphp | TheBuzzSaw | csxnksz | <|soss|><|sot|>feof(): the documentation is wrong<|eot|><|sost|>The [`feof()` documentation](http://php.net/feof) states:
> Returns **TRUE** if the file pointer is at EOF or an error occurs
This means after opening a 10-byte file and reading 10 bytes, `feof()` should return `TRUE` because the file pointer is "at EOF".
But according to https://bugs.php.net/bug.php?id=35136 `feof()` only returns true after trying to read past the end of the file once, which is apparently "not a bug" despite contradicting the documentation. I suspect this is because the implementation mimics C but the author of the documentation didn't know this.
*Background information about C*
The `feof()` function originates in C (and C has its roots in Unix). C/Unix has file descriptors, which are raw unbuffered communication channels. These are wrapped by `FILE` handles, which provide a more high-level interface. In addition to a file descriptor a `FILE` contains a buffer and some state flags. `feof()` queries the end-of-file flag, `ferror()` queries the error flag.
The intended usage is that after a read operation has failed (e.g. `fread` returning a short count), you can then use `ferror` and `feof` to see whether the failure was due to an error or simply because the end of the file was reached. That is, `feof` does not predict whether the next read operation will fail; it can give you more information after a read operation has already failed.<|eost|><|sor|>Report a bug instead of complaining the documentation is wrong so nothing would be done about it, even a patch at the editor would be great.<|eor|><|soopr|>There already is a bug report (I linked to it above). According to the PHP developers, this issue is not a bug.<|eoopr|><|sor|>That bug report is 10 years old, it is not even targetting a supported version of PHP.
As a PHP Core dev, it is hard to change this because it will break backwards compatibility, even such cases are hard to catch and most likely won't be changed, but I think the documentation should be updated to reflect the implementation if you believe it is wrong.
You can also send in a patch at the editor: http://edit.php.net/ and mail to me after for review (or pop on #php.doc @ EFNet)
// mail
echo substr(strtolower($reddit_username), 0, 5) . '@php.net';<|eor|><|sor|>> As a PHP Core dev, it is hard to change this because it will break backwards compatibility
Why do PHP devs see wrong/inconsistent behavior as valid forms of "backwards compatibility"? Don't programs that depend on the wrong behavior _deserve_ to break?<|eor|><|eoss|><|endoftext|> | 16 |
lolphp | sli | csxvrr8 | <|soss|><|sot|>feof(): the documentation is wrong<|eot|><|sost|>The [`feof()` documentation](http://php.net/feof) states:
> Returns **TRUE** if the file pointer is at EOF or an error occurs
This means after opening a 10-byte file and reading 10 bytes, `feof()` should return `TRUE` because the file pointer is "at EOF".
But according to https://bugs.php.net/bug.php?id=35136 `feof()` only returns true after trying to read past the end of the file once, which is apparently "not a bug" despite contradicting the documentation. I suspect this is because the implementation mimics C but the author of the documentation didn't know this.
*Background information about C*
The `feof()` function originates in C (and C has its roots in Unix). C/Unix has file descriptors, which are raw unbuffered communication channels. These are wrapped by `FILE` handles, which provide a more high-level interface. In addition to a file descriptor a `FILE` contains a buffer and some state flags. `feof()` queries the end-of-file flag, `ferror()` queries the error flag.
The intended usage is that after a read operation has failed (e.g. `fread` returning a short count), you can then use `ferror` and `feof` to see whether the failure was due to an error or simply because the end of the file was reached. That is, `feof` does not predict whether the next read operation will fail; it can give you more information after a read operation has already failed.<|eost|><|sor|>Report a bug instead of complaining the documentation is wrong so nothing would be done about it, even a patch at the editor would be great.<|eor|><|soopr|>There already is a bug report (I linked to it above). According to the PHP developers, this issue is not a bug.<|eoopr|><|sor|>That bug report is 10 years old, it is not even targetting a supported version of PHP.
As a PHP Core dev, it is hard to change this because it will break backwards compatibility, even such cases are hard to catch and most likely won't be changed, but I think the documentation should be updated to reflect the implementation if you believe it is wrong.
You can also send in a patch at the editor: http://edit.php.net/ and mail to me after for review (or pop on #php.doc @ EFNet)
// mail
echo substr(strtolower($reddit_username), 0, 5) . '@php.net';<|eor|><|sor|>> As a PHP Core dev, it is hard to change this because it will break backwards compatibility
Why do PHP devs see wrong/inconsistent behavior as valid forms of "backwards compatibility"? Don't programs that depend on the wrong behavior _deserve_ to break?<|eor|><|sor|>The PHP devs say no to breaking backwards compatibility, [except for when they decide to say yes](https://bugs.php.net/bug.php?id=69588).
> However, PHP 7 is going remove support for converting hex strings to number, ...
Consistency? Who needs that?<|eor|><|eoss|><|endoftext|> | 16 |
lolphp | sloat | csxxhdn | <|soss|><|sot|>feof(): the documentation is wrong<|eot|><|sost|>The [`feof()` documentation](http://php.net/feof) states:
> Returns **TRUE** if the file pointer is at EOF or an error occurs
This means after opening a 10-byte file and reading 10 bytes, `feof()` should return `TRUE` because the file pointer is "at EOF".
But according to https://bugs.php.net/bug.php?id=35136 `feof()` only returns true after trying to read past the end of the file once, which is apparently "not a bug" despite contradicting the documentation. I suspect this is because the implementation mimics C but the author of the documentation didn't know this.
*Background information about C*
The `feof()` function originates in C (and C has its roots in Unix). C/Unix has file descriptors, which are raw unbuffered communication channels. These are wrapped by `FILE` handles, which provide a more high-level interface. In addition to a file descriptor a `FILE` contains a buffer and some state flags. `feof()` queries the end-of-file flag, `ferror()` queries the error flag.
The intended usage is that after a read operation has failed (e.g. `fread` returning a short count), you can then use `ferror` and `feof` to see whether the failure was due to an error or simply because the end of the file was reached. That is, `feof` does not predict whether the next read operation will fail; it can give you more information after a read operation has already failed.<|eost|><|sor|>Report a bug instead of complaining the documentation is wrong so nothing would be done about it, even a patch at the editor would be great.<|eor|><|soopr|>There already is a bug report (I linked to it above). According to the PHP developers, this issue is not a bug.<|eoopr|><|sor|>That bug report is 10 years old, it is not even targetting a supported version of PHP.
As a PHP Core dev, it is hard to change this because it will break backwards compatibility, even such cases are hard to catch and most likely won't be changed, but I think the documentation should be updated to reflect the implementation if you believe it is wrong.
You can also send in a patch at the editor: http://edit.php.net/ and mail to me after for review (or pop on #php.doc @ EFNet)
// mail
echo substr(strtolower($reddit_username), 0, 5) . '@php.net';<|eor|><|sor|>> As a PHP Core dev, it is hard to change this because it will break backwards compatibility
Why do PHP devs see wrong/inconsistent behavior as valid forms of "backwards compatibility"? Don't programs that depend on the wrong behavior _deserve_ to break?<|eor|><|sor|>Because backwards compatibility is a feature in itself. Yes wrong behavior deserves to break, eventually, but with this big a developer base as PHP have, you cannot just break it from one version to another without much care.
We usually take each wrong behavior on a case-by-case basis and evaluate the impact that it may have if we decide to break it. Usually if we find that using feature X is wrong, then we would usually deprecate it and remove it in the version after if it was a minor version, for a major version, like PHP7, we can sometimes skip the deprecation warning, depending on the feature, like the "Uniform Variable Syntax" RFC included in PHP7, which we don't warn about in PHP5.<|eor|><|sor|>> you cannot just break it from one version to another without much care.
Yeah, but that still happens. [Case in point](http://php.net/manual/en/function.json-encode.php#115733).
Wrong behavior fixed, don't tell anyone. I mean, at all. There's no documentation for this change anywhere that I can find. Not even in the 5.4 to 5.5 Backwards Incompatibility change log.<|eor|><|eoss|><|endoftext|> | 16 |
lolphp | barubary | csyd806 | <|soss|><|sot|>feof(): the documentation is wrong<|eot|><|sost|>The [`feof()` documentation](http://php.net/feof) states:
> Returns **TRUE** if the file pointer is at EOF or an error occurs
This means after opening a 10-byte file and reading 10 bytes, `feof()` should return `TRUE` because the file pointer is "at EOF".
But according to https://bugs.php.net/bug.php?id=35136 `feof()` only returns true after trying to read past the end of the file once, which is apparently "not a bug" despite contradicting the documentation. I suspect this is because the implementation mimics C but the author of the documentation didn't know this.
*Background information about C*
The `feof()` function originates in C (and C has its roots in Unix). C/Unix has file descriptors, which are raw unbuffered communication channels. These are wrapped by `FILE` handles, which provide a more high-level interface. In addition to a file descriptor a `FILE` contains a buffer and some state flags. `feof()` queries the end-of-file flag, `ferror()` queries the error flag.
The intended usage is that after a read operation has failed (e.g. `fread` returning a short count), you can then use `ferror` and `feof` to see whether the failure was due to an error or simply because the end of the file was reached. That is, `feof` does not predict whether the next read operation will fail; it can give you more information after a read operation has already failed.<|eost|><|sor|>Report a bug instead of complaining the documentation is wrong so nothing would be done about it, even a patch at the editor would be great.<|eor|><|soopr|>There already is a bug report (I linked to it above). According to the PHP developers, this issue is not a bug.<|eoopr|><|sor|>That bug report is 10 years old, it is not even targetting a supported version of PHP.
As a PHP Core dev, it is hard to change this because it will break backwards compatibility, even such cases are hard to catch and most likely won't be changed, but I think the documentation should be updated to reflect the implementation if you believe it is wrong.
You can also send in a patch at the editor: http://edit.php.net/ and mail to me after for review (or pop on #php.doc @ EFNet)
// mail
echo substr(strtolower($reddit_username), 0, 5) . '@php.net';<|eor|><|soopr|>> That bug report is 10 years old, it is not even targetting a supported version of PHP.
Now that I'm reading this again, what keeps you from reopening this bug and updating the "affected versions" field? I mean, why do you care what version it is "targetting" when the behavior is still the same?<|eoopr|><|eoss|><|endoftext|> | 15 |
lolphp | TheBuzzSaw | csy42pa | <|soss|><|sot|>feof(): the documentation is wrong<|eot|><|sost|>The [`feof()` documentation](http://php.net/feof) states:
> Returns **TRUE** if the file pointer is at EOF or an error occurs
This means after opening a 10-byte file and reading 10 bytes, `feof()` should return `TRUE` because the file pointer is "at EOF".
But according to https://bugs.php.net/bug.php?id=35136 `feof()` only returns true after trying to read past the end of the file once, which is apparently "not a bug" despite contradicting the documentation. I suspect this is because the implementation mimics C but the author of the documentation didn't know this.
*Background information about C*
The `feof()` function originates in C (and C has its roots in Unix). C/Unix has file descriptors, which are raw unbuffered communication channels. These are wrapped by `FILE` handles, which provide a more high-level interface. In addition to a file descriptor a `FILE` contains a buffer and some state flags. `feof()` queries the end-of-file flag, `ferror()` queries the error flag.
The intended usage is that after a read operation has failed (e.g. `fread` returning a short count), you can then use `ferror` and `feof` to see whether the failure was due to an error or simply because the end of the file was reached. That is, `feof` does not predict whether the next read operation will fail; it can give you more information after a read operation has already failed.<|eost|><|sor|>Report a bug instead of complaining the documentation is wrong so nothing would be done about it, even a patch at the editor would be great.<|eor|><|soopr|>There already is a bug report (I linked to it above). According to the PHP developers, this issue is not a bug.<|eoopr|><|sor|>That bug report is 10 years old, it is not even targetting a supported version of PHP.
As a PHP Core dev, it is hard to change this because it will break backwards compatibility, even such cases are hard to catch and most likely won't be changed, but I think the documentation should be updated to reflect the implementation if you believe it is wrong.
You can also send in a patch at the editor: http://edit.php.net/ and mail to me after for review (or pop on #php.doc @ EFNet)
// mail
echo substr(strtolower($reddit_username), 0, 5) . '@php.net';<|eor|><|sor|>> As a PHP Core dev, it is hard to change this because it will break backwards compatibility
Why do PHP devs see wrong/inconsistent behavior as valid forms of "backwards compatibility"? Don't programs that depend on the wrong behavior _deserve_ to break?<|eor|><|sor|>To be fair, Linus takes the same approach with Linux, the NT devs with Windows, etc.<|eor|><|sor|>I have seen Linus yell at people over not breaking user land, but eventually things are fixed. Windows lets you pick compatibility levels when running older programs, which I think is a great solution.
While I agree with the sentiment (keep working things working), PHP is not an operating system, and the stuff that's "working" is criminal.<|eor|><|sor|>> but eventually things are fixed.
By keeping userland intact.
> PHP is not an operating system, and the stuff that's "working" is criminal.
PHP didn't achieve it's popularity by breaking things willy nilly. Nobody wants to use your language if they have to, say, do an upgrade from python 2 to 3 and fix all their code.
> There are only two kinds of languages: the ones people complain about and the ones nobody uses.<|eor|><|sor|>Arguably, Python went too far with its breaking changes. I feel bad that wanting to perform a deep cleaning of the language resulted in a ton of people unwilling to even entertain using the new version. I just feel that PHP is the opposite extreme where no rational progress can be made.<|eor|><|eoss|><|endoftext|> | 9 |
lolphp | TheBuzzSaw | csxw86c | <|soss|><|sot|>feof(): the documentation is wrong<|eot|><|sost|>The [`feof()` documentation](http://php.net/feof) states:
> Returns **TRUE** if the file pointer is at EOF or an error occurs
This means after opening a 10-byte file and reading 10 bytes, `feof()` should return `TRUE` because the file pointer is "at EOF".
But according to https://bugs.php.net/bug.php?id=35136 `feof()` only returns true after trying to read past the end of the file once, which is apparently "not a bug" despite contradicting the documentation. I suspect this is because the implementation mimics C but the author of the documentation didn't know this.
*Background information about C*
The `feof()` function originates in C (and C has its roots in Unix). C/Unix has file descriptors, which are raw unbuffered communication channels. These are wrapped by `FILE` handles, which provide a more high-level interface. In addition to a file descriptor a `FILE` contains a buffer and some state flags. `feof()` queries the end-of-file flag, `ferror()` queries the error flag.
The intended usage is that after a read operation has failed (e.g. `fread` returning a short count), you can then use `ferror` and `feof` to see whether the failure was due to an error or simply because the end of the file was reached. That is, `feof` does not predict whether the next read operation will fail; it can give you more information after a read operation has already failed.<|eost|><|sor|>Report a bug instead of complaining the documentation is wrong so nothing would be done about it, even a patch at the editor would be great.<|eor|><|soopr|>There already is a bug report (I linked to it above). According to the PHP developers, this issue is not a bug.<|eoopr|><|sor|>That bug report is 10 years old, it is not even targetting a supported version of PHP.
As a PHP Core dev, it is hard to change this because it will break backwards compatibility, even such cases are hard to catch and most likely won't be changed, but I think the documentation should be updated to reflect the implementation if you believe it is wrong.
You can also send in a patch at the editor: http://edit.php.net/ and mail to me after for review (or pop on #php.doc @ EFNet)
// mail
echo substr(strtolower($reddit_username), 0, 5) . '@php.net';<|eor|><|sor|>> As a PHP Core dev, it is hard to change this because it will break backwards compatibility
Why do PHP devs see wrong/inconsistent behavior as valid forms of "backwards compatibility"? Don't programs that depend on the wrong behavior _deserve_ to break?<|eor|><|sor|>To be fair, Linus takes the same approach with Linux, the NT devs with Windows, etc.<|eor|><|sor|>I have seen Linus yell at people over not breaking user land, but eventually things are fixed. Windows lets you pick compatibility levels when running older programs, which I think is a great solution.
While I agree with the sentiment (keep working things working), PHP is not an operating system, and the stuff that's "working" is criminal.<|eor|><|eoss|><|endoftext|> | 8 |
lolphp | TheBuzzSaw | csy3q84 | <|soss|><|sot|>feof(): the documentation is wrong<|eot|><|sost|>The [`feof()` documentation](http://php.net/feof) states:
> Returns **TRUE** if the file pointer is at EOF or an error occurs
This means after opening a 10-byte file and reading 10 bytes, `feof()` should return `TRUE` because the file pointer is "at EOF".
But according to https://bugs.php.net/bug.php?id=35136 `feof()` only returns true after trying to read past the end of the file once, which is apparently "not a bug" despite contradicting the documentation. I suspect this is because the implementation mimics C but the author of the documentation didn't know this.
*Background information about C*
The `feof()` function originates in C (and C has its roots in Unix). C/Unix has file descriptors, which are raw unbuffered communication channels. These are wrapped by `FILE` handles, which provide a more high-level interface. In addition to a file descriptor a `FILE` contains a buffer and some state flags. `feof()` queries the end-of-file flag, `ferror()` queries the error flag.
The intended usage is that after a read operation has failed (e.g. `fread` returning a short count), you can then use `ferror` and `feof` to see whether the failure was due to an error or simply because the end of the file was reached. That is, `feof` does not predict whether the next read operation will fail; it can give you more information after a read operation has already failed.<|eost|><|sor|>Report a bug instead of complaining the documentation is wrong so nothing would be done about it, even a patch at the editor would be great.<|eor|><|soopr|>There already is a bug report (I linked to it above). According to the PHP developers, this issue is not a bug.<|eoopr|><|sor|>That bug report is 10 years old, it is not even targetting a supported version of PHP.
As a PHP Core dev, it is hard to change this because it will break backwards compatibility, even such cases are hard to catch and most likely won't be changed, but I think the documentation should be updated to reflect the implementation if you believe it is wrong.
You can also send in a patch at the editor: http://edit.php.net/ and mail to me after for review (or pop on #php.doc @ EFNet)
// mail
echo substr(strtolower($reddit_username), 0, 5) . '@php.net';<|eor|><|sor|>> As a PHP Core dev, it is hard to change this because it will break backwards compatibility
Why do PHP devs see wrong/inconsistent behavior as valid forms of "backwards compatibility"? Don't programs that depend on the wrong behavior _deserve_ to break?<|eor|><|sor|>Because backwards compatibility is a feature in itself. Yes wrong behavior deserves to break, eventually, but with this big a developer base as PHP have, you cannot just break it from one version to another without much care.
We usually take each wrong behavior on a case-by-case basis and evaluate the impact that it may have if we decide to break it. Usually if we find that using feature X is wrong, then we would usually deprecate it and remove it in the version after if it was a minor version, for a major version, like PHP7, we can sometimes skip the deprecation warning, depending on the feature, like the "Uniform Variable Syntax" RFC included in PHP7, which we don't warn about in PHP5.<|eor|><|sor|>> Because backwards compatibility is a feature in itself.
It is... until it isn't. Stuff takes too long to deprecate.<|eor|><|eoss|><|endoftext|> | 6 |
lolphp | racle | 2lyy0e | <|sols|><|sot|>PHP reference changes last item of array. "Not a bug"<|eot|><|sol|>https://bugs.php.net/bug.php?id=68402<|eol|><|eols|><|endoftext|> | 39 |
lolphp | suspiciously_calm | clzyu9c | <|sols|><|sot|>PHP reference changes last item of array. "Not a bug"<|eot|><|sol|>https://bugs.php.net/bug.php?id=68402<|eol|><|sor|>It *seems* like a bug. It's not if you think about it. In C, if I copy a struct, which contains a pointer to something, I get a struct which contains a pointer to the same thing.
The same thing is going on here. That first element is a reference. It won't change if you copy the array, the array *itself* is not a reference.<|eor|><|sor|>If I copy a pointer in C or C++ (as a struct member or by itself), the writing is on the wall. It is declared as a pointer, the data it points to has to be accessed by some dereferencing syntax that makes it clear you're dealing with a pointer, and if you change the *pointer* to something else by assignment, you can be sure only that one pointer in that location gets changed.
Even though C++ references use value syntax, they are declared as references and can only reference one variable throughout their lifetime.
In PHP, references are underhanded infections of identifiers which require special constructs (unset) to get rid of that are not normally used otherwise. Or do PHP programmers unset every variable they're about to use (which would kind of defeat the purpose of not having to declare them)?
The normal thing to do when you want to use a new variable, since you don't have to declare it, is to just assign it its initial value, and it's reasonable to expect that that doesn't fuck up some arbitrary memory location elsewhere in the program because the same identifier had been used to loop over an array previously.<|eor|><|eols|><|endoftext|> | 17 |
lolphp | ninjainvisible | clzugxw | <|sols|><|sot|>PHP reference changes last item of array. "Not a bug"<|eot|><|sol|>https://bugs.php.net/bug.php?id=68402<|eol|><|sor|>That is how PHP treats "creating a reference" to a value. When you create a reference, it turns the original variable into a reference as well (so that they both edit the same value).
I guess the gist of it is that they're not pointers.
You can "resolve" this by just doing *unset($b)* so that the original variable isn't a reference anymore.<|eor|><|eols|><|endoftext|> | 13 |
lolphp | racle | clzeusk | <|sols|><|sot|>PHP reference changes last item of array. "Not a bug"<|eot|><|sol|>https://bugs.php.net/bug.php?id=68402<|eol|><|soopr|>Test code: http://cloud.lonke.ro/bug.php
What basically happens is this: http://cloud.lonke.ro/feature.php
PHP doesn't remove reference even while passed as parameter in function and changes last item of original array.<|eoopr|><|eols|><|endoftext|> | 5 |
lolphp | callcifer | 2f5xir | <|sols|><|sot|>Static analysis of the PHP source code<|eot|><|sol|>http://www.viva64.com/en/b/0277/<|eol|><|eols|><|endoftext|> | 38 |
lolphp | Twirrim | ck6b2hp | <|sols|><|sot|>Static analysis of the PHP source code<|eot|><|sol|>http://www.viva64.com/en/b/0277/<|eol|><|sor|>Couple of thoughts having read that article.
1) "In this article, we are going to discuss the results of the check of the PHP interpreter by PVS-Studio 5.18.". Well there wasn't much discussion, just a single paragraph after each bug they found, and they weren't particularly insightful. About the same quality of content as you'd get from reading phoronix benchmark articles.
2) That's remarkably few bugs shown up by static analysis. If that's all, either PHP is in a pretty good state, or that's a bad analysis tool.
edit: I accidentally a word<|eor|><|eols|><|endoftext|> | 21 |
lolphp | h0rst_ | ck6f43h | <|sols|><|sot|>Static analysis of the PHP source code<|eot|><|sol|>http://www.viva64.com/en/b/0277/<|eol|><|sor|>Couple of thoughts having read that article.
1) "In this article, we are going to discuss the results of the check of the PHP interpreter by PVS-Studio 5.18.". Well there wasn't much discussion, just a single paragraph after each bug they found, and they weren't particularly insightful. About the same quality of content as you'd get from reading phoronix benchmark articles.
2) That's remarkably few bugs shown up by static analysis. If that's all, either PHP is in a pretty good state, or that's a bad analysis tool.
edit: I accidentally a word<|eor|><|sor|>> That's remarkably few bugs shown up by static analysis. If that's all, either PHP is in a pretty good state, or that's a bad analysis tool.
I just tried compiling PHP5.6 with clang, to see how many warings would show up there. I reached a total of 419 (including extensions/modules). Grouped by warning-type:
353 -Wpointer-sign
23 -Wincompatible-pointer-types-discards-qualifiers
14 -Wstring-plus-int
7 -Wabsolute-value
4 -Wformat-invalid-specifier
4 -Wformat-extra-args
4 -Wenum-conversion
3 -Wtautological-compare
2 -Wformat
2 -Wempty-body
1 -Wlogical-op-parentheses
1 -Wincompatible-pointer-types
1 -Wimplicit-int
<|eor|><|eols|><|endoftext|> | 14 |
lolphp | callcifer | ck6c6ib | <|sols|><|sot|>Static analysis of the PHP source code<|eot|><|sol|>http://www.viva64.com/en/b/0277/<|eol|><|sor|>Couple of thoughts having read that article.
1) "In this article, we are going to discuss the results of the check of the PHP interpreter by PVS-Studio 5.18.". Well there wasn't much discussion, just a single paragraph after each bug they found, and they weren't particularly insightful. About the same quality of content as you'd get from reading phoronix benchmark articles.
2) That's remarkably few bugs shown up by static analysis. If that's all, either PHP is in a pretty good state, or that's a bad analysis tool.
edit: I accidentally a word<|eor|><|soopr|>> About the same quality of content as you'd get from reading phoronix benchmark articles.
Yeah, this is sadly true.
> If that's all, either PHP is in a pretty good state, or that's a bad analysis tool.
I *think* they only posted one of each problem type but yeah, I could be wrong.<|eoopr|><|eols|><|endoftext|> | 5 |
lolphp | vytah | 2e0yzo | <|sols|><|sot|>What is the last day of February next year? Simple, it's 2015-03-31<|eot|><|sol|>https://bugs.php.net/bug.php?id=67706<|eol|><|eols|><|endoftext|> | 40 |
lolphp | tgp1994 | cjv17eb | <|sols|><|sot|>What is the last day of February next year? Simple, it's 2015-03-31<|eot|><|sol|>https://bugs.php.net/bug.php?id=67706<|eol|><|sor|>The whole idea of converting a plain English string to a time representation seems cool, but at the same time, very finicky and error prone.<|eor|><|eols|><|endoftext|> | 28 |
lolphp | ZiggyTheHamster | cjvb652 | <|sols|><|sot|>What is the last day of February next year? Simple, it's 2015-03-31<|eot|><|sol|>https://bugs.php.net/bug.php?id=67706<|eol|><|sor|>The whole idea of converting a plain English string to a time representation seems cool, but at the same time, very finicky and error prone.<|eor|><|sor|>Rails did it right.
`Time.now + 10.days`
Parsing a phrase is stupid.<|eor|><|eols|><|endoftext|> | 27 |
lolphp | allthediamonds | cjv3ory | <|sols|><|sot|>What is the last day of February next year? Simple, it's 2015-03-31<|eot|><|sol|>https://bugs.php.net/bug.php?id=67706<|eol|><|sor|>Why the fuck should strtotime understand English sentences? Like, what's the point? Is that seriously easier than building a proper API?<|eor|><|eols|><|endoftext|> | 18 |
lolphp | cbraga | cjv4xhu | <|sols|><|sot|>What is the last day of February next year? Simple, it's 2015-03-31<|eot|><|sol|>https://bugs.php.net/bug.php?id=67706<|eol|><|sor|>Why the fuck should strtotime understand English sentences? Like, what's the point? Is that seriously easier than building a proper API?<|eor|><|sor|>well, consider php's average user and his ability with apis...<|eor|><|eols|><|endoftext|> | 17 |
lolphp | Rhomboid | cjv71b3 | <|sols|><|sot|>What is the last day of February next year? Simple, it's 2015-03-31<|eot|><|sol|>https://bugs.php.net/bug.php?id=67706<|eol|><|sor|>Why the fuck should strtotime understand English sentences? Like, what's the point? Is that seriously easier than building a proper API?<|eor|><|sor|>It's not exactly uncommon to have date parsing that works that way. For example, [GNU coreutils has a date parsing algorithm](https://www.gnu.org/software/coreutils/manual/coreutils.html#Date-input-formats) that lets you write things like
$ date -d 'mar 1 -1 day next year'
Sat, Feb 28, 2015 00:00:00
<|eor|><|eols|><|endoftext|> | 10 |
lolphp | NihilistDandy | cjvjtmw | <|sols|><|sot|>What is the last day of February next year? Simple, it's 2015-03-31<|eot|><|sol|>https://bugs.php.net/bug.php?id=67706<|eol|><|sor|>That workaround is amazing.<|eor|><|eols|><|endoftext|> | 9 |
lolphp | TortoiseWrath | 216d8f | <|sols|><|sot|>The DateTime class actually became MORE broken in PHP 5.2.6.<|eot|><|sol|>http://3v4l.org/NaJZO<|eol|><|eols|><|endoftext|> | 39 |
lolphp | infinull | cga3ne3 | <|sols|><|sot|>The DateTime class actually became MORE broken in PHP 5.2.6.<|eot|><|sol|>http://3v4l.org/NaJZO<|eol|><|sor|>No, no, this is PHP's philosophy, when in doubt don't admit it, guess.
Not producing a valid day of the week for a date that doesn't exist was clearly a bug.<|eor|><|eols|><|endoftext|> | 23 |
lolphp | TortoiseWrath | cga4jpt | <|sols|><|sot|>The DateTime class actually became MORE broken in PHP 5.2.6.<|eot|><|sol|>http://3v4l.org/NaJZO<|eol|><|soopr|>This just in: [the day before it was also a Saturday](http://3v4l.org/9HTlo).<|eoopr|><|eols|><|endoftext|> | 15 |
lolphp | TortoiseWrath | cgaa1cp | <|sols|><|sot|>The DateTime class actually became MORE broken in PHP 5.2.6.<|eot|><|sol|>http://3v4l.org/NaJZO<|eol|><|sor|>And you can surely guess which day of the week '000000-00-00' and '90000-01-01' will be, right?<|eor|><|soopr|>90000-01-01 should be a Saturday if my calculations are correct and 000000-00-00 isn't an actual date.
In PHP, they'll both probably return errors since it doesn't like years with more than four digits.
\*tests*
Annnnddd... today and some random date in 1999. Good job, PHP.<|eoopr|><|eols|><|endoftext|> | 9 |
lolphp | ismtrn | cgauc3y | <|sols|><|sot|>The DateTime class actually became MORE broken in PHP 5.2.6.<|eot|><|sol|>http://3v4l.org/NaJZO<|eol|><|soopr|>This just in: [the day before it was also a Saturday](http://3v4l.org/9HTlo).<|eoopr|><|sor|>People 2000 years ago knew what was up. Saturday everyday is something I can get behind.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | Twirrim | cga9vp8 | <|sols|><|sot|>The DateTime class actually became MORE broken in PHP 5.2.6.<|eot|><|sol|>http://3v4l.org/NaJZO<|eol|><|sor|>Weird, very inconsistent behaviour between versions even with a valid date (1 Jan 1000):
http://3v4l.org/U4v33
Of course if you specify 1000-01-00 it thinks you really meant 31st December 999. Because it's best to assume these things.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | Various_Pickles | cgarldc | <|sols|><|sot|>The DateTime class actually became MORE broken in PHP 5.2.6.<|eot|><|sol|>http://3v4l.org/NaJZO<|eol|><|sor|>No, no, this is PHP's philosophy, when in doubt don't admit it, guess.
Not producing a valid day of the week for a date that doesn't exist was clearly a bug.<|eor|><|sor|>Any other (read: sane) language throws a nice FuckYourInputException.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | iheartrms | ewg73i | <|sols|><|sot|>PHP 0 day exploit<|eot|><|sol|>https://github.com/mm0r1/exploits/tree/master/php7-backtrace-bypass<|eol|><|eols|><|endoftext|> | 39 |
lolphp | colshrapnel | fg2hp2g | <|sols|><|sot|>PHP 0 day exploit<|eot|><|sol|>https://github.com/mm0r1/exploits/tree/master/php7-backtrace-bypass<|eol|><|sor|>Any of you regulars want to chime in on why this isn't a lolphp?<|eor|><|sor|>Username checks out<|eor|><|eols|><|endoftext|> | 23 |
lolphp | dotted | fg2u06r | <|sols|><|sot|>PHP 0 day exploit<|eot|><|sol|>https://github.com/mm0r1/exploits/tree/master/php7-backtrace-bypass<|eol|><|sor|>Any of you regulars want to chime in on why this isn't a lolphp?<|eor|><|sor|>Because all software has security issues and it's not something unique for PHP?<|eor|><|sor|>Any software that is badly written enough to have serious security vulnerabilities is a lolphp
Software used to be so much better.<|eor|><|sor|>My dude, then every single piece of software is lolphp - it becomes entirely meaningless. Even CPU's are lolphp then, remember Spectre? Don't muddy the waters.<|eor|><|eols|><|endoftext|> | 22 |
lolphp | dotted | fg2qywm | <|sols|><|sot|>PHP 0 day exploit<|eot|><|sol|>https://github.com/mm0r1/exploits/tree/master/php7-backtrace-bypass<|eol|><|sor|>Any of you regulars want to chime in on why this isn't a lolphp?<|eor|><|sor|>Because all software has security issues and it's not something unique for PHP?<|eor|><|eols|><|endoftext|> | 20 |
lolphp | Miserable_Fuck | fg1yoff | <|sols|><|sot|>PHP 0 day exploit<|eot|><|sol|>https://github.com/mm0r1/exploits/tree/master/php7-backtrace-bypass<|eol|><|sor|>Any of you regulars want to chime in on why this isn't a lolphp?<|eor|><|eols|><|endoftext|> | 17 |
lolphp | iluuu | fg2xf1c | <|sols|><|sot|>PHP 0 day exploit<|eot|><|sol|>https://github.com/mm0r1/exploits/tree/master/php7-backtrace-bypass<|eol|><|sor|>Any of you regulars want to chime in on why this isn't a lolphp?<|eor|><|sor|>Because all software has security issues and it's not something unique for PHP?<|eor|><|sor|>Any software that is badly written enough to have serious security vulnerabilities is a lolphp
Software used to be so much better.<|eor|><|sor|>My dude, then every single piece of software is lolphp - it becomes entirely meaningless. Even CPU's are lolphp then, remember Spectre? Don't muddy the waters.<|eor|><|sor|>I don't even disagree. Intel is absolutely lolphp. So is the vast, vast majority of modern software.
You say that like it somehow refutes my point. It's part of it.<|eor|><|sor|>Don't be ridiculous. People who are much smarter than you and me are working on CPU design. An exploit that takes years to discover doesn't belong into the"lol" category.<|eor|><|eols|><|endoftext|> | 15 |
lolphp | commitpushdrink | fg2z48x | <|sols|><|sot|>PHP 0 day exploit<|eot|><|sol|>https://github.com/mm0r1/exploits/tree/master/php7-backtrace-bypass<|eol|><|sor|>Any of you regulars want to chime in on why this isn't a lolphp?<|eor|><|sor|>Because all software has security issues and it's not something unique for PHP?<|eor|><|sor|>Any software that is badly written enough to have serious security vulnerabilities is a lolphp
Software used to be so much better.<|eor|><|sor|>My dude, then every single piece of software is lolphp - it becomes entirely meaningless. Even CPU's are lolphp then, remember Spectre? Don't muddy the waters.<|eor|><|sor|>I don't even disagree. Intel is absolutely lolphp. So is the vast, vast majority of modern software.
You say that like it somehow refutes my point. It's part of it.<|eor|><|sor|>Don't be ridiculous. People who are much smarter than you and me are working on CPU design. An exploit that takes years to discover doesn't belong into the"lol" category.<|eor|><|sor|>That dude is talking out of his ass and projecting a vibe that screams Im a god tier engineer and everyone else is dumb.
He went from associate to full engineer 4 months ago and has a complex about it. No engineer with actual experience would even consider his argument.<|eor|><|eols|><|endoftext|> | 15 |
lolphp | careseite | fg36l3w | <|sols|><|sot|>PHP 0 day exploit<|eot|><|sol|>https://github.com/mm0r1/exploits/tree/master/php7-backtrace-bypass<|eol|><|sor|>Any of you regulars want to chime in on why this isn't a lolphp?<|eor|><|sor|>Because all software has security issues and it's not something unique for PHP?<|eor|><|sor|>Any software that is badly written enough to have serious security vulnerabilities is a lolphp
Software used to be so much better.<|eor|><|sor|>
>Software used to be so much better.
<|eor|><|eols|><|endoftext|> | 13 |
lolphp | UnacceptableUse | fg31amg | <|sols|><|sot|>PHP 0 day exploit<|eot|><|sol|>https://github.com/mm0r1/exploits/tree/master/php7-backtrace-bypass<|eol|><|sor|>Any of you regulars want to chime in on why this isn't a lolphp?<|eor|><|sor|>Because all software has security issues and it's not something unique for PHP?<|eor|><|sor|>Any software that is badly written enough to have serious security vulnerabilities is a lolphp
Software used to be so much better.<|eor|><|sor|>My dude, then every single piece of software is lolphp - it becomes entirely meaningless. Even CPU's are lolphp then, remember Spectre? Don't muddy the waters.<|eor|><|sor|>I don't even disagree. Intel is absolutely lolphp. So is the vast, vast majority of modern software.
You say that like it somehow refutes my point. It's part of it.<|eor|><|sor|>Don't be ridiculous. People who are much smarter than you and me are working on CPU design. An exploit that takes years to discover doesn't belong into the"lol" category.<|eor|><|sor|>That dude is talking out of his ass and projecting a vibe that screams Im a god tier engineer and everyone else is dumb.
He went from associate to full engineer 4 months ago and has a complex about it. No engineer with actual experience would even consider his argument.<|eor|><|sor|>Probably thinks security is easy because theres no exploits in his react app<|eor|><|eols|><|endoftext|> | 13 |
lolphp | commitpushdrink | fg2z79s | <|sols|><|sot|>PHP 0 day exploit<|eot|><|sol|>https://github.com/mm0r1/exploits/tree/master/php7-backtrace-bypass<|eol|><|sor|>Any of you regulars want to chime in on why this isn't a lolphp?<|eor|><|sor|>Because all software has security issues and it's not something unique for PHP?<|eor|><|sor|>Any software that is badly written enough to have serious security vulnerabilities is a lolphp
Software used to be so much better.<|eor|><|sor|>My dude, then every single piece of software is lolphp - it becomes entirely meaningless. Even CPU's are lolphp then, remember Spectre? Don't muddy the waters.<|eor|><|sor|>I don't even disagree. Intel is absolutely lolphp. So is the vast, vast majority of modern software.
You say that like it somehow refutes my point. It's part of it.<|eor|><|sor|>And AMD is lolphp, and so is ARM. Don't you understand that you are literally arguing every single bit of software and hardware is lolphp? What the fuck is the point in doing that?
>So is the vast, vast majority of modern software.
No it isn't a vast anything, it's everything. There is nothing that wouldn't be lolphp.<|eor|><|sor|>Then maybe it's time to fix the industry, no?
Saying "we can't say everything is bad because EVERYTHING would be bad" is a really dumb position to take. Everything is bad.
Let's be the change we want to see in the world. I have already started being more self-reliant code wise and not relying on overengineered solutions and big libraries, which should help. This is the exact opposite of "best practice" for web development, which encourages largely overcomplicated, garbage systems (looking at you, Angular). What is everyone else doing?
PHP is a symptom of a much larger problem - namely that people use the worst, nastiest (but easiest) solution possible to all their problems. Whether it's enormous libraries, languages written by idiots, or some new "fad" framework that everyone else is using. Literally everything is larger and more complicated than it needs to be. I can fit a file browser in 50k, but Caja, Windows Explorer, and Nautilus all need multiple megabytes? Why? Why is Microsoft Office over a gigabyte? Why does everything need to connect to the web? AAAHH it's bad decisions upon bad decisions and it needs to stop.
If we had a whole generation of competent, efficient coders, I guarantee our security problems would be reduced by an astronomical amount, possibly down to almost zero.<|eor|><|sor|>Wait until this guy finds out about trade offs<|eor|><|eols|><|endoftext|> | 9 |
lolphp | UnacceptableUse | fg31ovw | <|sols|><|sot|>PHP 0 day exploit<|eot|><|sol|>https://github.com/mm0r1/exploits/tree/master/php7-backtrace-bypass<|eol|><|sor|>Any of you regulars want to chime in on why this isn't a lolphp?<|eor|><|sor|>Because all software has security issues and it's not something unique for PHP?<|eor|><|sor|>Any software that is badly written enough to have serious security vulnerabilities is a lolphp
Software used to be so much better.<|eor|><|sor|>My dude, then every single piece of software is lolphp - it becomes entirely meaningless. Even CPU's are lolphp then, remember Spectre? Don't muddy the waters.<|eor|><|sor|>I don't even disagree. Intel is absolutely lolphp. So is the vast, vast majority of modern software.
You say that like it somehow refutes my point. It's part of it.<|eor|><|sor|>And AMD is lolphp, and so is ARM. Don't you understand that you are literally arguing every single bit of software and hardware is lolphp? What the fuck is the point in doing that?
>So is the vast, vast majority of modern software.
No it isn't a vast anything, it's everything. There is nothing that wouldn't be lolphp.<|eor|><|sor|>Then maybe it's time to fix the industry, no?
Saying "we can't say everything is bad because EVERYTHING would be bad" is a really dumb position to take. Everything is bad.
Let's be the change we want to see in the world. I have already started being more self-reliant code wise and not relying on overengineered solutions and big libraries, which should help. This is the exact opposite of "best practice" for web development, which encourages largely overcomplicated, garbage systems (looking at you, Angular). What is everyone else doing?
PHP is a symptom of a much larger problem - namely that people use the worst, nastiest (but easiest) solution possible to all their problems. Whether it's enormous libraries, languages written by idiots, or some new "fad" framework that everyone else is using. Literally everything is larger and more complicated than it needs to be. I can fit a file browser in 50k, but Caja, Windows Explorer, and Nautilus all need multiple megabytes? Why? Why is Microsoft Office over a gigabyte? Why does everything need to connect to the web? AAAHH it's bad decisions upon bad decisions and it needs to stop.
If we had a whole generation of competent, efficient coders, I guarantee our security problems would be reduced by an astronomical amount, possibly down to almost zero.<|eor|><|sor|>> I can fit a file browser in 50k
Can you fit a file browser that has as many features as the ones you mentioned into 50k too?<|eor|><|eols|><|endoftext|> | 8 |
lolphp | dotted | fg2uj7e | <|sols|><|sot|>PHP 0 day exploit<|eot|><|sol|>https://github.com/mm0r1/exploits/tree/master/php7-backtrace-bypass<|eol|><|sor|>Any of you regulars want to chime in on why this isn't a lolphp?<|eor|><|sor|>Because all software has security issues and it's not something unique for PHP?<|eor|><|sor|>Any software that is badly written enough to have serious security vulnerabilities is a lolphp
Software used to be so much better.<|eor|><|sor|>My dude, then every single piece of software is lolphp - it becomes entirely meaningless. Even CPU's are lolphp then, remember Spectre? Don't muddy the waters.<|eor|><|sor|>I don't even disagree. Intel is absolutely lolphp. So is the vast, vast majority of modern software.
You say that like it somehow refutes my point. It's part of it.<|eor|><|sor|>And AMD is lolphp, and so is ARM. Don't you understand that you are literally arguing every single bit of software and hardware is lolphp? What the fuck is the point in doing that?
>So is the vast, vast majority of modern software.
No it isn't a vast anything, it's everything. There is nothing that wouldn't be lolphp.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | dotted | fg2vjkf | <|sols|><|sot|>PHP 0 day exploit<|eot|><|sol|>https://github.com/mm0r1/exploits/tree/master/php7-backtrace-bypass<|eol|><|sor|>Any of you regulars want to chime in on why this isn't a lolphp?<|eor|><|sor|>Because all software has security issues and it's not something unique for PHP?<|eor|><|sor|>Any software that is badly written enough to have serious security vulnerabilities is a lolphp
Software used to be so much better.<|eor|><|sor|>My dude, then every single piece of software is lolphp - it becomes entirely meaningless. Even CPU's are lolphp then, remember Spectre? Don't muddy the waters.<|eor|><|sor|>I don't even disagree. Intel is absolutely lolphp. So is the vast, vast majority of modern software.
You say that like it somehow refutes my point. It's part of it.<|eor|><|sor|>And AMD is lolphp, and so is ARM. Don't you understand that you are literally arguing every single bit of software and hardware is lolphp? What the fuck is the point in doing that?
>So is the vast, vast majority of modern software.
No it isn't a vast anything, it's everything. There is nothing that wouldn't be lolphp.<|eor|><|sor|>Then maybe it's time to fix the industry, no?
Saying "we can't say everything is bad because EVERYTHING would be bad" is a really dumb position to take. Everything is bad.
Let's be the change we want to see in the world. I have already started being more self-reliant code wise and not relying on overengineered solutions and big libraries, which should help. This is the exact opposite of "best practice" for web development, which encourages largely overcomplicated, garbage systems (looking at you, Angular). What is everyone else doing?
PHP is a symptom of a much larger problem - namely that people use the worst, nastiest (but easiest) solution possible to all their problems. Whether it's enormous libraries, languages written by idiots, or some new "fad" framework that everyone else is using. Literally everything is larger and more complicated than it needs to be. I can fit a file browser in 50k, but Caja, Windows Explorer, and Nautilus all need multiple megabytes? Why? Why is Microsoft Office over a gigabyte? Why does everything need to connect to the web? AAAHH it's bad decisions upon bad decisions and it needs to stop.
If we had a whole generation of competent, efficient coders, I guarantee our security problems would be reduced by an astronomical amount, possibly down to almost zero.<|eor|><|sor|>>Then maybe it's time to fix the industry, no?
You cannot hope to change the industry in a way that would make it immune to having serious security vulnerabilities. You can spend all the money you want and you can do everything you can to catch vulnerabilities before software is released, but at the end of the day you will never be immune. And according to you, if you aren't immune to serious security vulnerabilities it's lolphp, can you see how dumb your position is now?
>Saying "we shouldn't do anything because EVERYTHING sucks" is a really dumb position to take.
When did I say that? I'm sorry, what has that even remotely got to do with anything being lolphp?
>If we had a whole generation of competent, efficient coders, I guarantee our security problems would be reduced by an astronomical amount, possibly down to almost zero.
Reduce? Sure, but never zero and in your words even in your utopia that would remain lolphp.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | UnacceptableUse | fg3bc7n | <|sols|><|sot|>PHP 0 day exploit<|eot|><|sol|>https://github.com/mm0r1/exploits/tree/master/php7-backtrace-bypass<|eol|><|sor|>Any software that is badly written enough to have serious security vulnerabilities is a lolphp
Software used to be so much better.<|eor|><|sor|>My dude, then every single piece of software is lolphp - it becomes entirely meaningless. Even CPU's are lolphp then, remember Spectre? Don't muddy the waters.<|eor|><|sor|>I don't even disagree. Intel is absolutely lolphp. So is the vast, vast majority of modern software.
You say that like it somehow refutes my point. It's part of it.<|eor|><|sor|>And AMD is lolphp, and so is ARM. Don't you understand that you are literally arguing every single bit of software and hardware is lolphp? What the fuck is the point in doing that?
>So is the vast, vast majority of modern software.
No it isn't a vast anything, it's everything. There is nothing that wouldn't be lolphp.<|eor|><|sor|>Then maybe it's time to fix the industry, no?
Saying "we can't say everything is bad because EVERYTHING would be bad" is a really dumb position to take. Everything is bad.
Let's be the change we want to see in the world. I have already started being more self-reliant code wise and not relying on overengineered solutions and big libraries, which should help. This is the exact opposite of "best practice" for web development, which encourages largely overcomplicated, garbage systems (looking at you, Angular). What is everyone else doing?
PHP is a symptom of a much larger problem - namely that people use the worst, nastiest (but easiest) solution possible to all their problems. Whether it's enormous libraries, languages written by idiots, or some new "fad" framework that everyone else is using. Literally everything is larger and more complicated than it needs to be. I can fit a file browser in 50k, but Caja, Windows Explorer, and Nautilus all need multiple megabytes? Why? Why is Microsoft Office over a gigabyte? Why does everything need to connect to the web? AAAHH it's bad decisions upon bad decisions and it needs to stop.
If we had a whole generation of competent, efficient coders, I guarantee our security problems would be reduced by an astronomical amount, possibly down to almost zero.<|eor|><|sor|>> I can fit a file browser in 50k
Can you fit a file browser that has as many features as the ones you mentioned into 50k too?<|eor|><|sor|>Yes<|eor|><|sor|>That's impressive. Maybe Microsoft are hiring? There's probably more than 50kb of text alone in explorer, especially considering it controls the taskbar too. They'd be very interested in hearing how you can pull this off.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | berkes | fg3ghc3 | <|sols|><|sot|>PHP 0 day exploit<|eot|><|sol|>https://github.com/mm0r1/exploits/tree/master/php7-backtrace-bypass<|eol|><|sor|>Any of you regulars want to chime in on why this isn't a lolphp?<|eor|><|sor|>You need access to the file system and specifically crafted code to exploit it. The bug is known for 2 years, it was already reported 2 years ago and wasnt fixed then because its hard to exploit it.<|eor|><|sor|>This is patently false.
PHP has [`eval()`](https://www.php.net/manual/en/function.eval.php) which allows anyone who can gain access to now basically take over the entire server without write-access.
Edit: Also note that popular tools like WordPress (or Matomo, or Nexcloud) rely on "being able to overwrite themselves from within their own app" for updating (a very bad security practice, BTW: your PHP-files should not be writable by the files themselves; only some "deploy" user should have write access, not the "http" user).
Eval comes with loads of security issues, so it is disabled entirely on any sane or safe webhost. But, disabling, breaks most popular CMSes like WordPress or Drupal as they rely on it for certain features.
One could argue that if you can `eval()` this exploit is the least of your issues. And that is true.
This exploit, however, can probably be abused to gain access to eval() given the right preconditions.
Edit: and when an application can (over)write itself, which is required for e.g. WordPress updates, exploits like this one, can be abused, under certain preconditions, to overwrite itself with insecure code. In essence: use this exploit to get write access to the system.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | feketegy | bbrfw6 | <|sols|><|sot|>Microservices, bundlers, deployment pipelines... meanwhile at PHP land they added array_key_first<|eot|><|sol|>https://www.php.net/manual/en/function.array-key-first.php<|eol|><|eols|><|endoftext|> | 39 |
lolphp | Hauleth | ekmr5a4 | <|sols|><|sot|>Microservices, bundlers, deployment pipelines... meanwhile at PHP land they added array_key_first<|eot|><|sol|>https://www.php.net/manual/en/function.array-key-first.php<|eol|><|sor|>PHP, one of the fastest interpreted languages in the world, also just added a JIT to the upcoming 8.0 release to make it even faster in the future. What is your point? Is it forbidden to make smaller improvements to a language?<|eor|><|soopr|>*LOLs in compiled language* :))
Also, why array_key_first when there's like myArr[0]... ?<|eoopr|><|sor|>You know there are arrays more complicated than [1, 2, 3]?<|eor|><|sor|>There is special place in hell for designers of languages that do not differentiate between maps/dictionaries and arrays/vectors.<|eor|><|eols|><|endoftext|> | 21 |
lolphp | polish_niceguy | ekmgphe | <|sols|><|sot|>Microservices, bundlers, deployment pipelines... meanwhile at PHP land they added array_key_first<|eot|><|sol|>https://www.php.net/manual/en/function.array-key-first.php<|eol|><|sor|>PHP, one of the fastest interpreted languages in the world, also just added a JIT to the upcoming 8.0 release to make it even faster in the future. What is your point? Is it forbidden to make smaller improvements to a language?<|eor|><|soopr|>*LOLs in compiled language* :))
Also, why array_key_first when there's like myArr[0]... ?<|eoopr|><|sor|>You know there are arrays more complicated than [1, 2, 3]?<|eor|><|eols|><|endoftext|> | 11 |
lolphp | iluuu | ekmmcuf | <|sols|><|sot|>Microservices, bundlers, deployment pipelines... meanwhile at PHP land they added array_key_first<|eot|><|sol|>https://www.php.net/manual/en/function.array-key-first.php<|eol|><|sor|>PHP, one of the fastest interpreted languages in the world, also just added a JIT to the upcoming 8.0 release to make it even faster in the future. What is your point? Is it forbidden to make smaller improvements to a language?<|eor|><|soopr|>*LOLs in compiled language* :))
Also, why array_key_first when there's like myArr[0]... ?<|eoopr|><|sor|>Arrays in PHP aren't just arrays. They are also hash maps and doubly linked lists. The first key of an array isn't always `0`.<|eor|><|eols|><|endoftext|> | 10 |
lolphp | makioo | ekmf38f | <|sols|><|sot|>Microservices, bundlers, deployment pipelines... meanwhile at PHP land they added array_key_first<|eot|><|sol|>https://www.php.net/manual/en/function.array-key-first.php<|eol|><|sor|>PHP, one of the fastest interpreted languages in the world, also just added a JIT to the upcoming 8.0 release to make it even faster in the future. What is your point? Is it forbidden to make smaller improvements to a language?<|eor|><|soopr|>*LOLs in compiled language* :))
Also, why array_key_first when there's like myArr[0]... ?<|eoopr|><|sor|>>php.net/manual...
there is literally an example below in your pasted link
​
**Example #1 Basic** **array\_key\_first()** **Usage**
<?php
$array=['a'=>1,'b'=>2,'c'=>3];
$firstKey=array_key_first($array);
var_dump($firstKey);
?>
The above example will output:
string(1) "a"<|eor|><|eols|><|endoftext|> | 10 |
lolphp | AstralWay | ekm6t7c | <|sols|><|sot|>Microservices, bundlers, deployment pipelines... meanwhile at PHP land they added array_key_first<|eot|><|sol|>https://www.php.net/manual/en/function.array-key-first.php<|eol|><|sor|>This is such a revolutionary innovation.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | iluuu | ekms54k | <|sols|><|sot|>Microservices, bundlers, deployment pipelines... meanwhile at PHP land they added array_key_first<|eot|><|sol|>https://www.php.net/manual/en/function.array-key-first.php<|eol|><|sor|>PHP, one of the fastest interpreted languages in the world, also just added a JIT to the upcoming 8.0 release to make it even faster in the future. What is your point? Is it forbidden to make smaller improvements to a language?<|eor|><|soopr|>*LOLs in compiled language* :))
Also, why array_key_first when there's like myArr[0]... ?<|eoopr|><|sor|>You know there are arrays more complicated than [1, 2, 3]?<|eor|><|sor|>There is special place in hell for designers of languages that do not differentiate between maps/dictionaries and arrays/vectors.<|eor|><|sor|>I don't like the fact that PHP arrays try to be everything at once. Nevertheless, it is what it is. `array_key_first` is necessary because there's currently no way to get the first key without creating a new array and copying all the key values just to discard them again (`array_keys($array)[0]`) or to reset the internal array pointer (`reset($array); $key = key($array);`).
PHP didn't get everything right but the fact that it takes backwards compatibility so seriously is applaudable.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | the_alias_of_andrea | elwoxy5 | <|sols|><|sot|>Microservices, bundlers, deployment pipelines... meanwhile at PHP land they added array_key_first<|eot|><|sol|>https://www.php.net/manual/en/function.array-key-first.php<|eol|><|sor|>It is a useful function I have wanted for a long time. PHP arrays are ordered maps, and it wasn't otherwise possible to get the first and last keys without either using reset() and friends (modifies or copies the array) or by iteration (O(n) slow obviously).<|eor|><|eols|><|endoftext|> | 6 |
lolphp | cbraga | 2qvrgr | <|sols|><|sot|>Is your new PHP code too good to run on the hosts you got? Solve your problems with php-code-downgrade<|eot|><|sol|>https://github.com/endel/php-code-downgrade/<|eol|><|eols|><|endoftext|> | 37 |
lolphp | cbraga | cn9z9oi | <|sols|><|sot|>Is your new PHP code too good to run on the hosts you got? Solve your problems with php-code-downgrade<|eot|><|sol|>https://github.com/endel/php-code-downgrade/<|eol|><|soopr|>Gold from the source:
echo "** Warning **\n";
echo "Every '$root_path/**.php' file will be changed into a downgraded PHP version.\n";
echo "It's highly recommended to create a backup of those files.\n";
echo "Continue? (y/n) ";
PHP: It's 2015 and what is revision control?
I do realize it's hosted in github but it's just a place people throw their code to be downloaded, I don't have time to learn all those commands while I debug my live webserver.<|eoopr|><|eols|><|endoftext|> | 19 |
lolphp | caseypatrickdriscoll | 2pm5ff | <|soss|><|sot|>imp-lol-de()<|eot|><|sost|>implode() can, for historical reasons, *accept its parameters in either order*. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
http://php.net/manual/en/function.implode.php<|eost|><|eoss|><|endoftext|> | 41 |
lolphp | Rhomboid | cmyg5bo | <|soss|><|sot|>imp-lol-de()<|eot|><|sost|>implode() can, for historical reasons, *accept its parameters in either order*. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
http://php.net/manual/en/function.implode.php<|eost|><|sor|>I'd say the real lol here is PHP using their own made-up names ('implode' and 'explode') for operations that have de facto standard names ('join' and 'split') in practically every other language. And the documentation for 'explode' uses the established nomenclature, referring to the delimiter as 'delimiter', whereas 'implode' refers to it as 'glue'.<|eor|><|eoss|><|endoftext|> | 39 |
lolphp | Aquatakat | cmyg6vj | <|soss|><|sot|>imp-lol-de()<|eot|><|sost|>implode() can, for historical reasons, *accept its parameters in either order*. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
http://php.net/manual/en/function.implode.php<|eost|><|sor|>I'd say the real lol here is PHP using their own made-up names ('implode' and 'explode') for operations that have de facto standard names ('join' and 'split') in practically every other language. And the documentation for 'explode' uses the established nomenclature, referring to the delimiter as 'delimiter', whereas 'implode' refers to it as 'glue'.<|eor|><|sor|>Ah, but PHP conveniently aliases implode with [join](http://php.net/function.join), and also aliases explode with spli- Oh wait. [split](http://php.net/function.split) is some bizarre function that splits strings into an array by regular expressions. OF COURSE. THIS ALL MAKES PERFECT SENSE.<|eor|><|eoss|><|endoftext|> | 33 |
lolphp | barubary | cmyo0m7 | <|soss|><|sot|>imp-lol-de()<|eot|><|sost|>implode() can, for historical reasons, *accept its parameters in either order*. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
http://php.net/manual/en/function.implode.php<|eost|><|sor|>One of them *must* be an array.
It'd be more LOL-worthy if both could be strings. Now *that* would be confusing. What would this return?
$mystery = implode("a", "b") // doesn't work, (un)fortunately
<|eor|><|sor|>> One of them must be an array.
What happens if both are arrays?<|eor|><|sor|><|eor|><|sor|>That's not what the code says. If both are arrays, it silently coerces the second array to a string and uses it as the delimiter.<|eor|><|eoss|><|endoftext|> | 26 |
lolphp | Rhomboid | cmyoqf3 | <|soss|><|sot|>imp-lol-de()<|eot|><|sost|>implode() can, for historical reasons, *accept its parameters in either order*. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
http://php.net/manual/en/function.implode.php<|eost|><|sor|>I'd say the real lol here is PHP using their own made-up names ('implode' and 'explode') for operations that have de facto standard names ('join' and 'split') in practically every other language. And the documentation for 'explode' uses the established nomenclature, referring to the delimiter as 'delimiter', whereas 'implode' refers to it as 'glue'.<|eor|><|sor|>Ah, but PHP conveniently aliases implode with [join](http://php.net/function.join), and also aliases explode with spli- Oh wait. [split](http://php.net/function.split) is some bizarre function that splits strings into an array by regular expressions. OF COURSE. THIS ALL MAKES PERFECT SENSE.<|eor|><|sor|>I was curious how many different ways PHP has of splitting or tokenizing a string, and a cursory search of the manual reveals:
array split ( string $pattern , string $string [, int $limit = -1 ] )
array spliti ( string $pattern , string $string [, int $limit = -1 ] )
array mb_split ( string $pattern , string $string [, int $limit = -1 ] )
array str_split ( string $string [, int $split_length = 1 ] )
array preg_split ( string $pattern , string $subject [, int $limit = -1 [, int $flags = 0 ]] )
string chunk_split ( string $body [, int $chunklen = 76 [, string $end = "\r\n" ]] )
array explode ( string $delimiter , string $string [, int $limit ] )
string strtok ( string $str , string $token )
I like how there are four versions that take a regular expression, three taking POSIX extended regex and one taking PCRE. Because of course, doesn't everyone want their standard library littered with several competing regular expression engines? (And what happens if you want to use PCRE with UTF-8? I guess that's just not allowed.)
<|eor|><|eoss|><|endoftext|> | 22 |
lolphp | farsightxr20 | cmypoqp | <|soss|><|sot|>imp-lol-de()<|eot|><|sost|>implode() can, for historical reasons, *accept its parameters in either order*. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
http://php.net/manual/en/function.implode.php<|eost|><|sor|>[deleted]<|eor|><|sor|>In their defense, it's a lot easier to maintain backwards compatibility when your API was sane to begin with. If PHP fixed all their WTFs in a new major version, porting would be a huge task and no one would ever bother.<|eor|><|eoss|><|endoftext|> | 9 |
lolphp | svtguy88 | cmyp98l | <|soss|><|sot|>imp-lol-de()<|eot|><|sost|>implode() can, for historical reasons, *accept its parameters in either order*. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
http://php.net/manual/en/function.implode.php<|eost|><|sor|>One of them *must* be an array.
It'd be more LOL-worthy if both could be strings. Now *that* would be confusing. What would this return?
$mystery = implode("a", "b") // doesn't work, (un)fortunately
<|eor|><|sor|>> One of them must be an array.
What happens if both are arrays?<|eor|><|sor|><|eor|><|sor|>That's not what the code says. If both are arrays, it silently coerces the second array to a string and uses it as the delimiter.<|eor|><|sor|>Oh man. That's nasty. The best features are the undocumented ones...<|eor|><|eoss|><|endoftext|> | 8 |
lolphp | OneWingedShark | cn1yxyt | <|soss|><|sot|>imp-lol-de()<|eot|><|sost|>implode() can, for historical reasons, *accept its parameters in either order*. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
http://php.net/manual/en/function.implode.php<|eost|><|sor|>One of them *must* be an array.
It'd be more LOL-worthy if both could be strings. Now *that* would be confusing. What would this return?
$mystery = implode("a", "b") // doesn't work, (un)fortunately
<|eor|><|sor|>> One of them must be an array.
What happens if both are arrays?<|eor|><|sor|><|eor|><|sor|>That's not what the code says. If both are arrays, it silently coerces the second array to a string and uses it as the delimiter.<|eor|><|sor|> php > var_dump(implode(["a", "b", "c"], ["b", "c", "d"]));
PHP Notice: Array to string conversion in php shell code on line 1
Notice: Array to string conversion in php shell code on line 1
string(13) "aArraybArrayc"
Not silently, however it's weird that they decided to make it a notice instead of a warning...
<|eor|><|sor|>> Not silently, however it's weird that they decided to make it a notice instead of a warning...
It's not weird if you consider PHP to be actively hostile to the programmer.<|eor|><|eoss|><|endoftext|> | 8 |
lolphp | thelordofcheese | cmy5heo | <|soss|><|sot|>imp-lol-de()<|eot|><|sost|>implode() can, for historical reasons, *accept its parameters in either order*. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
http://php.net/manual/en/function.implode.php<|eost|><|sor|>It says it can accept parameters in any order, but that makes me wonder if the output will be the same...<|eor|><|sor|>They are of different datatypes.<|eor|><|eoss|><|endoftext|> | 6 |
lolphp | Various_Pickles | cn22hxs | <|soss|><|sot|>imp-lol-de()<|eot|><|sost|>implode() can, for historical reasons, *accept its parameters in either order*. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
http://php.net/manual/en/function.implode.php<|eost|><|sor|>I'd say the real lol here is PHP using their own made-up names ('implode' and 'explode') for operations that have de facto standard names ('join' and 'split') in practically every other language. And the documentation for 'explode' uses the established nomenclature, referring to the delimiter as 'delimiter', whereas 'implode' refers to it as 'glue'.<|eor|><|sor|>Ah, but PHP conveniently aliases implode with [join](http://php.net/function.join), and also aliases explode with spli- Oh wait. [split](http://php.net/function.split) is some bizarre function that splits strings into an array by regular expressions. OF COURSE. THIS ALL MAKES PERFECT SENSE.<|eor|><|sor|>I was curious how many different ways PHP has of splitting or tokenizing a string, and a cursory search of the manual reveals:
array split ( string $pattern , string $string [, int $limit = -1 ] )
array spliti ( string $pattern , string $string [, int $limit = -1 ] )
array mb_split ( string $pattern , string $string [, int $limit = -1 ] )
array str_split ( string $string [, int $split_length = 1 ] )
array preg_split ( string $pattern , string $subject [, int $limit = -1 [, int $flags = 0 ]] )
string chunk_split ( string $body [, int $chunklen = 76 [, string $end = "\r\n" ]] )
array explode ( string $delimiter , string $string [, int $limit ] )
string strtok ( string $str , string $token )
I like how there are four versions that take a regular expression, three taking POSIX extended regex and one taking PCRE. Because of course, doesn't everyone want their standard library littered with several competing regular expression engines? (And what happens if you want to use PCRE with UTF-8? I guess that's just not allowed.)
<|eor|><|sor|>> with UTF-8
/r/lolphp*no*<|eor|><|eoss|><|endoftext|> | 6 |
lolphp | bart2019 | cmydi3z | <|soss|><|sot|>imp-lol-de()<|eot|><|sost|>implode() can, for historical reasons, *accept its parameters in either order*. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
http://php.net/manual/en/function.implode.php<|eost|><|sor|>One of them *must* be an array.
It'd be more LOL-worthy if both could be strings. Now *that* would be confusing. What would this return?
$mystery = implode("a", "b") // doesn't work, (un)fortunately
<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | nikic | cmysmx7 | <|soss|><|sot|>imp-lol-de()<|eot|><|sost|>implode() can, for historical reasons, *accept its parameters in either order*. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
http://php.net/manual/en/function.implode.php<|eost|><|sor|>One of them *must* be an array.
It'd be more LOL-worthy if both could be strings. Now *that* would be confusing. What would this return?
$mystery = implode("a", "b") // doesn't work, (un)fortunately
<|eor|><|sor|>> One of them must be an array.
What happens if both are arrays?<|eor|><|sor|><|eor|><|sor|>That's not what the code says. If both are arrays, it silently coerces the second array to a string and uses it as the delimiter.<|eor|><|sor|>It will coerce the second array, but not silently.<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | mort96 | cn1pw0b | <|soss|><|sot|>imp-lol-de()<|eot|><|sost|>implode() can, for historical reasons, *accept its parameters in either order*. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
http://php.net/manual/en/function.implode.php<|eost|><|sor|>One of them *must* be an array.
It'd be more LOL-worthy if both could be strings. Now *that* would be confusing. What would this return?
$mystery = implode("a", "b") // doesn't work, (un)fortunately
<|eor|><|sor|>> One of them must be an array.
What happens if both are arrays?<|eor|><|sor|><|eor|><|sor|>That's not what the code says. If both are arrays, it silently coerces the second array to a string and uses it as the delimiter.<|eor|><|sor|> php > var_dump(implode(["a", "b", "c"], ["b", "c", "d"]));
PHP Notice: Array to string conversion in php shell code on line 1
Notice: Array to string conversion in php shell code on line 1
string(13) "aArraybArrayc"
Not silently, however it's weird that they decided to make it a notice instead of a warning...
<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | katafrakt | 2fwl0y | <|sols|><|sot|>array_diff: Two elements are considered equal if and only if (string) $elem1 === (string) $elem2. In words: when the string representation is the same.<|eot|><|sol|>http://php.net/manual/en/function.array-diff.php<|eol|><|eols|><|endoftext|> | 37 |
lolphp | allthediamonds | ckdkdk7 | <|sols|><|sot|>array_diff: Two elements are considered equal if and only if (string) $elem1 === (string) $elem2. In words: when the string representation is the same.<|eot|><|sol|>http://php.net/manual/en/function.array-diff.php<|eol|><|sor|>I just submitted this the other day for array_intersect.
If you want it to actually work, you have to use array_udiff and provide a custom comparison function; which will be, on most cases, an anonymous function wrapping the equality operator. It's exactly as brainless as it sounds.<|eor|><|eols|><|endoftext|> | 21 |
lolphp | HelloAnnyong | ckdfn25 | <|sols|><|sot|>array_diff: Two elements are considered equal if and only if (string) $elem1 === (string) $elem2. In words: when the string representation is the same.<|eot|><|sol|>http://php.net/manual/en/function.array-diff.php<|eol|><|sor|>PHP really takes the cake for being the language with the most high-level abstractions that you can only use as low-level implementation details because they have one glaring problem or another that makes them useless on their own.<|eor|><|eols|><|endoftext|> | 17 |
lolphp | allthediamonds | ckdp9q9 | <|sols|><|sot|>array_diff: Two elements are considered equal if and only if (string) $elem1 === (string) $elem2. In words: when the string representation is the same.<|eot|><|sol|>http://php.net/manual/en/function.array-diff.php<|eol|><|sor|>Also, in case you don't immediately see how bug-prone and game-breaking this is: the string representation of any array object is just the string "Array".
This means that, for example, array_diff([[1], [2]], [[3], [4]]) will return [[1], [2]]. Furthermore, array_intersect([[1], [2], [3]], [[4]]) will return [[1], [2], [3]]. In PHP, the intersection of two arrays of different sizes can return the biggest of those arrays. This breaks every expectation about intersecting sets, and then some.<|eor|><|eols|><|endoftext|> | 14 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.