From b548293b99b80654e73b85f7dc5f9da0f9eb44d7 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 22 Nov 2011 10:11:06 +0000 Subject: [PATCH] Fixed bug #60357 (__toString() method triggers E_NOTICE "Array to string conversion") --- NEWS | 4 ++++ ext/reflection/php_reflection.c | 2 ++ ext/reflection/tests/bug60357.phpt | 10 ++++++++++ 3 files changed, 16 insertions(+) create mode 100644 ext/reflection/tests/bug60357.phpt diff --git a/NEWS b/NEWS index a472c323bb..dd331e9b9b 100644 --- a/NEWS +++ b/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) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index a6339fa56f..1e0386a601 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -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)); diff --git a/ext/reflection/tests/bug60357.phpt b/ext/reflection/tests/bug60357.phpt new file mode 100644 index 0000000000..a5ddd4096c --- /dev/null +++ b/ext/reflection/tests/bug60357.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #60357 (__toString() method triggers E_NOTICE "Array to string conversion") +--FILE-- +__toString(); +?> +--EXPECTF-- +Parameter #0 [ array $x = Array ] -- 2.50.1