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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
49 - 45 = ?
Subscribe to this entry?

 
 [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 08:01:29 2024 UTC