php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42789 join() warning messages are not proper & different return value on php5/6
Submitted: 2007-09-28 16:25 UTC Modified: 2007-10-01 12:06 UTC
From: kraghuba at in dot ibm dot com Assigned:
Status: Closed Package: Strings related
PHP Version: 5CVS-2007-09-28 (snap) OS: windows/linux
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: kraghuba at in dot ibm dot com
New email:
PHP Version: OS:

 

 [2007-09-28 16:25 UTC] kraghuba at in dot ibm dot com
Description:
------------
join() function doesn't generate proper warning messages when following conditions occur:
1) when join() is called with less than expected no. of argument, the warning message generated refers to implode function.
Here is the actual output that is generated(in other warning it doesn't refer to implode function):
Warning: join(): Argument to implode must be an array. in %s on line %d

NULL

2) When the value of pieces argument is given other than an array, warning message generated is not giving enough info. It should
be changed to indicate right required input type. Currently error message that get generated is as follows:

Warning: join(): Bad arguments in C:\workdir\ibm\php6\ext\standard\tests\strings\join_variation2.php on line 89

bool(false)

3) the return value of this function differ on php5 and php6 when it generates an warning message:

on php5, the return value is NULL
on php6, the reutrn value is bool(false)

I think, it should be consistent.


Reproduce code:
---------------
<?php
  $glue = ", ";
  var_dump( join($glue) ); // less than expected no. of args

  $pieces = 10; // not an array
  var_dump( join($glue, $pieces) );
?>

Actual result:
--------------
on php6:
---------
Warning: join(): Argument to implode must be an array in %s on line %d 
bool(false)

Warning: join(): Bad arguments in %s on line %d
bool(false)

on php5:
--------
Warning: join(): Argument to implode must be an array. in %s on line %d
NULL

Warning: join(): Bad arguments. in %s on line %d
NULL

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-30 14:37 UTC] tony2001@php.net
join() is an alias of implode(), so the error messages is correct.
 [2007-10-01 12:06 UTC] jani@php.net
Fixed in CVS. (I removed the part about 'joining' altogether, it's obvious from the error message anyway) Also made the return value same in both 5.3 and HEAD.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Jan 28 19:01:26 2020 UTC