Browse Source

Deprecate mb_parse_str() without second argument

pull/2353/head
Nikita Popov 10 years ago
parent
commit
2df9346e7f
  1. 2
      Zend/tests/this_in_mb_parse_str.phpt
  2. 2
      ext/mbstring/mbstring.c
  3. 2
      ext/mbstring/tests/bug20087.phpt
  4. 1
      ext/mbstring/tests/common.inc
  5. 8
      ext/mbstring/tests/mb_parse_str.phpt
  6. 8
      ext/mbstring/tests/mb_parse_str02.phpt

2
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')

2
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);

2
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"

1
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)) {

8
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"

8
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"

Loading…
Cancel
Save