mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Deprecate defining a free-standing assert() function
Part of https://wiki.php.net/rfc/deprecations_php_7_3.
This commit is contained in:
parent
f4a9da389b
commit
5c4047b339
12
Zend/tests/custom_assert_deprecation.phpt
Normal file
12
Zend/tests/custom_assert_deprecation.phpt
Normal file
@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Defining a free-standing assert() function is deprecated
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
namespace FooBar;
|
||||
|
||||
function assert() {}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: Defining a custom assert() function is deprecated, as the function has special semantics in %s on line %d
|
@ -5981,6 +5981,12 @@ static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_as
|
||||
zend_error(E_DEPRECATED, "__autoload() is deprecated, use spl_autoload_register() instead");
|
||||
}
|
||||
|
||||
if (zend_string_equals_literal_ci(unqualified_name, "assert")) {
|
||||
zend_error(E_DEPRECATED,
|
||||
"Defining a custom assert() function is deprecated, "
|
||||
"as the function has special semantics");
|
||||
}
|
||||
|
||||
key = zend_build_runtime_definition_key(lcname, decl->lex_pos);
|
||||
zend_hash_update_ptr(CG(function_table), key, op_array);
|
||||
zend_register_seen_symbol(lcname, ZEND_SYMBOL_FUNCTION);
|
||||
|
Loading…
Reference in New Issue
Block a user