com php-src: Fixed test. It's not a problem to perform/continue replacing if the source "$search" string was modified by callback, because the source
string is duplicate in this case.: ext/standard/tests/strings/bug55871.phpt
| From: | Dmitry Stogov | Date: | Thu, 21 Aug 2014 12:21:13 +0000 |
| Subject: | com php-src: Fixed test. It's not a problem to perform/continue replacing if the source "$search" string was modified by callback, because the source string is duplicate in this case.: ext/standard/tests/strings/bug55871.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-80678@lists.php.net to get a copy of this message | ||
Commit: 455bcc41829b28e9a05532c28d3302a9b588207b
Author: Dmitry Stogov <dmitry@zend.com> Thu, 21 Aug 2014 16:21:13 +0400
Parents: b0a54673f47caaf20b9f163da3c422e0f47d5655
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=455bcc41829b28e9a05532c28d3302a9b588207b
Log:
Fixed test. It's not a problem to perform/continue replacing if the source "$search"
string was modified by callback, because the source string is duplicate in this case.
Changed paths:
M ext/standard/tests/strings/bug55871.phpt
Diff:
diff --git a/ext/standard/tests/strings/bug55871.phpt b/ext/standard/tests/strings/bug55871.phpt
index 7b743fd..249d1bd 100644
--- a/ext/standard/tests/strings/bug55871.phpt
+++ b/ext/standard/tests/strings/bug55871.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #55871 (Interruption in substr_replace())
+Bug #55871 (Interruption in substr_replace()) (PHP7)
--FILE--
<?php
class test1 {
@@ -25,23 +25,29 @@ class test3 {
$my_var = str_repeat('A', 40);
$out = substr_replace(array(&$my_var), array(new test1), 40, 0);
-var_dump($out);
+var_dump($out, $my_var);
$my_var = str_repeat('A', 40);
$out = substr_replace(array(&$my_var), array(new test2), 40, 0);
-var_dump($out);
+var_dump($out, $my_var);
$my_var = str_repeat('A', 40);
$out = substr_replace(array(&$my_var), array(new test3), 40, 0);
-var_dump($out);
+var_dump($out, $my_var);
--EXPECTF--
-
-Warning: substr_replace(): Argument was modified while replacing in %s on line %d
-array(0) {
+array(1) {
+ [0]=>
+ string(40) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
-
-Warning: substr_replace(): Argument was modified while replacing in %s on line %d
-array(0) {
+array(1) {
+ [0]=>
+ string(0) ""
}
-
-Warning: substr_replace(): Argument was modified while replacing in %s on line %d
-array(0) {
+array(1) {
+ [0]=>
+ string(40) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
+}
+int(134512640)
+array(1) {
+ [0]=>
+ string(40) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
+string(48) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"