summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorGeorge Peter Banyard <girgias@php.net>2020-03-30 00:40:18 +0200
committerGeorge Peter Banyard <girgias@php.net>2020-03-31 16:32:58 +0200
commit55a3e5b99e35a99fe5916a761df87ea269d0b959 (patch)
tree9f2bf1ccfffbeeee138f551024340509ca3c4392 /Zend
parent9ec7265291c2a005e4d3b59ca8ac27623f6e4f02 (diff)
downloadphp-git-55a3e5b99e35a99fe5916a761df87ea269d0b959.tar.gz
Promote some warnings to Errors in Zend basic functions
Closes GH-5325
Diffstat (limited to 'Zend')
-rw-r--r--Zend/tests/002.phpt120
-rw-r--r--Zend/tests/003.phpt13
-rw-r--r--Zend/tests/004.phpt14
-rw-r--r--Zend/tests/006.phpt14
-rw-r--r--Zend/tests/011.phpt47
-rw-r--r--Zend/tests/015.phpt24
-rw-r--r--Zend/tests/020.phpt23
-rw-r--r--Zend/tests/exception_handler_004.phpt21
-rw-r--r--Zend/tests/func_get_args.phpt12
-rw-r--r--Zend/zend_builtin_functions.c71
-rw-r--r--Zend/zend_builtin_functions.stub.php14
-rw-r--r--Zend/zend_builtin_functions_arginfo.h32
12 files changed, 235 insertions, 170 deletions
diff --git a/Zend/tests/002.phpt b/Zend/tests/002.phpt
index 1311e3b570..80057bfa53 100644
--- a/Zend/tests/002.phpt
+++ b/Zend/tests/002.phpt
@@ -4,20 +4,53 @@ func_get_arg() tests
<?php
function test1() {
- var_dump(func_get_arg(-10));
- var_dump(func_get_arg(0));
- var_dump(func_get_arg(1));
+ try {
+ var_dump(func_get_arg(-10));
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+
+ try {
+ var_dump(func_get_arg(0));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ try {
+ var_dump(func_get_arg(1));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
function test2($a) {
- var_dump(func_get_arg(0));
- var_dump(func_get_arg(1));
+ try {
+ var_dump(func_get_arg(0));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ try {
+ var_dump(func_get_arg(1));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
function test3($a, $b) {
- var_dump(func_get_arg(0));
- var_dump(func_get_arg(1));
- var_dump(func_get_arg(2));
+ try {
+ var_dump(func_get_arg(0));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ try {
+ var_dump(func_get_arg(1));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ try {
+ var_dump(func_get_arg(2));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
test1();
@@ -40,62 +73,49 @@ call_user_func("test3", 1, 2);
class test {
static function test1($a) {
- var_dump(func_get_arg(0));
- var_dump(func_get_arg(1));
+ try {
+ var_dump(func_get_arg(0));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ try {
+ var_dump(func_get_arg(1));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
}
test::test1(1);
-var_dump(func_get_arg(1));
+try {
+ var_dump(func_get_arg(1));
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "Done\n";
?>
--EXPECTF--
-Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
-bool(false)
-
-Warning: func_get_arg(): Argument 0 not passed to function in %s on line %d
-bool(false)
-
-Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
-bool(false)
-
-Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
-bool(false)
+func_get_arg(): Argument #1 ($arg_num) must be greater than or equal to 0
+func_get_arg(): Argument 0 not passed to function
+func_get_arg(): Argument 1 not passed to function
+func_get_arg(): Argument #1 ($arg_num) must be greater than or equal to 0
int(10)
-
-Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
-bool(false)
+func_get_arg(): Argument 1 not passed to function
int(1)
-
-Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
-bool(false)
+func_get_arg(): Argument 1 not passed to function
Exception: Too few arguments to function test2(), 0 passed in %s002.php on line %d and exactly 1 expected
int(1)
int(2)
-
-Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d
-bool(false)
-
-Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
-bool(false)
-
-Warning: func_get_arg(): Argument 0 not passed to function in %s on line %d
-bool(false)
-
-Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
-bool(false)
-Exception: Too few arguments to function test3(), 1 passed in %s002.php on line %d and exactly 2 expected
+func_get_arg(): Argument 2 not passed to function
+func_get_arg(): Argument #1 ($arg_num) must be greater than or equal to 0
+func_get_arg(): Argument 0 not passed to function
+func_get_arg(): Argument 1 not passed to function
+Exception: Too few arguments to function test3(), 1 passed in %s on line %d and exactly 2 expected
int(1)
int(2)
-
-Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d
-bool(false)
+func_get_arg(): Argument 2 not passed to function
int(1)
-
-Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
-bool(false)
-
-Warning: func_get_arg(): Called from the global scope - no function context in %s on line %d
-bool(false)
+func_get_arg(): Argument 1 not passed to function
+func_get_arg() cannot be called from the global scope
Done
diff --git a/Zend/tests/003.phpt b/Zend/tests/003.phpt
index 6680956f7e..3931628e9a 100644
--- a/Zend/tests/003.phpt
+++ b/Zend/tests/003.phpt
@@ -40,9 +40,13 @@ class test {
}
test::test1(1);
-var_dump(func_get_args());
-echo "Done\n";
+try {
+ var_dump(func_get_args());
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
?>
--EXPECTF--
array(0) {
@@ -75,7 +79,4 @@ array(1) {
[0]=>
int(1)
}
-
-Warning: func_get_args(): Called from the global scope - no function context in %s on line %d
-bool(false)
-Done
+func_get_args() cannot be called from the global scope
diff --git a/Zend/tests/004.phpt b/Zend/tests/004.phpt
index 2f733f1bd8..b5b476cc1b 100644
--- a/Zend/tests/004.phpt
+++ b/Zend/tests/004.phpt
@@ -4,19 +4,19 @@ strncmp() tests
<?php
var_dump(strncmp("", "", 100));
-var_dump(strncmp("aef", "dfsgbdf", -1));
+try {
+ var_dump(strncmp("aef", "dfsgbdf", -1));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump(strncmp("fghjkl", "qwer", 0));
var_dump(strncmp("qwerty", "qwerty123", 6));
var_dump(strncmp("qwerty", "qwerty123", 7));
-echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
int(0)
-
-Warning: Length must be greater than or equal to 0 in %s on line %d
-bool(false)
+strncmp(): Argument #3 ($len) must be greater than or equal to 0
int(0)
int(0)
int(-1)
-Done
diff --git a/Zend/tests/006.phpt b/Zend/tests/006.phpt
index 12907fd36e..3377e933ce 100644
--- a/Zend/tests/006.phpt
+++ b/Zend/tests/006.phpt
@@ -3,7 +3,12 @@ strncasecmp() tests
--FILE--
<?php
-var_dump(strncasecmp("", "", -1));
+try {
+ var_dump(strncasecmp("", "", -1));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
var_dump(strncasecmp("aef", "dfsgbdf", 0));
var_dump(strncasecmp("aef", "dfsgbdf", 10));
var_dump(strncasecmp("qwe", "qwer", 3));
@@ -12,11 +17,9 @@ var_dump(strncasecmp("qwErtY", "qwer", 7));
var_dump(strncasecmp("q123", "Q123", 3));
var_dump(strncasecmp("01", "01", 1000));
-echo "Done\n";
?>
---EXPECTF--
-Warning: Length must be greater than or equal to 0 in %s on line %d
-bool(false)
+--EXPECT--
+strncasecmp(): Argument #3 ($len) must be greater than or equal to 0
int(0)
int(-3)
int(0)
@@ -24,4 +27,3 @@ int(0)
int(2)
int(0)
int(0)
-Done
diff --git a/Zend/tests/011.phpt b/Zend/tests/011.phpt
index 36213af171..0a7e3fd90a 100644
--- a/Zend/tests/011.phpt
+++ b/Zend/tests/011.phpt
@@ -39,18 +39,40 @@ var_dump(property_exists($foo,"pp2"));
var_dump(property_exists($foo,"pp3"));
var_dump(property_exists($foo,"nonexistent"));
var_dump(property_exists($foo,""));
-var_dump(property_exists(array(),"test"));
-var_dump(property_exists(1,"test"));
-var_dump(property_exists(true,"test"));
+
+try {
+ var_dump(property_exists(array(), "test"));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(property_exists(1, "test"));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(property_exists(3.14, "test"));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(property_exists(true, "test"));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(property_exists(null, "test"));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$foo->bar();
$bar = new bar;
$bar->test();
-echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
bool(true)
bool(true)
bool(true)
@@ -64,19 +86,14 @@ bool(true)
bool(true)
bool(false)
bool(false)
-
-Warning: First parameter must either be an object or the name of an existing class in %s on line %d
-NULL
-
-Warning: First parameter must either be an object or the name of an existing class in %s on line %d
-NULL
-
-Warning: First parameter must either be an object or the name of an existing class in %s on line %d
-NULL
+property_exists(): Argument #1 ($object_or_class) must be of type object|string, array given
+property_exists(): Argument #1 ($object_or_class) must be of type object|string, int given
+property_exists(): Argument #1 ($object_or_class) must be of type object|string, float given
+property_exists(): Argument #1 ($object_or_class) must be of type object|string, bool given
+property_exists(): Argument #1 ($object_or_class) must be of type object|string, null given
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
-Done
diff --git a/Zend/tests/015.phpt b/Zend/tests/015.phpt
index deea89d14d..8c4dd62d39 100644
--- a/Zend/tests/015.phpt
+++ b/Zend/tests/015.phpt
@@ -4,26 +4,30 @@ trigger_error() tests
<?php
var_dump(trigger_error("error"));
-var_dump(trigger_error("error", -1));
-var_dump(trigger_error("error", 0));
+
+try {
+ var_dump(trigger_error("error", -1));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(trigger_error("error", 0));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
var_dump(trigger_error("error", E_USER_WARNING));
var_dump(trigger_error("error", E_USER_DEPRECATED));
-echo "Done\n";
?>
--EXPECTF--
Notice: error in %s on line %d
bool(true)
-
-Warning: Invalid error type specified in %s on line %d
-bool(false)
-
-Warning: Invalid error type specified in %s on line %d
-bool(false)
+trigger_error(): Argument #2 ($error_type) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED
+trigger_error(): Argument #2 ($error_type) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED
Warning: error in %s on line %d
bool(true)
Deprecated: error in %s on line %d
bool(true)
-Done
diff --git a/Zend/tests/020.phpt b/Zend/tests/020.phpt
index dc7a34be06..9e36037d88 100644
--- a/Zend/tests/020.phpt
+++ b/Zend/tests/020.phpt
@@ -3,7 +3,11 @@ func_get_arg() invalid usage
--FILE--
<?php
-var_dump(func_get_arg(1));
+try {
+ var_dump(func_get_arg(1));
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
function bar() {
var_dump(func_get_arg(1));
@@ -13,14 +17,13 @@ function foo() {
bar(func_get_arg(1));
}
-foo(1,2);
+try {
+ foo(1,2);
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
-echo "Done\n";
?>
---EXPECTF--
-Warning: func_get_arg(): Called from the global scope - no function context in %s on line %d
-bool(false)
-
-Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
-bool(false)
-Done
+--EXPECT--
+func_get_arg() cannot be called from the global scope
+func_get_arg(): Argument 1 not passed to function
diff --git a/Zend/tests/exception_handler_004.phpt b/Zend/tests/exception_handler_004.phpt
index 757a1b7f2d..f07970d337 100644
--- a/Zend/tests/exception_handler_004.phpt
+++ b/Zend/tests/exception_handler_004.phpt
@@ -3,13 +3,18 @@ exception handler tests - 4
--FILE--
<?php
-set_exception_handler("fo");
-set_exception_handler(array("", ""));
+try {
+ set_exception_handler("fo");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ set_exception_handler(array("", ""));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
-echo "Done\n";
?>
---EXPECTF--
-Warning: set_exception_handler(): Argument #1 ($exception_handler) must be a valid callback in %s on line %d
-
-Warning: set_exception_handler(): Argument #1 ($exception_handler) must be a valid callback in %s on line %d
-Done
+--EXPECT--
+set_exception_handler(): Argument #1 ($exception_handler) must be a valid callback
+set_exception_handler(): Argument #1 ($exception_handler) must be a valid callback
diff --git a/Zend/tests/func_get_args.phpt b/Zend/tests/func_get_args.phpt
index eea8ae4354..33cfdb02eb 100644
--- a/Zend/tests/func_get_args.phpt
+++ b/Zend/tests/func_get_args.phpt
@@ -1,10 +1,14 @@
--TEST--
-Testing func_get_args()
+Testing func_get_args() throws error when called from the global scope
--FILE--
<?php
-func_get_args();
+try {
+ func_get_args();
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
?>
---EXPECTF--
-Warning: func_get_args(): Called from the global scope - no function context in %s on line 3
+--EXPECT--
+func_get_args() cannot be called from the global scope
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index f00996619a..3b0e05c212 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -97,8 +97,8 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */
ZEND_FE(strlen, arginfo_strlen)
ZEND_FE(strcmp, arginfo_strcmp)
ZEND_FE(strncmp, arginfo_strncmp)
- ZEND_FE(strcasecmp, arginfo_strcmp)
- ZEND_FE(strncasecmp, arginfo_strncmp)
+ ZEND_FE(strcasecmp, arginfo_strcasecmp)
+ ZEND_FE(strncasecmp, arginfo_strncasecmp)
ZEND_FE(error_reporting, arginfo_error_reporting)
ZEND_FE(define, arginfo_define)
ZEND_FE(defined, arginfo_defined)
@@ -310,25 +310,25 @@ ZEND_FUNCTION(func_get_arg)
}
if (requested_offset < 0) {
- zend_error(E_WARNING, "func_get_arg(): The argument number should be >= 0");
- RETURN_FALSE;
+ zend_argument_value_error(1, "must be greater than or equal to 0");
+ RETURN_THROWS();
}
ex = EX(prev_execute_data);
if (ZEND_CALL_INFO(ex) & ZEND_CALL_CODE) {
- zend_error(E_WARNING, "func_get_arg(): Called from the global scope - no function context");
- RETURN_FALSE;
+ zend_throw_error(NULL, "func_get_arg() cannot be called from the global scope");
+ RETURN_THROWS();
}
if (zend_forbid_dynamic_call("func_get_arg()") == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
arg_count = ZEND_CALL_NUM_ARGS(ex);
if ((zend_ulong)requested_offset >= arg_count) {
- zend_error(E_WARNING, "func_get_arg(): Argument " ZEND_LONG_FMT " not passed to function", requested_offset);
- RETURN_FALSE;
+ zend_throw_error(NULL, "func_get_arg(): Argument " ZEND_LONG_FMT " not passed to function", requested_offset);
+ RETURN_THROWS();
}
first_extra_arg = ex->func->op_array.num_args;
@@ -353,12 +353,12 @@ ZEND_FUNCTION(func_get_args)
zend_execute_data *ex = EX(prev_execute_data);
if (ZEND_CALL_INFO(ex) & ZEND_CALL_CODE) {
- zend_error(E_WARNING, "func_get_args(): Called from the global scope - no function context");
- RETURN_FALSE;
+ zend_throw_error(NULL, "func_get_args() cannot be called from the global scope");
+ RETURN_THROWS();
}
if (zend_forbid_dynamic_call("func_get_args()") == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
arg_count = ZEND_CALL_NUM_ARGS(ex);
@@ -455,8 +455,8 @@ ZEND_FUNCTION(strncmp)
ZEND_PARSE_PARAMETERS_END();
if (len < 0) {
- zend_error(E_WARNING, "Length must be greater than or equal to 0");
- RETURN_FALSE;
+ zend_argument_value_error(3, "must be greater than or equal to 0");
+ RETURN_THROWS();
}
RETURN_LONG(zend_binary_strncmp(ZSTR_VAL(s1), ZSTR_LEN(s1), ZSTR_VAL(s2), ZSTR_LEN(s2), len));
@@ -492,8 +492,8 @@ ZEND_FUNCTION(strncasecmp)
ZEND_PARSE_PARAMETERS_END();
if (len < 0) {
- zend_error(E_WARNING, "Length must be greater than or equal to 0");
- RETURN_FALSE;
+ zend_argument_value_error(3, "must be greater than or equal to 0");
+ RETURN_THROWS();
}
RETURN_LONG(zend_binary_strncasecmp(ZSTR_VAL(s1), ZSTR_LEN(s1), ZSTR_VAL(s2), ZSTR_LEN(s2), len));
@@ -725,8 +725,8 @@ ZEND_FUNCTION(get_class)
if (scope) {
RETURN_STR_COPY(scope->name);
} else {
- zend_error(E_WARNING, "get_class() called without object from outside a class");
- RETURN_FALSE;
+ zend_throw_error(NULL, "get_class() without arguments must be called from within a class");
+ RETURN_THROWS();
}
}
@@ -743,15 +743,12 @@ ZEND_FUNCTION(get_called_class)
ZEND_PARSE_PARAMETERS_NONE();
called_scope = zend_get_called_scope(execute_data);
- if (called_scope) {
- RETURN_STR_COPY(called_scope->name);
- } else {
- zend_class_entry *scope = zend_get_executed_scope();
- if (!scope) {
- zend_error(E_WARNING, "get_called_class() called from outside a class");
- }
+ if (!called_scope) {
+ zend_throw_error(NULL, "get_called_class() must be called from within a class");
+ RETURN_THROWS();
}
- RETURN_FALSE;
+
+ RETURN_STR_COPY(called_scope->name);
}
/* }}} */
@@ -1166,8 +1163,8 @@ ZEND_FUNCTION(property_exists)
} else if (Z_TYPE_P(object) == IS_OBJECT) {
ce = Z_OBJCE_P(object);
} else {
- zend_error(E_WARNING, "First parameter must either be an object or the name of an existing class");
- RETURN_NULL();
+ zend_argument_type_error(1, "must be of type object|string, %s given", zend_zval_type_name(object));
+ RETURN_THROWS();
}
property_info = zend_hash_find_ptr(&ce->properties_info, property);
@@ -1348,12 +1345,14 @@ ZEND_FUNCTION(trigger_error)
case E_USER_DEPRECATED:
break;
default:
- zend_error(E_WARNING, "Invalid error type specified");
- RETURN_FALSE;
+ zend_argument_value_error(2, "must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE,"
+ " or E_USER_DEPRECATED");
+ RETURN_THROWS();
break;
}
zend_error((int)error_type, "%s", message);
+ // TODO Change to void
RETURN_TRUE;
}
/* }}} */
@@ -1372,9 +1371,9 @@ ZEND_FUNCTION(set_error_handler)
if (Z_TYPE_P(error_handler) != IS_NULL) { /* NULL == unset */
if (!zend_is_callable(error_handler, 0, NULL)) {
zend_string *error_handler_name = zend_get_callable_name(error_handler);
- zend_error(E_WARNING, "%s(): Argument #1 ($error_handler) must be a valid callback", get_active_function_name());
+ zend_argument_type_error(1, "must be a valid callback");
zend_string_release_ex(error_handler_name, 0);
- return;
+ RETURN_THROWS();
}
}
@@ -1419,6 +1418,8 @@ ZEND_FUNCTION(restore_error_handler)
ZVAL_COPY_VALUE(&EG(user_error_handler), tmp);
zend_stack_del_top(&EG(user_error_handlers));
}
+
+ // TODO Change to void
RETURN_TRUE;
}
/* }}} */
@@ -1436,9 +1437,9 @@ ZEND_FUNCTION(set_exception_handler)
if (Z_TYPE_P(exception_handler) != IS_NULL) { /* NULL == unset */
if (!zend_is_callable(exception_handler, 0, NULL)) {
zend_string *exception_handler_name = zend_get_callable_name(exception_handler);
- zend_error(E_WARNING, "%s(): Argument #1 ($exception_handler) must be a valid callback", get_active_function_name());
+ zend_argument_type_error(1, "must be a valid callback");
zend_string_release_ex(exception_handler_name, 0);
- return;
+ RETURN_THROWS();
}
}
@@ -1473,6 +1474,8 @@ ZEND_FUNCTION(restore_exception_handler)
ZVAL_COPY_VALUE(&EG(user_exception_handler), tmp);
zend_stack_del_top(&EG(user_exception_handlers));
}
+
+ // TODO Change to void
RETURN_TRUE;
}
/* }}} */
diff --git a/Zend/zend_builtin_functions.stub.php b/Zend/zend_builtin_functions.stub.php
index 47f0869869..6f2f9f25f3 100644
--- a/Zend/zend_builtin_functions.stub.php
+++ b/Zend/zend_builtin_functions.stub.php
@@ -7,13 +7,17 @@ function func_num_args(): int {}
/** @return mixed */
function func_get_arg(int $arg_num) {}
-function func_get_args(): array|false {}
+function func_get_args(): array {}
function strlen(string $str): int {}
function strcmp(string $str1, string $str2): int {}
-function strncmp(string $str1, string $str2, int $len): int|false {}
+function strncmp(string $str1, string $str2, int $len): int {}
+
+function strcasecmp(string $str1, string $str2): int {}
+
+function strncasecmp(string $str1, string $str2, int $len): int {}
function error_reporting($new_error_level = UNKNOWN): int {}
@@ -21,9 +25,9 @@ function define(string $constant_name, $value, bool $case_insensitive = false):
function defined(string $constant_name): bool {}
-function get_class(object $object = UNKNOWN): string|false {}
+function get_class(object $object = UNKNOWN): string {}
-function get_called_class(): string|false {}
+function get_called_class(): string {}
function get_parent_class($object = UNKNOWN): string|false {}
@@ -41,7 +45,7 @@ function get_class_methods($class): ?array {}
function method_exists($object_or_class, string $method): bool {}
-function property_exists($object_or_class, string $property_name): ?bool {}
+function property_exists($object_or_class, string $property_name): bool {}
function class_exists(string $classname, bool $autoload = true): bool {}
diff --git a/Zend/zend_builtin_functions_arginfo.h b/Zend/zend_builtin_functions_arginfo.h
index 3b1df2ab49..1dd9b6f712 100644
--- a/Zend/zend_builtin_functions_arginfo.h
+++ b/Zend/zend_builtin_functions_arginfo.h
@@ -10,7 +10,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_func_get_arg, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, arg_num, IS_LONG, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_func_get_args, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_func_get_args, 0, 0, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strlen, 0, 1, IS_LONG, 0)
@@ -22,13 +22,17 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strcmp, 0, 2, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, str2, IS_STRING, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strncmp, 0, 3, MAY_BE_LONG|MAY_BE_FALSE)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strncmp, 0, 3, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, str1, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, str2, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_error_reporting, 0, 0, IS_LONG, 0)
+#define arginfo_strcasecmp arginfo_strcmp
+
+#define arginfo_strncasecmp arginfo_strncmp
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_error_reporting, 0, 0, IS_LONG, 1)
ZEND_ARG_INFO(0, new_error_level)
ZEND_END_ARG_INFO()
@@ -42,12 +46,11 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_defined, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, constant_name, IS_STRING, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_class, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_class, 0, 0, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_called_class, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
-ZEND_END_ARG_INFO()
+#define arginfo_get_called_class arginfo_zend_version
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_parent_class, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_INFO(0, object)
@@ -80,7 +83,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_method_exists, 0, 2, _IS_BOOL, 0
ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_property_exists, 0, 2, _IS_BOOL, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_property_exists, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, object_or_class)
ZEND_ARG_TYPE_INFO(0, property_name, IS_STRING, 0)
ZEND_END_ARG_INFO()
@@ -107,10 +110,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_alias, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, autoload, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_included_files, 0, 0, IS_ARRAY, 0)
-ZEND_END_ARG_INFO()
+#define arginfo_get_included_files arginfo_func_get_args
-#define arginfo_get_required_files arginfo_get_included_files
+#define arginfo_get_required_files arginfo_func_get_args
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_trigger_error, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
@@ -133,17 +135,17 @@ ZEND_END_ARG_INFO()
#define arginfo_restore_exception_handler arginfo_restore_error_handler
-#define arginfo_get_declared_classes arginfo_get_included_files
+#define arginfo_get_declared_classes arginfo_func_get_args
-#define arginfo_get_declared_traits arginfo_get_included_files
+#define arginfo_get_declared_traits arginfo_func_get_args
-#define arginfo_get_declared_interfaces arginfo_get_included_files
+#define arginfo_get_declared_interfaces arginfo_func_get_args
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_defined_functions, 0, 0, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, exclude_disabled, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
-#define arginfo_get_defined_vars arginfo_get_included_files
+#define arginfo_get_defined_vars arginfo_func_get_args
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_resource_type, 0, 1, IS_STRING, 0)
ZEND_ARG_INFO(0, res)
@@ -195,4 +197,4 @@ ZEND_END_ARG_INFO()
#define arginfo_gc_disable arginfo_gc_enable
-#define arginfo_gc_status arginfo_get_included_files
+#define arginfo_gc_status arginfo_func_get_args