com php-src: Change 'undefined constant' from E_NOTICE to E_WARNING and mention deprecation: NEWS UPGRAD ING Zend/tests/bug37811.phpt Zend/tests/bug4 3344_1.phpt Zend/tests/bug47572.php t Zend/tests/bug69755.phpt Zend/tests/bug69 788.phpt Zend/tests/bug72944.phpt Zend/ tests/bug73163.phpt Zend/tests/constants_00 2.phpt Zend/tests/constants_005.phpt Zend/tes ts/ns_041.phpt Zend/tests/ns_076.phpt Z end/zend_execute_API.c Zend/zend_vm_def.h Zend/ zend_vm_exe
[email protected] (Nikita Popov)
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: 1b565f1393f82e0ce0c94806cc7f52c6d9c5e87d Author: Rowan Collins <[email protected]> Sat, 4 Mar 2017 22:47:19 +0000 Committer: Nikita Popov <[email protected]> Thu, 23 Mar 2017 18:52:43 +0100 Parents: b5b7691ab5b708e29d9dbb5d46dde33aaf534b89 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1b565f1393f82e0ce0c94806cc7f52c6d9c5e87d Log: Change 'undefined constant' from E_NOTICE to E_WARNING and mention deprecation Implements RFC "Deprecate and Remove Bareword (Unquoted) Strings" [https://wiki.php.net/rfc/deprecate-bareword-strings] Changed paths: M NEWS M UPGRADING M Zend/tests/bug37811.phpt M Zend/tests/bug43344_1.phpt M Zend/tests/bug47572.phpt M Zend/tests/bug69755.phpt M Zend/tests/bug69788.phpt M Zend/tests/bug72944.phpt M Zend/tests/bug73163.phpt M Zend/tests/constants_002.phpt M Zend/tests/constants_005.phpt M Zend/tests/ns_041.phpt M Zend/tests/ns_076.phpt M Zend/zend_execute_API.c M Zend/zend_vm_def.h M Zend/zend_vm_execute.h M ext/opcache/tests/bug66251.phpt M ext/opcache/tests/bug71843.phpt M ext/standard/tests/array/array_diff_ukey_variation10.phpt M ext/standard/tests/array/array_intersect_uassoc_variation9.phpt M ext/standard/tests/array/array_intersect_ukey_variation8.phpt M ext/standard/tests/array/count_recursive.phpt M ext/standard/tests/assert/assert_error.phpt M ext/standard/tests/file/fscanf_error.phpt M ext/standard/tests/strings/lcfirst.phpt M ext/standard/tests/strings/ucfirst.phpt M sapi/cli/tests/php_cli_server_014.phpt M tests/classes/constants_basic_001.phpt M tests/classes/constants_scope_001.phpt
diff_1b565f1393f82e0ce0c94806cc7f52c6d9c5e87d.txt
(text/plain, 18 KB)
diff --git a/NEWS b/NEWS
index 5e14ea2..1783736 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,8 @@ PHP NEWS
php.exe). (Michele Locati)
. Implemented "Convert numeric keys in object/array casts" RFC, fixes
bugs #53838, #61655, #66173, #70925, #72254, etc. (Andrea)
+ . Implemented "Deprecate and Remove Bareword (Unquoted) Strings" RFC.
+ (Rowan Collins)
. Raised minimum supported Windows versions to Windows 7/Server 2008 R2.
(Anatol)
. Implemented minor optimization in array_keys/array_values(). (Sara)
diff --git a/UPGRADING b/UPGRADING
index 03d8d68..f6b54d4 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -35,6 +35,9 @@ PHP 7.2 UPGRADE NOTES
/^(0|(-?[1-9][0-9]*))$/ where PHP_INT_MIN <= n <= PHP_INT_MAX) to integer
keys. This fixes the behaviour of previous versions, where numeric string
property names would become inaccessible string keys.
+ . Unqualified references to undefined constants now generate a Warning instead
+ of a notice. They will generate an Error in a future version of PHP.
+ (https://wiki.php.net/rfc/deprecate-bareword-strings)
. Minimum supported Windows versions are Windows 7/Server 2008 R2.
- BCMath:
diff --git a/Zend/tests/bug37811.phpt b/Zend/tests/bug37811.phpt
index f224f9b..2990183 100644
--- a/Zend/tests/bug37811.phpt
+++ b/Zend/tests/bug37811.phpt
@@ -23,6 +23,6 @@ string(3) "Foo"
Warning: Constants may only evaluate to scalar values or arrays in %sbug37811.php on line %d
-Notice: Use of undefined constant Baz - assumed 'Baz' in %sbug37811.php on line %d
+Warning: Use of undefined constant Baz - assumed 'Baz' (this will throw an Error in a future version of PHP) in %sbug37811.php on line %d
string(3) "Baz"
===DONE===
diff --git a/Zend/tests/bug43344_1.phpt b/Zend/tests/bug43344_1.phpt
index 59129d7..4635240 100644
--- a/Zend/tests/bug43344_1.phpt
+++ b/Zend/tests/bug43344_1.phpt
@@ -19,14 +19,14 @@ echo f2()."\n";
echo f3()."\n";
?>
--EXPECTF--
-Notice: Use of undefined constant bar - assumed 'bar' in %sbug43344_1.php on line 13
+Warning: Use of undefined constant bar - assumed 'bar' (this will throw an Error in a future version of PHP) in %sbug43344_1.php on line 13
bar
-Notice: Use of undefined constant bar - assumed 'bar' in %sbug43344_1.php on line 3
+Warning: Use of undefined constant bar - assumed 'bar' (this will throw an Error in a future version of PHP) in %sbug43344_1.php on line 3
bar
-Notice: Use of undefined constant bar - assumed 'bar' in %sbug43344_1.php on line 6
+Warning: Use of undefined constant bar - assumed 'bar' (this will throw an Error in a future version of PHP) in %sbug43344_1.php on line 6
bar
-Notice: Use of undefined constant bar - assumed 'bar' in %sbug43344_1.php on line 9
+Warning: Use of undefined constant bar - assumed 'bar' (this will throw an Error in a future version of PHP) in %sbug43344_1.php on line 9
bar
diff --git a/Zend/tests/bug47572.phpt b/Zend/tests/bug47572.phpt
index 695cc3a..67bb3ec 100644
--- a/Zend/tests/bug47572.phpt
+++ b/Zend/tests/bug47572.phpt
@@ -14,4 +14,4 @@ $foo = new Foo();
?>
--EXPECTF--
-Notice: Use of undefined constant FOO - assumed 'FOO' in %s on line %d
+Warning: Use of undefined constant FOO - assumed 'FOO' (this will throw an Error in a future version of PHP) in %s on line %d
diff --git a/Zend/tests/bug69755.phpt b/Zend/tests/bug69755.phpt
index 67c0ed3..0843280 100644
--- a/Zend/tests/bug69755.phpt
+++ b/Zend/tests/bug69755.phpt
@@ -5,4 +5,4 @@ Bug #69755: segfault in ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDLER
c . 10;
?>
--EXPECTF--
-Notice: Use of undefined constant c - assumed 'c' in %sbug69755.php on line 2
+Warning: Use of undefined constant c - assumed 'c' (this will throw an Error in a future version of PHP) in %sbug69755.php on line 2
diff --git a/Zend/tests/bug69788.phpt b/Zend/tests/bug69788.phpt
index 63dd42d..326328c 100644
--- a/Zend/tests/bug69788.phpt
+++ b/Zend/tests/bug69788.phpt
@@ -5,4 +5,4 @@ Bug #69788: Malformed script causes Uncaught Error in php-cgi, valgrind SIGILL
--EXPECTF--
Notice: Array to string conversion in %s on line %d
-Notice: Use of undefined constant t - assumed 't' in %s on line %d
+Warning: Use of undefined constant t - assumed 't' (this will throw an Error in a future version of PHP) in %s on line %d
diff --git a/Zend/tests/bug72944.phpt b/Zend/tests/bug72944.phpt
index 541730a..5f494be 100644
--- a/Zend/tests/bug72944.phpt
+++ b/Zend/tests/bug72944.phpt
@@ -6,7 +6,7 @@ Bug #72944 (Null pointer deref in zval_delref_p).
echo "OK\n";
?>
--EXPECTF--
-Notice: Use of undefined constant e - assumed 'e' in %sbug72944.php on line 2
+Warning: Use of undefined constant e - assumed 'e' (this will throw an Error in a future version of PHP) in %sbug72944.php on line 2
Notice: Undefined variable: A in %sbug72944.php on line 2
OK
diff --git a/Zend/tests/bug73163.phpt b/Zend/tests/bug73163.phpt
index 448d7f5..5c05604 100644
--- a/Zend/tests/bug73163.phpt
+++ b/Zend/tests/bug73163.phpt
@@ -14,7 +14,7 @@ doSomething();
?>
--EXPECTF--
-Fatal error: Uncaught Exception: Use of undefined constant UNDEFINED - assumed 'UNDEFINED' in %s:%d
+Fatal error: Uncaught Exception: Use of undefined constant UNDEFINED - assumed 'UNDEFINED' (this will throw an Error in a future version of PHP) in %s:%d
Stack trace:
#0 %s(%d): {closure}(%s)
#1 %s(%d): doSomething()
diff --git a/Zend/tests/constants_002.phpt b/Zend/tests/constants_002.phpt
index d590bf4..832da15 100644
--- a/Zend/tests/constants_002.phpt
+++ b/Zend/tests/constants_002.phpt
@@ -13,6 +13,6 @@ var_dump(foo);
--EXPECTF--
Warning: Constants may only evaluate to scalar values or arrays in %s on line %d
-Notice: Use of undefined constant foo - assumed 'foo' in %s on line %d
+Warning: Use of undefined constant foo - assumed 'foo' (this will throw an Error in a future version of PHP) in %s on line %d
string(%d) "foo"
resource(%d) of type (stream)
diff --git a/Zend/tests/constants_005.phpt b/Zend/tests/constants_005.phpt
index d2a205b..b5a3a6b 100644
--- a/Zend/tests/constants_005.phpt
+++ b/Zend/tests/constants_005.phpt
@@ -7,6 +7,6 @@ define("ZEND_THREAD_safe", 123);
var_dump(ZEND_THREAD_safe);
?>
--EXPECTF--
-Notice: Use of undefined constant ZEND_THREAD_safe - assumed 'ZEND_THREAD_safe' in %s on line %d
+Warning: Use of undefined constant ZEND_THREAD_safe - assumed 'ZEND_THREAD_safe' (this will throw an Error in a future version of PHP) in %s on line %d
string(16) "ZEND_THREAD_safe"
int(123)
diff --git a/Zend/tests/ns_041.phpt b/Zend/tests/ns_041.phpt
index 0632fc9..cf5c392 100644
--- a/Zend/tests/ns_041.phpt
+++ b/Zend/tests/ns_041.phpt
@@ -18,5 +18,5 @@ ok
ok
ok
-Notice: Use of undefined constant BAR - assumed 'BAR' in %sns_041.php on line 9
+Warning: Use of undefined constant BAR - assumed 'BAR' (this will throw an Error in a future version of PHP) in %sns_041.php on line 9
BAR
diff --git a/Zend/tests/ns_076.phpt b/Zend/tests/ns_076.phpt
index 1468654..ea97e92 100644
--- a/Zend/tests/ns_076.phpt
+++ b/Zend/tests/ns_076.phpt
@@ -11,11 +11,11 @@ echo "\n";
var_dump($a);
echo \unknown;
--EXPECTF--
-Notice: Use of undefined constant unknown - assumed 'unknown' in %sns_076.php on line %d
+Warning: Use of undefined constant unknown - assumed 'unknown' (this will throw an Error in a future version of PHP) in %sns_076.php on line %d
-Notice: Use of undefined constant unknown - assumed 'unknown' in %sns_076.php on line %d
+Warning: Use of undefined constant unknown - assumed 'unknown' (this will throw an Error in a future version of PHP) in %sns_076.php on line %d
-Notice: Use of undefined constant unknown - assumed 'unknown' in %sns_076.php on line %d
+Warning: Use of undefined constant unknown - assumed 'unknown' (this will throw an Error in a future version of PHP) in %sns_076.php on line %d
unknown
array(1) {
["unknown"]=>
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 07eb7a8..7a36d23 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -611,7 +611,7 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */
actual_len -= (actual - Z_STRVAL_P(p));
}
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
+ zend_error(E_WARNING, "Use of undefined constant %s - assumed '%s' (this will throw an Error in a future version of PHP)", actual, actual);
if (EG(exception)) {
RESET_CONSTANT_VISITED(p);
return FAILURE;
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 99daaf7..48c8139 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -4908,7 +4908,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, UNUSED, CONST, CONST_FETCH)
actual, Z_STRLEN_P(EX_CONSTANT(opline->op2)) - (actual - Z_STRVAL_P(EX_CONSTANT(opline->op2))));
}
/* non-qualified constant - allow text substitution */
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
+ zend_error(E_WARNING, "Use of undefined constant %s - assumed '%s' (this will throw an Error in a future version of PHP)",
Z_STRVAL_P(EX_VAR(opline->result.var)), Z_STRVAL_P(EX_VAR(opline->result.var)));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 63175b0..75d7bd8 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -28065,7 +28065,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CON
actual, Z_STRLEN_P(EX_CONSTANT(opline->op2)) - (actual - Z_STRVAL_P(EX_CONSTANT(opline->op2))));
}
/* non-qualified constant - allow text substitution */
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
+ zend_error(E_WARNING, "Use of undefined constant %s - assumed '%s' (this will throw an Error in a future version of PHP)",
Z_STRVAL_P(EX_VAR(opline->result.var)), Z_STRVAL_P(EX_VAR(opline->result.var)));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
diff --git a/ext/opcache/tests/bug66251.phpt b/ext/opcache/tests/bug66251.phpt
index 23a5165..daa5a89 100644
--- a/ext/opcache/tests/bug66251.phpt
+++ b/ext/opcache/tests/bug66251.phpt
@@ -13,5 +13,5 @@ const A="hello";
function getA() {return A;}
?>
--EXPECTF--
-Notice: Use of undefined constant A - assumed 'A' in %sbug66251.php on line 4
+Warning: Use of undefined constant A - assumed 'A' (this will throw an Error in a future version of PHP) in %sbug66251.php on line 4
A=A
diff --git a/ext/opcache/tests/bug71843.phpt b/ext/opcache/tests/bug71843.phpt
index 73301a6..924fb87 100644
--- a/ext/opcache/tests/bug71843.phpt
+++ b/ext/opcache/tests/bug71843.phpt
@@ -13,13 +13,13 @@ opcache.optimization_level=0xFFFFBFFF
?>
okey
--EXPECTF--
-Notice: Use of undefined constant E - assumed 'E' in %sbug71843.php on line %d
+Warning: Use of undefined constant E - assumed 'E' (this will throw an Error in a future version of PHP) in %sbug71843.php on line %d
Warning: A non-numeric value encountered in %s on line %d
-Notice: Use of undefined constant R - assumed 'R' in %sbug71843.php on line %d
+Warning: Use of undefined constant R - assumed 'R' (this will throw an Error in a future version of PHP) in %sbug71843.php on line %d
Warning: A non-numeric value encountered in %s on line %d
-Notice: Use of undefined constant See - assumed 'See' in %sbug71843.php on line %d
+Warning: Use of undefined constant See - assumed 'See' (this will throw an Error in a future version of PHP) in %sbug71843.php on line %d
okey
diff --git a/ext/standard/tests/array/array_diff_ukey_variation10.phpt b/ext/standard/tests/array/array_diff_ukey_variation10.phpt
index 0d93928..58a040b 100644
--- a/ext/standard/tests/array/array_diff_ukey_variation10.phpt
+++ b/ext/standard/tests/array/array_diff_ukey_variation10.phpt
@@ -33,7 +33,7 @@ NULL
Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
NULL
-Notice: Use of undefined constant unknown_function - assumed 'unknown_function' in %s on line %d
+Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d
Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
NULL
diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt
index 64f58a6..fc7c526 100644
--- a/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt
+++ b/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt
@@ -32,7 +32,7 @@ NULL
Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
NULL
-Notice: Use of undefined constant unknown_function - assumed 'unknown_function' in %s on line %d
+Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d
Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
NULL
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt
index 3d580e1..89286f8 100644
--- a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt
+++ b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt
@@ -32,7 +32,7 @@ NULL
Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
NULL
-Notice: Use of undefined constant unknown_function - assumed 'unknown_function' in %s on line %d
+Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d
Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
NULL
diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt
index 5c75a0b..b903d8b 100644
--- a/ext/standard/tests/array/count_recursive.phpt
+++ b/ext/standard/tests/array/count_recursive.phpt
@@ -239,7 +239,7 @@ NULL
Warning: count() expects at most 2 parameters, 3 given in %s on line %d
NULL
-Notice: Use of undefined constant ABCD - assumed 'ABCD' in %s on line %d
+Warning: Use of undefined constant ABCD - assumed 'ABCD' (this will throw an Error in a future version of PHP) in %s on line %d
Warning: count() expects parameter 2 to be integer, %s given in %s on line %d
NULL
diff --git a/ext/standard/tests/assert/assert_error.phpt b/ext/standard/tests/assert/assert_error.phpt
index bdd47ec..5e2519a 100644
--- a/ext/standard/tests/assert/assert_error.phpt
+++ b/ext/standard/tests/assert/assert_error.phpt
@@ -23,7 +23,7 @@ var_dump($r2=assert($sa));
--EXPECTF--
Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-Notice: Use of undefined constant threemeninaboat - assumed 'threemeninaboat' in %s(9) : assert code on line 1
+Warning: Use of undefined constant threemeninaboat - assumed 'threemeninaboat' (this will throw an Error in a future version of PHP) in %s(9) : assert code on line 1
bool(true)
int(0)
diff --git a/ext/standard/tests/file/fscanf_error.phpt b/ext/standard/tests/file/fscanf_error.phpt
index f93d1b2..1a80d19 100644
--- a/ext/standard/tests/file/fscanf_error.phpt
+++ b/ext/standard/tests/file/fscanf_error.phpt
@@ -78,7 +78,7 @@ int(-1)
Notice: Undefined variable: undefined_var in %s on line %d
-Notice: Use of undefined constant undefined_constant - assumed 'undefined_constant' in %s on line %d
+Warning: Use of undefined constant undefined_constant - assumed 'undefined_constant' (this will throw an Error in a future version of PHP) in %s on line %d
array(0) {
}
array(0) {
diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt
index 5424c50..9451ea8 100644
Binary files a/ext/standard/tests/strings/lcfirst.phpt and b/ext/standard/tests/strings/lcfirst.phpt differ
diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt
index 143c4bd..572d26e 100644
Binary files a/ext/standard/tests/strings/ucfirst.phpt and b/ext/standard/tests/strings/ucfirst.phpt differ
diff --git a/sapi/cli/tests/php_cli_server_014.phpt b/sapi/cli/tests/php_cli_server_014.phpt
index 7c50a5e..f308ffb 100644
--- a/sapi/cli/tests/php_cli_server_014.phpt
+++ b/sapi/cli/tests/php_cli_server_014.phpt
@@ -7,7 +7,7 @@ include "skipif.inc";
--FILE--
<?php
include "php_cli_server.inc";
-php_cli_server_start('echo done, "\n";', null);
+php_cli_server_start('echo "done\n";', null);
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
$port = intval($port)?:80;
diff --git a/tests/classes/constants_basic_001.phpt b/tests/classes/constants_basic_001.phpt
index 9536b2a..3712057 100644
--- a/tests/classes/constants_basic_001.phpt
+++ b/tests/classes/constants_basic_001.phpt
@@ -63,7 +63,7 @@ Notice: Undefined variable: undef in %s on line 5
Attempt to access various kinds of class constants:
-Notice: Use of undefined constant UNDEFINED - assumed 'UNDEFINED' in %s on line %d
+Warning: Use of undefined constant UNDEFINED - assumed 'UNDEFINED' (this will throw an Error in a future version of PHP) in %s on line %d
string(9) "UNDEFINED"
int(1)
float(1.5)
diff --git a/tests/classes/constants_scope_001.phpt b/tests/classes/constants_scope_001.phpt
index c2585b2..650bcc2 100644
--- a/tests/classes/constants_scope_001.phpt
+++ b/tests/classes/constants_scope_001.phpt
@@ -29,7 +29,7 @@ ErrorCodesDerived::print_fatal_error_codes();
?>
--EXPECTF--
-Notice: Use of undefined constant FATAL - assumed 'FATAL' in %sconstants_scope_001.php on line %d
+Warning: Use of undefined constant FATAL - assumed 'FATAL' (this will throw an Error in a future version of PHP) in %sconstants_scope_001.php on line %d
FATAL = FATAL
self::FATAL = Fatal error
self::FATAL = Worst error