summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRowan Collins <rowan.collins@gmail.com>2017-03-04 22:47:19 +0000
committerNikita Popov <nikita.ppv@gmail.com>2017-03-23 18:52:43 +0100
commit1b565f1393f82e0ce0c94806cc7f52c6d9c5e87d (patch)
tree3cd9ea6bfa55549207fb4e4075e1b9d723bf1f8d
parentb5b7691ab5b708e29d9dbb5d46dde33aaf534b89 (diff)
downloadphp-git-1b565f1393f82e0ce0c94806cc7f52c6d9c5e87d.tar.gz
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]
-rw-r--r--NEWS2
-rw-r--r--UPGRADING3
-rw-r--r--Zend/tests/bug37811.phpt2
-rw-r--r--Zend/tests/bug43344_1.phpt8
-rw-r--r--Zend/tests/bug47572.phpt2
-rw-r--r--Zend/tests/bug69755.phpt2
-rw-r--r--Zend/tests/bug69788.phpt2
-rw-r--r--Zend/tests/bug72944.phpt2
-rw-r--r--Zend/tests/bug73163.phpt2
-rw-r--r--Zend/tests/constants_002.phpt2
-rw-r--r--Zend/tests/constants_005.phpt2
-rw-r--r--Zend/tests/ns_041.phpt2
-rw-r--r--Zend/tests/ns_076.phpt6
-rw-r--r--Zend/zend_execute_API.c2
-rw-r--r--Zend/zend_vm_def.h2
-rw-r--r--Zend/zend_vm_execute.h2
-rw-r--r--ext/opcache/tests/bug66251.phpt2
-rw-r--r--ext/opcache/tests/bug71843.phpt6
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation10.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation9.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation8.phpt2
-rw-r--r--ext/standard/tests/array/count_recursive.phpt2
-rw-r--r--ext/standard/tests/assert/assert_error.phpt2
-rw-r--r--ext/standard/tests/file/fscanf_error.phpt2
-rw-r--r--ext/standard/tests/strings/lcfirst.phptbin6908 -> 6963 bytes
-rw-r--r--ext/standard/tests/strings/ucfirst.phptbin6132 -> 6187 bytes
-rw-r--r--sapi/cli/tests/php_cli_server_014.phpt2
-rw-r--r--tests/classes/constants_basic_001.phpt2
-rw-r--r--tests/classes/constants_scope_001.phpt2
29 files changed, 37 insertions, 32 deletions
diff --git a/NEWS b/NEWS
index 5e14ea2892..17837368cb 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 03d8d68186..f6b54d4233 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 f224f9b311..299018363d 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 59129d75cf..4635240699 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 695cc3a7f9..67bb3ec111 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 67c0ed3383..08432808e2 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 63dd42d451..326328ccfa 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 541730a22a..5f494beb40 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 448d7f5959..5c0560458d 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 d590bf44b9..832da1564d 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 d2a205b784..b5a3a6bd38 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 0632fc9815..cf5c3929b5 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 1468654d55..ea97e924b1 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 07eb7a8ef3..7a36d23e20 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 99daaf763a..48c8139da8 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 63175b0d57..75d7bd8dcb 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 23a5165234..daa5a89bb2 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 73301a6e96..924fb873fe 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 0d93928d86..58a040b0a7 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 64f58a6d1e..fc7c526ed1 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 3d580e1e02..89286f8986 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 5c75a0bc68..b903d8b189 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 bdd47ec884..5e2519ab37 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 f93d1b2a57..1a80d19348 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 5424c5018d..9451ea80a3 100644
--- a/ext/standard/tests/strings/lcfirst.phpt
+++ b/ext/standard/tests/strings/lcfirst.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt
index 143c4bd426..572d26ebd1 100644
--- a/ext/standard/tests/strings/ucfirst.phpt
+++ b/ext/standard/tests/strings/ucfirst.phpt
Binary files differ
diff --git a/sapi/cli/tests/php_cli_server_014.phpt b/sapi/cli/tests/php_cli_server_014.phpt
index 7c50a5e30a..f308ffb226 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 9536b2a38f..37120579f6 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 c2585b2212..650bcc2228 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