mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
Fixed bug #60357 (__toString() method triggers E_NOTICE "Array to string conversion")
This commit is contained in:
parent
ecc6c335c5
commit
b548293b99
4
NEWS
4
NEWS
@ -60,6 +60,10 @@ PHP NEWS
|
||||
- BCmath:
|
||||
. Fixed bug #60377 (bcscale related crashes on 64bits platforms) (shm)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug #60357 (__toString() method triggers E_NOTICE "Array to string
|
||||
conversion"). (Laruence)
|
||||
|
||||
11 Nov 2011, PHP 5.4.0 RC1
|
||||
- General improvements:
|
||||
. Changed silent conversion of array to string to produce a notice. (Patrick)
|
||||
|
@ -746,6 +746,8 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
|
||||
string_write(str, "...", sizeof("...")-1);
|
||||
}
|
||||
string_write(str, "'", sizeof("'")-1);
|
||||
} else if (Z_TYPE_P(zv) == IS_ARRAY) {
|
||||
string_write(str, "Array", sizeof("Array")-1);
|
||||
} else {
|
||||
zend_make_printable_zval(zv, &zv_copy, &use_copy);
|
||||
string_write(str, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy));
|
||||
|
10
ext/reflection/tests/bug60357.phpt
Normal file
10
ext/reflection/tests/bug60357.phpt
Normal file
@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Bug #60357 (__toString() method triggers E_NOTICE "Array to string conversion")
|
||||
--FILE--
|
||||
<?php
|
||||
function foo( array $x = array( 'a', 'b' ) ) {}
|
||||
$r = new ReflectionParameter( 'foo', 0 );
|
||||
echo $r->__toString();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Parameter #0 [ <optional> array $x = Array ]
|
Loading…
Reference in New Issue
Block a user