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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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: Thu Apr 25 01:01:30 2024 UTC