php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75141 implode returns NULL at times.
Submitted: 2017-08-31 20:27 UTC Modified: 2017-08-31 20:35 UTC
From: abeal at eelzee dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.6.31 OS: ANY
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: abeal at eelzee dot com
New email:
PHP Version: OS:

 

 [2017-08-31 20:27 UTC] 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";


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-08-31 20:35 UTC] requinix@php.net
-Status: Open +Status: Not a bug -Package: PHP Language Specification +Package: *General Issues
 [2017-08-31 20:35 UTC] 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:55 UTC] abeal at eelzee dot com
*sigh*.  It did seem rather egregious to have gone unnoticed for so long.  Apologies, everyone; bug withdrawn.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 12:01:31 2024 UTC