diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2007-08-05 14:47:42 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2007-08-05 14:47:42 +0000 |
commit | cd32b4e2bb547b1f7f1a726bd2711a7932c758d4 (patch) | |
tree | 01f2922902da6f58aef39c553cb09071663b61a9 | |
parent | 6f25b84a3abb84b9f598ececce61768cd76d7c60 (diff) | |
download | php-git-cd32b4e2bb547b1f7f1a726bd2711a7932c758d4.tar.gz |
Fixed bug #42208 (substr_replace() crashes when the same array is passed
more than once)
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/standard/string.c | 1 | ||||
-rw-r--r-- | ext/standard/tests/strings/bug42208.phpt | 15 |
3 files changed, 18 insertions, 0 deletions
@@ -1,6 +1,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Aug 2007, PHP 5.2.4 +- Fixed bug #42208 (substr_replace() crashes when the same array is passed + more than once). (crrodriguez at suse dot de, Ilia) - Fixed bug #36492 (Userfilters can leak buckets). (Sara) 02 Aug 2007, PHP 5.2.4RC1 diff --git a/ext/standard/string.c b/ext/standard/string.c index 2617c681b3..e7b36a27ac 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2168,6 +2168,7 @@ PHP_FUNCTION(substr_replace) } if (argc > 3) { + SEPARATE_ZVAL(len); if (Z_TYPE_PP(len) != IS_ARRAY) { convert_to_long_ex(len); l = Z_LVAL_PP(len); diff --git a/ext/standard/tests/strings/bug42208.phpt b/ext/standard/tests/strings/bug42208.phpt new file mode 100644 index 0000000000..72488a93d8 --- /dev/null +++ b/ext/standard/tests/strings/bug42208.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #42208 (substr_replace() crashes when the same array is passed more than once) +--FILE-- +<?php +$a = array(1, 2); +$c = $a; +var_dump(substr_replace($a, 1, 1, $c)); +?> +--EXPECT-- +array(2) { + [0]=> + string(2) "11" + [1]=> + string(2) "21" +} |