#42789 [Opn]: join() warning messages are not proper & different return value on php5/6
| From: | tony2001@php.net | Date: | Sun, 30 Sep 2007 14:37:25 +0000 |
| Subject: | #42789 [Opn]: join() warning messages are not proper & different return value on php5/6 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-117981@lists.php.net to get a copy of this message | ||
ID: 42789
Updated by: tony2001@php.net
Reported By: kraghuba at in dot ibm dot com
Status: Open
Bug Type: Strings related
Operating System: windows/linux
PHP Version: 5CVS-2007-09-28 (snap)
New Comment:
join() is an alias of implode(), so the error messages is correct.
Previous Comments:
------------------------------------------------------------------------
[2007-09-28 16:25:49] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42789&edit=1