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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC