Bug #75141 [Opn->Nab]: implode returns NULL at times.
| From: | requinix@php.net | Date: | Thu, 31 Aug 2017 20:36:00 +0000 |
| Subject: | Bug #75141 [Opn->Nab]: implode returns NULL at times. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-210899@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75141&edit=1
ID: 75141
Updated by: requinix@php.net
Reported by: abeal at eelzee dot com
Summary: implode returns NULL at times.
-Status: Open
+Status: Not a bug
Type: Bug
-Package: PHP Language Specification
+Package: *General Issues
Operating System: ANY
PHP Version: 5.6.31
Block user comment: N
Private report: N
New Comment:
Did you notice that it prints "TRUE" and not "Is null: TRUE"?
http://php.net/manual/en/language.operators.precedence.php
print "Is null: " . (NULL === implode(" - ", []) ? "TRUE" :
"FALSE");
Previous Comments:
------------------------------------------------------------------------
[2017-08-31 20:27:22] abeal at eelzee dot com
Description:
------------
---
From manual page: http://www.php.net/function.implode
---
It seems that in certain cases, implode returns NULL. This seems in violation of the specification.
One of the commenters mentions that it will do so if passed a string as well. Should this not be
rectified, at least for future versions? If not, should the documentation be updated to reflect the
circumstances where NULL is returned instead of an empty string?
Test script:
---------------
// Prints "TRUE";
print "Is null: " . (NULL === implode(" - ", [])) ? "TRUE" :
"FALSE";
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75141&edit=1