]> granicus.if.org Git - php/commitdiff
Deprecate implode() with swapped parameter order
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 12 Jul 2019 08:31:16 +0000 (10:31 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 22 Jul 2019 09:39:52 +0000 (11:39 +0200)
Zend/tests/unexpected_ref_bug.phpt
ext/standard/string.c
ext/standard/tests/strings/explode_variation7.phpt
ext/standard/tests/strings/implode1.phpt
ext/standard/tests/strings/join_variation1.phpt
ext/standard/tests/strings/join_variation4.phpt
ext/standard/tests/strings/join_variation5.phpt

index c7f66f05a00f2c4b82e7b3ef55ed8dcdbe87af35..a4e74e7a670b6dfccd279eea67ccfc42d4ffbf2b 100644 (file)
@@ -15,5 +15,6 @@ $my_var=array(1,2,3);
 $data = call_user_func_array("implode",array(&$my_var, new Test()));
 echo "Done.\n";
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
 Done.
index c5a18f5364c785978748901c6f79bf9e73d0c204..d854b240732bb51a77d8d735736cc661ecf4580c 100644 (file)
@@ -1292,6 +1292,8 @@ PHP_FUNCTION(implode)
                if (Z_TYPE_P(arg1) == IS_ARRAY) {
                        glue = zval_get_tmp_string(arg2, &tmp_glue);
                        pieces = arg1;
+                       php_error_docref(NULL, E_DEPRECATED,
+                               "Passing glue string after array is deprecated. Swap the parameters");
                } else if (Z_TYPE_P(arg2) == IS_ARRAY) {
                        glue = zval_get_tmp_string(arg1, &tmp_glue);
                        pieces = arg2;
index d645c6cb036b7a3e0abd05a0ff826ffe97e3973f..877da0edc05c5226cd0f659ad125078209c0d44e 100644 (file)
@@ -11,7 +11,7 @@ edgarsandi - <edgar.r.sandi@gmail.com>
  * Source code: ext/standard/string.c
 */
 
-var_dump(count(explode('|', implode(range(1,65),'|'), -1)));
+var_dump(count(explode('|', implode('|', range(1,65)), -1)));
 
 ?>
 --EXPECT--
index 085c9bc0cdcec88043d43d2a832ad0a947238ea4..629f4ce60cb28a819c542edfc001b1b037cb0f33 100644 (file)
Binary files a/ext/standard/tests/strings/implode1.phpt and b/ext/standard/tests/strings/implode1.phpt differ
index e298fec6ae420256253b27ce9788117f8d2c3191..695ee2ddca8cf9cb63b1cae9f5f433798a7221b3 100644 (file)
@@ -123,22 +123,32 @@ string(19) "element10.5element2"
 -- Iteration 10 --
 
 Notice: Array to string conversion in %s on line %d
+
+Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
 string(0) ""
 -- Iteration 11 --
 
 Notice: Array to string conversion in %s on line %d
+
+Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
 string(1) "0"
 -- Iteration 12 --
 
 Notice: Array to string conversion in %s on line %d
+
+Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
 string(1) "1"
 -- Iteration 13 --
 
 Notice: Array to string conversion in %s on line %d
+
+Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
 string(7) "1Array2"
 -- Iteration 14 --
 
 Notice: Array to string conversion in %s on line %d
+
+Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
 string(11) "redArraypen"
 -- Iteration 15 --
 string(17) "element11element2"
index b4c4b052f2ef22aa4c79e45f62e207a0e37e5ffa..f6154f1e4d78179585ec14f2043f351542b24314 100644 (file)
Binary files a/ext/standard/tests/strings/join_variation4.phpt and b/ext/standard/tests/strings/join_variation4.phpt differ
index 361f65bbc554425921014629e7dc88f9ca800325..e3f3e7ec08b043691f2f8bafba8e1a5115654e8b 100644 (file)
@@ -39,6 +39,8 @@ Notice: Array to string conversion in %s on line %d
 string(27) "ArrayTESTArrayTESTPHPTEST50"
 
 Notice: Array to string conversion in %s on line %d
+
+Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
 string(19) "1Array2Array3Array4"
 
 Notice: Array to string conversion in %s on line %d