--- /dev/null
+--TEST--
+Test that there is no arginfo/zpp mismatch
+--FILE--
+<?php
+
+foreach (get_defined_functions()["internal"] as $function) {
+ try {
+ @$function(null, null, null, null, null, null, null, null);
+ } catch (ArgumentCountError|Error) {
+ }
+}
+
+// var_dump() and debug_zval_dump() print all arguments
+?>
+--EXPECT--
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
U_CFUNC PHP_FUNCTION(intlcal_roll)
{
- zend_long field,
- value;
- zval args_a[3] = {0},
- *args = args_a;
- zend_bool bool_variant_val;
+ zval *zvalue;
+ zend_long field, value;
CALENDAR_METHOD_INIT_VARS;
- object = getThis();
-
- if (ZEND_NUM_ARGS() > (object ? 2 :3) ||
- zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set: too many arguments", 0);
- RETURN_FALSE;
- }
- if (!object) {
- args++;
- }
- if (!Z_ISUNDEF(args[1]) && (Z_TYPE(args[1]) == IS_TRUE || Z_TYPE(args[1]) == IS_FALSE)) {
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), object,
- "Olb", &object, Calendar_ce_ptr, &field, &bool_variant_val)
- == FAILURE) {
- RETURN_THROWS();
- }
- /* false corresponds to rolling down, i.e. -1 */
- value = Z_TYPE(args[1]) == IS_TRUE? 1 : -1;
- } else if (zend_parse_method_parameters(ZEND_NUM_ARGS(), object,
- "Oll", &object, Calendar_ce_ptr, &field, &value) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Olz", &object, Calendar_ce_ptr, &field, &zvalue) == FAILURE) {
RETURN_THROWS();
}
+ CALENDAR_METHOD_FETCH_OBJECT;
+
if (field < 0 || field >= UCAL_FIELD_COUNT) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_roll: invalid field", 0);
- RETURN_FALSE;
- }
- if (value < INT32_MIN || value > INT32_MAX) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_roll: value out of bounds", 0);
+ intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_roll: invalid field", 0);
RETURN_FALSE;
}
- CALENDAR_METHOD_FETCH_OBJECT;
+ if (Z_TYPE_P(zvalue) == IS_FALSE || Z_TYPE_P(zvalue) == IS_TRUE) {
+ value = Z_TYPE_P(zvalue) == IS_TRUE ? 1 : -1;
+ } else {
+ value = zval_get_long(zvalue);
+
+ if (value < INT32_MIN || value > INT32_MAX) {
+ intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_roll: value out of bounds", 0);
+ RETURN_FALSE;
+ }
+ }
co->ucal->roll((UCalendarDateFields)field, (int32_t)value, CALENDAR_ERROR_CODE(co));
+
INTL_METHOD_CHECK_STATUS(co, "intlcal_roll: Error calling ICU Calendar::roll");
RETURN_TRUE;
--- /dev/null
+--TEST--
+Test that return types in zend_func_info.c match return types in stubs
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$contents = "<?php\n";
+
+$contents .= "function test() {\n";
+foreach (get_defined_functions()["internal"] as $function) {
+ $contents .= " {$function}();\n";
+}
+$contents .= "}\n";
+
+file_put_contents("func_info_generated.php", $contents);
+
+require_once("func_info_generated.php");
+
+?>
+--CLEAN--
+<?php
+
+unlink("func_info_generated.php");
+
+?>
+--EXPECT--
}
/* }}} */
-/* {{{ proto bool session_set_save_handler(string open, string close, string read, string write, string destroy, string gc, string create_sid)
- Sets user-level functions */
-PHP_FUNCTION(session_set_save_handler)
-{
- zval *args = NULL;
- int i, num_args, argc = ZEND_NUM_ARGS();
- zend_string *ini_name, *ini_val;
-
+static int save_handler_check_session() {
if (PS(session_status) == php_session_active) {
php_error_docref(NULL, E_WARNING, "Cannot change save handler when session is active");
- RETURN_FALSE;
+ return FAILURE;
}
if (SG(headers_sent)) {
php_error_docref(NULL, E_WARNING, "Cannot change save handler when headers already sent");
- RETURN_FALSE;
+ return FAILURE;
}
+ return SUCCESS;
+}
+
+/* {{{ proto bool session_set_save_handler(string open, string close, string read, string write, string destroy, string gc, string create_sid)
+ Sets user-level functions */
+PHP_FUNCTION(session_set_save_handler)
+{
+ zval *args = NULL;
+ int i, num_args, argc = ZEND_NUM_ARGS();
+ zend_string *ini_name, *ini_val;
+
if (argc > 0 && argc <= 2) {
zval *obj = NULL;
zend_string *func_name;
RETURN_THROWS();
}
+ if (save_handler_check_session() == FAILURE) {
+ RETURN_FALSE;
+ }
+
/* For compatibility reason, implemented interface is not checked */
/* Find implemented methods - SessionHandlerInterface */
i = 0;
RETURN_THROWS();
}
+ if (save_handler_check_session() == FAILURE) {
+ RETURN_FALSE;
+ }
+
/* remove shutdown function */
remove_user_shutdown_function("session_shutdown", sizeof("session_shutdown") - 1);
char *path;
size_t path_len;
- if (!SG(rfc1867_uploaded_files)) {
- RETURN_FALSE;
- }
-
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_PATH(path, path_len)
ZEND_PARSE_PARAMETERS_END();
+ if (!SG(rfc1867_uploaded_files)) {
+ RETURN_FALSE;
+ }
+
if (zend_hash_str_exists(SG(rfc1867_uploaded_files), path, path_len)) {
RETURN_TRUE;
} else {
int oldmask; int ret;
#endif
- if (!SG(rfc1867_uploaded_files)) {
- RETURN_FALSE;
- }
-
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STRING(path, path_len)
Z_PARAM_PATH(new_path, new_path_len)
ZEND_PARSE_PARAMETERS_END();
+ if (!SG(rfc1867_uploaded_files)) {
+ RETURN_FALSE;
+ }
+
if (!zend_hash_str_exists(SG(rfc1867_uploaded_files), path, path_len)) {
RETURN_FALSE;
}
function parse_ini_string(string $ini_string, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array|false {}
#if ZEND_DEBUG
-function config_get_hash(string $ini_string, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array {}
+function config_get_hash(): array {}
#endif
#ifdef HAVE_GETLOADAVG
ZEND_END_ARG_INFO()
#if ZEND_DEBUG
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_config_get_hash, 0, 1, IS_ARRAY, 0)
- ZEND_ARG_TYPE_INFO(0, ini_string, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, process_sections, _IS_BOOL, 0, "false")
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, scanner_mode, IS_LONG, 0, "INI_SCANNER_NORMAL")
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_config_get_hash, 0, 0, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
#endif