Bug #75141 [Com]: implode returns NULL at times.

From: Date: Thu, 31 Aug 2017 20:55:33 +0000
Subject: Bug #75141 [Com]: implode returns NULL at times.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210900@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 Comment by: abeal at eelzee dot com Reported by: abeal at eelzee dot com Summary: implode returns NULL at times. Status: Not a bug Type: Bug Package: *General Issues Operating System: ANY PHP Version: 5.6.31 Block user comment: N Private report: N New Comment: *sigh*. It did seem rather egregious to have gone unnoticed for so long. Apologies, everyone; bug withdrawn. Previous Comments: ------------------------------------------------------------------------ [2017-08-31 20:35:59] requinix@php.net 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"); ------------------------------------------------------------------------ [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

« previous php.bugs (#210900) next »