com php-src: Deprecate mb_parse_str() without secon d argument: Zend/tests/this_in_mb_parse_str.php t ext/mbstring/mbstring.c ext/mbstring/tests/bug200 87.phpt ext/mbstring/tests/common.inc ext/mbstring/ tests/mb_parse_str.phpt ext/mbstring/tests/mb_parse _str02.phpt

[email protected] (Nikita Popov)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    2df9346e7f9a0ecc204a1d615b5c151b8ed053f5
Author:    Nikita Popov <[email protected]>         Thu, 2 Feb 2017 00:44:18 +0100
Parents:   2634b13e88e1b2be91cb06d041be15814b2b6082
Branches:  master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=2df9346e7f9a0ecc204a1d615b5c151b8ed053f5

Log:
Deprecate mb_parse_str() without second argument

Changed paths:
  M  Zend/tests/this_in_mb_parse_str.phpt
  M  ext/mbstring/mbstring.c
  M  ext/mbstring/tests/bug20087.phpt
  M  ext/mbstring/tests/common.inc
  M  ext/mbstring/tests/mb_parse_str.phpt
  M  ext/mbstring/tests/mb_parse_str02.phpt


Diff:
diff --git a/Zend/tests/this_in_mb_parse_str.phpt b/Zend/tests/this_in_mb_parse_str.phpt
index 8dfac94..2d5af47 100644
--- a/Zend/tests/this_in_mb_parse_str.phpt
+++ b/Zend/tests/this_in_mb_parse_str.phpt
@@ -11,6 +11,8 @@ function foo() {
 foo();
 ?>
 --EXPECTF--
+Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
+
 Fatal error: Uncaught Error: Cannot re-assign $this in %sthis_in_mb_parse_str.php:3
 Stack trace:
 #0 %sthis_in_mb_parse_str.php(3): mb_parse_str('this=42')
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 6894d8e..80393d8 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -2195,6 +2195,8 @@ PHP_FUNCTION(mb_parse_str)
 			return;
 		}
 
+		php_error_docref(NULL, E_DEPRECATED, "Calling mb_parse_str() without the result argument is deprecated");
+
 		symbol_table = zend_rebuild_symbol_table();
 		ZVAL_ARR(&tmp, symbol_table);
 		detected = _php_mb_encoding_handler_ex(&info, &tmp, encstr);
diff --git a/ext/mbstring/tests/bug20087.phpt b/ext/mbstring/tests/bug20087.phpt
index 01bcc90..ea6ce1a 100644
--- a/ext/mbstring/tests/bug20087.phpt
+++ b/ext/mbstring/tests/bug20087.phpt
@@ -15,8 +15,10 @@ var_dump(mb_parse_str("test=moo"));
 var_dump($test);
 ?>
 --EXPECT--
+ERR: Deprecated
 bool(true)
 string(0) ""
+ERR: Deprecated
 bool(true)
 string(3) "moo"
 
diff --git a/ext/mbstring/tests/common.inc b/ext/mbstring/tests/common.inc
index 4205cce..c686b06 100644
--- a/ext/mbstring/tests/common.inc
+++ b/ext/mbstring/tests/common.inc
@@ -21,6 +21,7 @@ function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
 				1024=> "User Notice",		// E_USER_NOTICE
 				2048=> "Strict Notice",      // E_STRICT
 				4096=> "Recoverable fatal error",      // E_RECOVERABLE_ERROR
+				8192=> "Deprecated",      // E_DEPRECATED
 				);
 	
 	if (!empty($debug)) {
diff --git a/ext/mbstring/tests/mb_parse_str.phpt b/ext/mbstring/tests/mb_parse_str.phpt
index 59d187b..94f6a9f 100644
--- a/ext/mbstring/tests/mb_parse_str.phpt
+++ b/ext/mbstring/tests/mb_parse_str.phpt
@@ -28,7 +28,7 @@ foreach ($queries as $query) {
 	test($query);
 }
 ?>
---EXPECT--
+--EXPECTF--
 array(2) {
   ["foo"]=>
   string(3) "abc"
@@ -37,6 +37,8 @@ array(2) {
 }
 string(0) ""
 string(0) ""
+
+Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
 string(3) "abc"
 string(3) "def"
 array(2) {
@@ -47,6 +49,8 @@ array(2) {
 }
 string(0) ""
 string(0) ""
+
+Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
 string(0) ""
 string(0) ""
 array(2) {
@@ -67,6 +71,8 @@ array(2) {
 }
 string(0) ""
 string(0) ""
+
+Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
 array(3) {
   [0]=>
   string(3) "abc"
diff --git a/ext/mbstring/tests/mb_parse_str02.phpt b/ext/mbstring/tests/mb_parse_str02.phpt
index f356999..d89137d 100644
--- a/ext/mbstring/tests/mb_parse_str02.phpt
+++ b/ext/mbstring/tests/mb_parse_str02.phpt
@@ -31,7 +31,7 @@ foreach ($queries as $query) {
 	test($query);
 }
 ?>
---EXPECT--
+--EXPECTF--
 array(3) {
   ["foo"]=>
   string(3) "abc"
@@ -43,6 +43,8 @@ array(3) {
 string(0) ""
 string(0) ""
 string(0) ""
+
+Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
 string(3) "abc"
 string(3) "def"
 string(3) "ghi"
@@ -57,6 +59,8 @@ array(3) {
 string(0) ""
 string(0) ""
 string(0) ""
+
+Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
 string(0) ""
 string(0) ""
 string(0) ""
@@ -86,6 +90,8 @@ array(3) {
 string(0) ""
 string(0) ""
 string(0) ""
+
+Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
 array(4) {
   [0]=>
   string(3) "abc"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.