diff --git a/ext/dom/php_dom.stub.php b/ext/dom/php_dom.stub.php index 3f62210ef6288..8ed6723250bf8 100644 --- a/ext/dom/php_dom.stub.php +++ b/ext/dom/php_dom.stub.php @@ -18,10 +18,10 @@ public function __construct(string $data = "") {} interface DOMParentNode { - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function append(...$nodes): void; - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function prepend(...$nodes): void; } @@ -29,13 +29,13 @@ interface DOMChildNode { public function remove(): void; - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function before(... $nodes): void; - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function after(...$nodes): void; - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function replaceWith(...$nodes): void; } @@ -116,10 +116,10 @@ public function __construct() {} /** @return bool */ public function appendXML(string $data) {} - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function append(...$nodes): void {} - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function prepend(...$nodes): void {} } @@ -151,15 +151,15 @@ public function deleteData(int $offset, int $count) {} /** @return bool */ public function replaceData(int $offset, int $count, string $data) {} - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function replaceWith(...$nodes): void {} public function remove(): void {} - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function before(... $nodes): void {} - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function after(...$nodes): void {} } @@ -231,19 +231,19 @@ public function setIdAttributeNode(DOMAttr $attr, bool $isId) {} public function remove(): void {} - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function before(... $nodes): void {} - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function after(...$nodes): void {} - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function replaceWith(...$nodes): void {} - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function append(...$nodes): void {} - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function prepend(...$nodes): void {} } @@ -348,10 +348,10 @@ public function xinclude(int $options = 0) {} /** @return DOMNode|false */ public function adoptNode(DOMNode $node) {} - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function append(...$nodes): void {} - /** @var ...DOMNode|string $nodes */ + /** @param DOMNode|string $nodes */ public function prepend(...$nodes): void {} } diff --git a/ext/dom/php_dom_arginfo.h b/ext/dom/php_dom_arginfo.h index dd50690f59655..7da82ba710fc1 100644 --- a/ext/dom/php_dom_arginfo.h +++ b/ext/dom/php_dom_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 3ecc7d640235675f1f573f043e68f11a4fca0bad */ + * Stub hash: 6d25769eb3f8686042dccc55d8d8bd5e3852676f */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_dom_import_simplexml, 0, 1, DOMElement, 1) ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0) diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index 0be6ba4d4c9be..4a304fea83ec3 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -3747,7 +3747,7 @@ ZEND_METHOD(FFI, free) /* {{{ */ ZEND_METHOD(FFI, cast) /* {{{ */ { zend_string *type_def = NULL; - zval *ztype = NULL; + zend_object *ztype = NULL; zend_ffi_type *old_type, *type, *type_ptr; zend_ffi_cdata *old_cdata, *cdata; zend_bool is_const = 0; @@ -3756,12 +3756,8 @@ ZEND_METHOD(FFI, cast) /* {{{ */ ZEND_FFI_VALIDATE_API_RESTRICTION(); ZEND_PARSE_PARAMETERS_START(2, 2) - if (Z_TYPE_P(EX_VAR_NUM(0)) == IS_STRING) { - Z_PARAM_STR(type_def) - } else { - Z_PARAM_OBJECT_OF_CLASS(ztype, zend_ffi_ctype_ce) - } - Z_PARAM_ZVAL(zv); + Z_PARAM_STR_OR_OBJ_OF_CLASS(type_def, ztype, zend_ffi_ctype_ce) + Z_PARAM_ZVAL(zv) ZEND_PARSE_PARAMETERS_END(); arg = zv; @@ -3818,7 +3814,7 @@ ZEND_METHOD(FFI, cast) /* {{{ */ type_ptr = dcl.type; } else { - zend_ffi_ctype *ctype = (zend_ffi_ctype*)Z_OBJ_P(ztype); + zend_ffi_ctype *ctype = (zend_ffi_ctype*) ztype; type_ptr = type = ctype->type; if (ZEND_FFI_TYPE_IS_OWNED(type)) { diff --git a/ext/ffi/ffi.stub.php b/ext/ffi/ffi.stub.php index 14b168a6a80d9..df2ffc53f1b42 100644 --- a/ext/ffi/ffi.stub.php +++ b/ext/ffi/ffi.stub.php @@ -17,10 +17,10 @@ public static function new($type, bool $owned = true, bool $persistent = false): public static function free(FFI\CData $ptr): void {} /** - * @param FFI\CType|string $type + * @param FFI\CData|string|int|null $ptr * @prefer-ref $ptr */ - public static function cast($type, $ptr): ?FFI\CData {} + public static function cast(FFI\CType|string $type, $ptr): ?FFI\CData {} public static function type(string $type): ?FFI\CType {} @@ -39,9 +39,9 @@ public static function sizeof(object $ptr): ?int {} public static function alignof(object $ptr): ?int {} /** + * @param FFI\CData|string $src * @prefer-ref $dst * @prefer-ref $src - * @param string|FFI\CData $dst */ public static function memcpy(FFI\CData $dst, $src, int $size): void {} diff --git a/ext/ffi/ffi_arginfo.h b/ext/ffi/ffi_arginfo.h index 7a14a6e12a0a1..7b1f809233a9c 100644 --- a/ext/ffi/ffi_arginfo.h +++ b/ext/ffi/ffi_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: e66d306e0dbe08ec3d66935c69ab9e36b9b8165a */ + * Stub hash: a486305cd865e2798f7d9916760a3ec3c6f114b0 */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_cdef, 0, 0, FFI, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, code, IS_STRING, 0, "\"\"") @@ -25,7 +25,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_free, 0, 1, IS_VOID, 0 ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_cast, 0, 2, FFI\\CData, 1) - ZEND_ARG_INFO(0, type) + ZEND_ARG_OBJ_TYPE_MASK(0, type, FFI\\CType, MAY_BE_STRING, NULL) ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr) ZEND_END_ARG_INFO() diff --git a/ext/gd/gd.stub.php b/ext/gd/gd.stub.php index deef81f7f94e5..7b2e754bad87c 100644 --- a/ext/gd/gd.stub.php +++ b/ext/gd/gd.stub.php @@ -224,7 +224,8 @@ function imagettfbbox(float $size, float $angle, string $font_file, string $text function imagettftext(GdImage $im, float $size, float $angle, int $x, int $y, int $col, string $font_file, string $text): array|false {} #endif -function imagefilter(GdImage $im, int $filtertype, $arg1 = UNKNOWN, $arg2 = UNKNOWN, $arg3 = UNKNOWN, $arg4 = UNKNOWN): bool {} +/** @param array|int|float|bool $filter_args */ +function imagefilter(GdImage $im, int $filtertype, ...$filter_args): bool {} function imageconvolution(GdImage $im, array $matrix3x3, float $div, float $offset): bool {} diff --git a/ext/gd/gd_arginfo.h b/ext/gd/gd_arginfo.h index c489fc0c3cf4e..ca9ee8942619b 100644 --- a/ext/gd/gd_arginfo.h +++ b/ext/gd/gd_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: a792b0c5497013c85cca83c4baab928a5191f3b9 */ + * Stub hash: 540beb37f18b81102e7977447399757e865285c2 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gd_info, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() @@ -502,10 +502,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilter, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, im, GdImage, 0) ZEND_ARG_TYPE_INFO(0, filtertype, IS_LONG, 0) - ZEND_ARG_INFO(0, arg1) - ZEND_ARG_INFO(0, arg2) - ZEND_ARG_INFO(0, arg3) - ZEND_ARG_INFO(0, arg4) + ZEND_ARG_VARIADIC_INFO(0, filter_args) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageconvolution, 0, 4, _IS_BOOL, 0) diff --git a/ext/pcre/php_pcre.stub.php b/ext/pcre/php_pcre.stub.php index 97f08eec0fcfa..eb8b4f3b173c9 100644 --- a/ext/pcre/php_pcre.stub.php +++ b/ext/pcre/php_pcre.stub.php @@ -2,17 +2,25 @@ /** @generate-function-entries */ +/** @param array $subpatterns */ function preg_match(string $pattern, string $subject, &$subpatterns = null, int $flags = 0, int $offset = 0): int|false {} +/** @param array $subpatterns */ function preg_match_all(string $pattern, string $subject, &$subpatterns = null, int $flags = 0, int $offset = 0): int|false|null {} +/** @param int $count */ function preg_replace(string|array $regex, string|array $replace, string|array $subject, int $limit = -1, &$count = null): string|array|null {} +/** @param int $count */ function preg_filter(string|array $regex, string|array $replace, string|array $subject, int $limit = -1, &$count = null): string|array|null {} +/** @param int $count */ function preg_replace_callback(string|array $regex, callable $callback, string|array $subject, int $limit = -1, &$count = null, int $flags = 0): string|array|null {} -/** @param string|array $subject */ +/** + * @param array|string $subject + * @param int $count + */ function preg_replace_callback_array(array $pattern, $subject, int $limit = -1, &$count = null, int $flags = 0): string|array|null {} function preg_split(string $pattern, string $subject, int $limit = -1, int $flags = 0): array|false {} diff --git a/ext/pcre/php_pcre_arginfo.h b/ext/pcre/php_pcre_arginfo.h index 678fdd69a4088..42019169107f0 100644 --- a/ext/pcre/php_pcre_arginfo.h +++ b/ext/pcre/php_pcre_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 88e664fe3f4714ab7760a99bffef5c11eafcf0aa */ + * Stub hash: 8e8fea5b33408e8a1a39c1b1ae71f16fe1bdd391 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_match, 0, 2, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0) diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index ac3ee5041ccc6..88e8136134f1a 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -1435,32 +1435,34 @@ PHP_METHOD(PDOStatement, fetchAll) } /* }}} */ -static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int is_param) /* {{{ */ +static void register_bound_param(INTERNAL_FUNCTION_PARAMETERS, int is_param) /* {{{ */ { struct pdo_bound_param_data param; zend_long param_type = PDO_PARAM_STR; zval *parameter, *driver_params = NULL; memset(¶m, 0, sizeof(param)); - param.paramno = -1; - - if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), - "lz|llz!", ¶m.paramno, ¶meter, ¶m_type, ¶m.max_value_len, - &driver_params)) { - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|llz!", ¶m.name, - ¶meter, ¶m_type, ¶m.max_value_len, - &driver_params)) { - return 0; - } - } + + ZEND_PARSE_PARAMETERS_START(2, 5) + Z_PARAM_STR_OR_LONG(param.name, param.paramno) + Z_PARAM_ZVAL(parameter) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(param_type) + Z_PARAM_LONG(param.max_value_len) + Z_PARAM_ZVAL_OR_NULL(driver_params) + ZEND_PARSE_PARAMETERS_END(); + + PHP_STMT_GET_OBJ; param.param_type = (int) param_type; - if (param.paramno > 0) { + if (param.name) { + param.paramno = -1; + } else if (param.paramno > 0) { --param.paramno; /* make it zero-based internally */ - } else if (!param.name) { + } else { pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "Columns/Parameters are 1-based"); - return 0; + RETURN_FALSE; } if (driver_params) { @@ -1472,9 +1474,11 @@ static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, if (!Z_ISUNDEF(param.parameter)) { zval_ptr_dtor(&(param.parameter)); } - return 0; + + RETURN_FALSE; } - return 1; + + RETURN_TRUE; } /* }}} */ /* {{{ bind an input parameter to the value of a PHP variable. $paramno is the 1-based position of the placeholder in the SQL statement (but can be the parameter name for drivers that support named placeholders). It should be called prior to execute(). */ @@ -1485,22 +1489,22 @@ PHP_METHOD(PDOStatement, bindValue) zval *parameter; memset(¶m, 0, sizeof(param)); - param.paramno = -1; - if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), - "lz|l", ¶m.paramno, ¶meter, ¶m_type)) { - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|l", ¶m.name, - ¶meter, ¶m_type)) { - return; - } - } + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR_OR_LONG(param.name, param.paramno) + Z_PARAM_ZVAL(parameter) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(param_type) + ZEND_PARSE_PARAMETERS_END(); PHP_STMT_GET_OBJ; param.param_type = (int) param_type; - if (param.paramno > 0) { + if (param.name) { + param.paramno = -1; + } else if (param.paramno > 0) { --param.paramno; /* make it zero-based internally */ - } else if (!param.name) { + } else { pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "Columns/Parameters are 1-based"); RETURN_FALSE; } @@ -1520,16 +1524,14 @@ PHP_METHOD(PDOStatement, bindValue) /* {{{ bind a parameter to a PHP variable. $paramno is the 1-based position of the placeholder in the SQL statement (but can be the parameter name for drivers that support named placeholders). This isn't supported by all drivers. It should be called prior to execute(). */ PHP_METHOD(PDOStatement, bindParam) { - PHP_STMT_GET_OBJ; - RETURN_BOOL(register_bound_param(INTERNAL_FUNCTION_PARAM_PASSTHRU, stmt, TRUE)); + register_bound_param(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ /* {{{ bind a column to a PHP variable. On each row fetch $param will contain the value of the corresponding column. $column is the 1-based offset of the column, or the column name. For portability, don't call this before execute(). */ PHP_METHOD(PDOStatement, bindColumn) { - PHP_STMT_GET_OBJ; - RETURN_BOOL(register_bound_param(INTERNAL_FUNCTION_PARAM_PASSTHRU, stmt, 0)); + register_bound_param(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ diff --git a/ext/pdo/pdo_stmt.stub.php b/ext/pdo/pdo_stmt.stub.php index d34607de8c1a8..c44753387c7bb 100644 --- a/ext/pdo/pdo_stmt.stub.php +++ b/ext/pdo/pdo_stmt.stub.php @@ -5,17 +5,13 @@ class PDOStatement implements IteratorAggregate { /** @return bool */ - public function bindColumn(int|string $column, &$param, int $type = 0, int $maxlen = 0, mixed $driverdata = null) {} + public function bindColumn(string|int $column, mixed &$param, int $type = 0, int $maxlen = 0, mixed $driverdata = null) {} /** @return bool */ - public function bindParam(int|string $parameter, &$param, int $type = PDO::PARAM_STR, int $maxlen = 0, mixed $driverdata = null) {} + public function bindParam(string|int $parameter, mixed &$param, int $type = PDO::PARAM_STR, int $maxlen = 0, mixed $driverdata = null) {} - /** - * @param int|string $parameter - * @param mixed $value - * @return bool - */ - public function bindValue($parameter, $value, int $type = PDO::PARAM_STR) {} + /** @return bool */ + public function bindValue(string|int $parameter, mixed $value, int $type = PDO::PARAM_STR) {} /** @return bool */ public function closeCursor() {} diff --git a/ext/pdo/pdo_stmt_arginfo.h b/ext/pdo/pdo_stmt_arginfo.h index 517c15b61471a..f0241a3001b50 100644 --- a/ext/pdo/pdo_stmt_arginfo.h +++ b/ext/pdo/pdo_stmt_arginfo.h @@ -1,25 +1,25 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 1802a0ceaa7be9a7644d1b943d2b7d70be23ec75 */ + * Stub hash: d64c75660cfc44b582e7dcc20c4ce22e8e0848e1 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindColumn, 0, 0, 2) - ZEND_ARG_TYPE_MASK(0, column, MAY_BE_LONG|MAY_BE_STRING, NULL) - ZEND_ARG_INFO(1, param) + ZEND_ARG_TYPE_MASK(0, column, MAY_BE_STRING|MAY_BE_LONG, NULL) + ZEND_ARG_TYPE_INFO(1, param, IS_MIXED, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxlen, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverdata, IS_MIXED, 0, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindParam, 0, 0, 2) - ZEND_ARG_TYPE_MASK(0, parameter, MAY_BE_LONG|MAY_BE_STRING, NULL) - ZEND_ARG_INFO(1, param) + ZEND_ARG_TYPE_MASK(0, parameter, MAY_BE_STRING|MAY_BE_LONG, NULL) + ZEND_ARG_TYPE_INFO(1, param, IS_MIXED, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "PDO::PARAM_STR") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxlen, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverdata, IS_MIXED, 0, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindValue, 0, 0, 2) - ZEND_ARG_INFO(0, parameter) - ZEND_ARG_INFO(0, value) + ZEND_ARG_TYPE_MASK(0, parameter, MAY_BE_STRING|MAY_BE_LONG, NULL) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "PDO::PARAM_STR") ZEND_END_ARG_INFO() diff --git a/ext/pdo_mysql/tests/bug_61207.phpt b/ext/pdo_mysql/tests/bug_61207.phpt index b8a6a21f09ab9..449af2b67e6c5 100644 --- a/ext/pdo_mysql/tests/bug_61207.phpt +++ b/ext/pdo_mysql/tests/bug_61207.phpt @@ -10,6 +10,7 @@ MySQLPDOTest::skip(); --FILE-- query('DROP TABLE IF EXISTS test'); @@ -19,8 +20,8 @@ $handle1 = $db->prepare('insert into test(id) values(1); select * from test where id = ?; update test set id = 2 where id = ?;'); -$handle1->bindValue('1', '1'); -$handle1->bindValue('2', '1'); +$handle1->bindValue(1, '1'); +$handle1->bindValue(2, '1'); $handle1->execute(); $i = 1; @@ -34,8 +35,8 @@ do { $handle2 = $db->prepare('select * from test where id = ?; update test set id = 1 where id = ?;'); -$handle2->bindValue('1', '2'); -$handle2->bindValue('2', '2'); +$handle2->bindValue(1, '2'); +$handle2->bindValue(2, '2'); $handle2->execute(); @@ -50,8 +51,8 @@ do { $handle3 = $db->prepare('update test set id = 2 where id = ?; select * from test where id = ?;'); -$handle3->bindValue('1', '1'); -$handle3->bindValue('2', '2'); +$handle3->bindValue(1, '1'); +$handle3->bindValue(2, '2'); $handle3->execute(); @@ -67,8 +68,8 @@ $handle4 = $db->prepare('insert into test(id) values(3); update test set id = 2 where id = ?; select * from test where id = ?;'); -$handle4->bindValue('1', '3'); -$handle4->bindValue('2', '2'); +$handle4->bindValue(1, '3'); +$handle4->bindValue(2, '2'); $handle4->execute(); diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 58b4f037f360e..de921cde8af4a 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -540,15 +540,24 @@ PHP_METHOD(SoapParam, __construct) /* {{{ SoapHeader constructor */ PHP_METHOD(SoapHeader, __construct) { - zval *data = NULL, *actor = NULL; + zval *data = NULL; + zend_string *actor_str = NULL; + zend_long actor_long; + zend_bool actor_is_null = 1; char *name, *ns; size_t name_len, ns_len; zend_bool must_understand = 0; zval *this_ptr; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|zbz", &ns, &ns_len, &name, &name_len, &data, &must_understand, &actor) == FAILURE) { - RETURN_THROWS(); - } + ZEND_PARSE_PARAMETERS_START(2, 5) + Z_PARAM_STRING(ns, ns_len) + Z_PARAM_STRING(name, name_len) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL(data) + Z_PARAM_BOOL(must_understand) + Z_PARAM_STR_OR_LONG_OR_NULL(actor_str, actor_long, actor_is_null) + ZEND_PARSE_PARAMETERS_END(); + if (ns_len == 0) { php_error_docref(NULL, E_WARNING, "Invalid namespace"); return; @@ -565,16 +574,19 @@ PHP_METHOD(SoapHeader, __construct) add_property_zval(this_ptr, "data", data); } add_property_bool(this_ptr, "mustUnderstand", must_understand); - if (actor == NULL) { - } else if (Z_TYPE_P(actor) == IS_LONG && - (Z_LVAL_P(actor) == SOAP_ACTOR_NEXT || - Z_LVAL_P(actor) == SOAP_ACTOR_NONE || - Z_LVAL_P(actor) == SOAP_ACTOR_UNLIMATERECEIVER)) { - add_property_long(this_ptr, "actor", Z_LVAL_P(actor)); - } else if (Z_TYPE_P(actor) == IS_STRING && Z_STRLEN_P(actor) > 0) { - add_property_stringl(this_ptr, "actor", Z_STRVAL_P(actor), Z_STRLEN_P(actor)); - } else { - php_error_docref(NULL, E_WARNING, "Invalid actor"); + + if (actor_str) { + if (ZSTR_LEN(actor_str) > 2) { + add_property_stringl(this_ptr, "actor", ZSTR_VAL(actor_str), ZSTR_LEN(actor_str)); + } else { + php_error_docref(NULL, E_WARNING, "Invalid actor"); + } + } else if (!actor_is_null) { + if ((actor_long == SOAP_ACTOR_NEXT || actor_long == SOAP_ACTOR_NONE || actor_long == SOAP_ACTOR_UNLIMATERECEIVER)) { + add_property_long(this_ptr, "actor", actor_long); + } else { + php_error_docref(NULL, E_WARNING, "Invalid actor"); + } } } /* }}} */ @@ -584,36 +596,34 @@ PHP_METHOD(SoapFault, __construct) { char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL, *name = NULL, *fault_code_ns = NULL; size_t fault_string_len, fault_actor_len = 0, name_len = 0, fault_code_len = 0; - zval *code = NULL, *details = NULL, *headerfault = NULL, *this_ptr; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs|s!z!s!z!", - &code, - &fault_string, &fault_string_len, - &fault_actor, &fault_actor_len, - &details, &name, &name_len, &headerfault) == FAILURE) { - RETURN_THROWS(); - } - - if (Z_TYPE_P(code) == IS_NULL) { - } else if (Z_TYPE_P(code) == IS_STRING) { - fault_code = Z_STRVAL_P(code); - fault_code_len = Z_STRLEN_P(code); - } else if (Z_TYPE_P(code) == IS_ARRAY && zend_hash_num_elements(Z_ARRVAL_P(code)) == 2) { - zval *t_ns = zend_hash_index_find(Z_ARRVAL_P(code), 0); - zval *t_code = zend_hash_index_find(Z_ARRVAL_P(code), 1); + zval *details = NULL, *headerfault = NULL, *this_ptr; + zend_string *code_str; + HashTable *code_ht; + + ZEND_PARSE_PARAMETERS_START(2, 6) + Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(code_str, code_ht) + Z_PARAM_STRING(fault_string, fault_string_len) + Z_PARAM_OPTIONAL + Z_PARAM_STRING_OR_NULL(fault_actor, fault_actor_len) + Z_PARAM_ZVAL_OR_NULL(details) + Z_PARAM_STRING_OR_NULL(name, name_len) + Z_PARAM_ZVAL_OR_NULL(headerfault) + ZEND_PARSE_PARAMETERS_END(); + + if (code_str) { + fault_code = ZSTR_VAL(code_str); + fault_code_len = ZSTR_LEN(code_str); + } else if (code_ht && zend_hash_num_elements(code_ht) == 2) { + zval *t_ns = zend_hash_index_find(code_ht, 0); + zval *t_code = zend_hash_index_find(code_ht, 1); if (t_ns && t_code && Z_TYPE_P(t_ns) == IS_STRING && Z_TYPE_P(t_code) == IS_STRING) { fault_code_ns = Z_STRVAL_P(t_ns); fault_code = Z_STRVAL_P(t_code); fault_code_len = Z_STRLEN_P(t_code); - } else { - php_error_docref(NULL, E_WARNING, "Invalid fault code"); - return; } - } else { - php_error_docref(NULL, E_WARNING, "Invalid fault code"); - return; } - if (fault_code != NULL && fault_code_len == 0) { + + if ((code_str || code_ht) && (fault_code == NULL || fault_code_len == 0)) { php_error_docref(NULL, E_WARNING, "Invalid fault code"); return; } @@ -673,20 +683,22 @@ PHP_METHOD(SoapFault, __toString) /* {{{ SoapVar constructor */ PHP_METHOD(SoapVar, __construct) { - zval *data, *type, *this_ptr; + zval *data, *this_ptr; + zend_long type; + zend_bool type_is_null = 1; char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL; size_t stype_len = 0, ns_len = 0, name_len = 0, namens_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z!z|ssss", &data, &type, &stype, &stype_len, &ns, &ns_len, &name, &name_len, &namens, &namens_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z!l!|ssss", &data, &type, &type_is_null, &stype, &stype_len, &ns, &ns_len, &name, &name_len, &namens, &namens_len) == FAILURE) { RETURN_THROWS(); } this_ptr = ZEND_THIS; - if (Z_TYPE_P(type) == IS_NULL) { + if (type_is_null) { add_property_long(this_ptr, "enc_type", UNKNOWN_TYPE); } else { - if (zend_hash_index_exists(&SOAP_GLOBAL(defEncIndex), Z_LVAL_P(type))) { - add_property_long(this_ptr, "enc_type", Z_LVAL_P(type)); + if (zend_hash_index_exists(&SOAP_GLOBAL(defEncIndex), type)) { + add_property_long(this_ptr, "enc_type", type); } else { php_error_docref(NULL, E_WARNING, "Invalid type ID"); return; @@ -820,22 +832,19 @@ static HashTable* soap_create_typemap(sdlPtr sdl, HashTable *ht) /* {{{ */ PHP_METHOD(SoapServer, __construct) { soapServicePtr service; - zval *wsdl = NULL, *options = NULL; + zval *options = NULL; + zend_string *wsdl; zend_resource *res; int version = SOAP_1_1; zend_long cache_wsdl; HashTable *typemap_ht = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "S!|a", &wsdl, &options) == FAILURE) { RETURN_THROWS(); } SOAP_SERVER_BEGIN_CODE(); - if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) { - php_error_docref(NULL, E_ERROR, "Invalid parameters"); - } - service = emalloc(sizeof(soapService)); memset(service, 0, sizeof(soapService)); service->send_errors = 1; @@ -858,7 +867,7 @@ PHP_METHOD(SoapServer, __construct) if ((tmp = zend_hash_str_find(ht, "uri", sizeof("uri")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { service->uri = estrndup(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); - } else if (Z_TYPE_P(wsdl) == IS_NULL) { + } else if (!wsdl) { php_error_docref(NULL, E_ERROR, "'uri' option is required in nonWSDL mode"); } @@ -910,7 +919,7 @@ PHP_METHOD(SoapServer, __construct) } } - } else if (Z_TYPE_P(wsdl) == IS_NULL) { + } else if (!wsdl) { php_error_docref(NULL, E_ERROR, "'uri' option is required in nonWSDL mode"); } @@ -919,8 +928,8 @@ PHP_METHOD(SoapServer, __construct) service->soap_functions.functions_all = FALSE; service->soap_functions.ft = zend_new_array(0); - if (Z_TYPE_P(wsdl) != IS_NULL) { - service->sdl = get_sdl(ZEND_THIS, Z_STRVAL_P(wsdl), cache_wsdl); + if (wsdl) { + service->sdl = get_sdl(ZEND_THIS, ZSTR_VAL(wsdl), cache_wsdl); if (service->uri == NULL) { if (service->sdl->target_ns) { service->uri = estrdup(service->sdl->target_ns); @@ -1964,7 +1973,8 @@ PHP_FUNCTION(is_soap_fault) PHP_METHOD(SoapClient, __construct) { - zval *wsdl, *options = NULL; + zval *options = NULL; + zend_string *wsdl; int soap_version = SOAP_1_1; php_stream_context *context = NULL; zend_long cache_wsdl; @@ -1972,23 +1982,19 @@ PHP_METHOD(SoapClient, __construct) HashTable *typemap_ht = NULL; zval *this_ptr = ZEND_THIS; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "S!|a", &wsdl, &options) == FAILURE) { RETURN_THROWS(); } SOAP_CLIENT_BEGIN_CODE(); - if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) { - php_error_docref(NULL, E_ERROR, "$wsdl must be string or null"); - } - cache_wsdl = SOAP_GLOBAL(cache_enabled) ? SOAP_GLOBAL(cache_mode) : 0; if (options != NULL) { HashTable *ht = Z_ARRVAL_P(options); zval *tmp, tmp2; - if (Z_TYPE_P(wsdl) == IS_NULL) { + if (!wsdl) { /* Fetching non-WSDL mode options */ if ((tmp = zend_hash_str_find(ht, "uri", sizeof("uri")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { @@ -2021,7 +2027,7 @@ PHP_METHOD(SoapClient, __construct) if ((tmp = zend_hash_str_find(ht, "location", sizeof("location")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { add_property_str(this_ptr, "location", zend_string_copy(Z_STR_P(tmp))); - } else if (Z_TYPE_P(wsdl) == IS_NULL) { + } else if (!wsdl) { php_error_docref(NULL, E_ERROR, "'location' option is required in nonWSDL mode"); } @@ -2157,20 +2163,20 @@ PHP_METHOD(SoapClient, __construct) Z_TYPE_P(tmp) == IS_LONG) { add_property_long(this_ptr, "_ssl_method", Z_LVAL_P(tmp)); } - } else if (Z_TYPE_P(wsdl) == IS_NULL) { + } else if (!wsdl) { php_error_docref(NULL, E_ERROR, "'location' and 'uri' options are required in nonWSDL mode"); } add_property_long(this_ptr, "_soap_version", soap_version); - if (Z_TYPE_P(wsdl) != IS_NULL) { + if (wsdl) { int old_soap_version; zend_resource *res; old_soap_version = SOAP_GLOBAL(soap_version); SOAP_GLOBAL(soap_version) = soap_version; - sdl = get_sdl(this_ptr, Z_STRVAL_P(wsdl), cache_wsdl); + sdl = get_sdl(this_ptr, ZSTR_VAL(wsdl), cache_wsdl); res = zend_register_resource(sdl, le_sdl); add_property_resource(this_ptr, "sdl", res); diff --git a/ext/soap/soap.stub.php b/ext/soap/soap.stub.php index e60ae6954c28a..44f2b01135221 100644 --- a/ext/soap/soap.stub.php +++ b/ext/soap/soap.stub.php @@ -8,32 +8,32 @@ function is_soap_fault(mixed $object): bool {} class SoapParam { - public function __construct($data, string $name) {} + public function __construct(mixed $data, string $name) {} } class SoapHeader { - public function __construct(string $namespace, string $name, $data = UNKNOWN, bool $mustunderstand = false, $actor = UNKNOWN) {} + public function __construct(string $namespace, string $name, mixed $data = UNKNOWN, bool $mustunderstand = false, string|int|null $actor = null) {} } class SoapFault extends Exception { - public function __construct($faultcode, string $faultstring, ?string $faultactor = null, $detail = null, ?string $faultname = null, $headerfault = null) {} + public function __construct(array|string|null $faultcode, string $faultstring, ?string $faultactor = null, mixed $detail = null, ?string $faultname = null, mixed $headerfault = null) {} public function __toString(): string {} } class SoapVar { - public function __construct($data, $encoding, string $type_name = "", string $type_namespace = "", string $node_name = "", string $node_namespace = "") {} + public function __construct(mixed $data, ?int $encoding, string $type_name = "", string $type_namespace = "", string $node_name = "", string $node_namespace = "") {} } class SoapServer { - public function __construct($wsdl, array $options = []) {} + public function __construct(?string $wsdl, array $options = []) {} /** @return void */ - public function fault(string $code, string $string, string $actor = "", $details = null, string $name = "") {} + public function fault(string $code, string $string, string $actor = "", mixed $details = null, string $name = "") {} /** @return void */ public function addSoapHeader(SoapHeader $object) {} @@ -42,7 +42,7 @@ public function addSoapHeader(SoapHeader $object) {} public function setPersistence(int $mode) {} /** @return void */ - public function setClass(string $class_name, ...$argv) {} + public function setClass(string $class_name, mixed ...$argv) {} /** @return void */ public function setObject(object $object) {} @@ -50,7 +50,10 @@ public function setObject(object $object) {} /** @return array */ public function getFunctions() {} - /** @return void */ + /** + * @param array|string|int $functions + * @return void + */ public function addFunction($functions) {} /** @return void */ @@ -59,13 +62,17 @@ public function handle(string $soap_request = UNKNOWN) {} class SoapClient { - public function __construct($wsdl, array $options = []) {} + public function __construct(?string $wsdl, array $options = []) {} /** @return mixed */ public function __call(string $function_name, array $arguments) {} - /** @return mixed */ - public function __soapCall(string $function_name, array $arguments, ?array $options = null, $input_headers = null, $output_headers = null) {} + /** + * @param SoapHeader|array|null $input_headers + * @param array $output_headers + * @return mixed + */ + public function __soapCall(string $function_name, array $arguments, ?array $options = null, $input_headers = null, &$output_headers = null) {} /** @return array|null */ public function __getFunctions() {} @@ -94,7 +101,10 @@ public function __setCookie(string $name, ?string $value = null) {} /** @return array */ public function __getCookies() {} - /** @return bool */ + /** + * @param SoapHeader|array|null $soapheaders + * @return bool + */ public function __setSoapHeaders($soapheaders = null) {} /** @return string|null */ diff --git a/ext/soap/soap_arginfo.h b/ext/soap/soap_arginfo.h index b4da9dfbe3f63..49162a5d0e232 100644 --- a/ext/soap/soap_arginfo.h +++ b/ext/soap/soap_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 14076c21ac68b4d1e88c1067e7d1f87373f1669e */ + * Stub hash: 75e1f968f03aacc08ad7858adff05040ed61e23d */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_use_soap_error_handler, 0, 0, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, handler, _IS_BOOL, 0, "true") @@ -10,33 +10,33 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_is_soap_fault, 0, 1, _IS_BOOL, 0 ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapParam___construct, 0, 0, 2) - ZEND_ARG_INFO(0, data) + ZEND_ARG_TYPE_INFO(0, data, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapHeader___construct, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) - ZEND_ARG_INFO(0, data) + ZEND_ARG_TYPE_INFO(0, data, IS_MIXED, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mustunderstand, _IS_BOOL, 0, "false") - ZEND_ARG_INFO(0, actor) + ZEND_ARG_TYPE_MASK(0, actor, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_NULL, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapFault___construct, 0, 0, 2) - ZEND_ARG_INFO(0, faultcode) + ZEND_ARG_TYPE_MASK(0, faultcode, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, NULL) ZEND_ARG_TYPE_INFO(0, faultstring, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, faultactor, IS_STRING, 1, "null") - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, detail, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, detail, IS_MIXED, 0, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, faultname, IS_STRING, 1, "null") - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, headerfault, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, headerfault, IS_MIXED, 0, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_SoapFault___toString, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapVar___construct, 0, 0, 2) - ZEND_ARG_INFO(0, data) - ZEND_ARG_INFO(0, encoding) + ZEND_ARG_TYPE_INFO(0, data, IS_MIXED, 0) + ZEND_ARG_TYPE_INFO(0, encoding, IS_LONG, 1) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type_name, IS_STRING, 0, "\"\"") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type_namespace, IS_STRING, 0, "\"\"") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, node_name, IS_STRING, 0, "\"\"") @@ -44,7 +44,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapVar___construct, 0, 0, 2) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer___construct, 0, 0, 1) - ZEND_ARG_INFO(0, wsdl) + ZEND_ARG_TYPE_INFO(0, wsdl, IS_STRING, 1) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() @@ -52,7 +52,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_fault, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, code, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, actor, IS_STRING, 0, "\"\"") - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, details, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, details, IS_MIXED, 0, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, name, IS_STRING, 0, "\"\"") ZEND_END_ARG_INFO() @@ -66,7 +66,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_setClass, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0) - ZEND_ARG_VARIADIC_INFO(0, argv) + ZEND_ARG_VARIADIC_TYPE_INFO(0, argv, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_setObject, 0, 0, 1) @@ -96,7 +96,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapClient___soapCall, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, arguments, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, input_headers, "null") - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, output_headers, "null") + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, output_headers, "null") ZEND_END_ARG_INFO() #define arginfo_class_SoapClient___getFunctions arginfo_class_SoapServer_getFunctions diff --git a/ext/soap/tests/fault_warning.phpt b/ext/soap/tests/fault_warning.phpt index f92cc81b2e221..e43b1d83593f4 100644 --- a/ext/soap/tests/fault_warning.phpt +++ b/ext/soap/tests/fault_warning.phpt @@ -5,7 +5,13 @@ SoapFault class: Invalid Fault code warning given? Can't be an empty string, an --FILE-- getMessage() . "\n"; +} + $fault = new SoapFault("Sender", "message"); echo get_class($fault) . "\n"; $fault = new SoapFault(null, "message"); @@ -17,8 +23,7 @@ echo get_class($fault); ?> --EXPECTF-- Warning: SoapFault::__construct(): Invalid fault code in %s on line %d - -Warning: SoapFault::__construct(): Invalid fault code in %s on line %d +SoapFault::__construct(): Argument #1 ($faultcode) must be of type string|array|null, stdClass given SoapFault SoapFault diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index af7304c5f5c35..333116d4158ed 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -1761,11 +1761,12 @@ static void sqlite3stmt_bind(INTERNAL_FUNCTION_PARAMETERS) param.param_number = -1; param.type = SQLITE3_TEXT; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "lz|l", ¶m.param_number, ¶meter, ¶m.type) == FAILURE) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|l", ¶m.name, ¶meter, ¶m.type) == FAILURE) { - RETURN_THROWS(); - } - } + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR_OR_LONG(param.name, param.param_number) + Z_PARAM_ZVAL(parameter) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(param.type) + ZEND_PARSE_PARAMETERS_END(); SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt); diff --git a/ext/sqlite3/sqlite3.stub.php b/ext/sqlite3/sqlite3.stub.php index 1d6357c3e1103..bae34bd0ffebe 100644 --- a/ext/sqlite3/sqlite3.stub.php +++ b/ext/sqlite3/sqlite3.stub.php @@ -59,13 +59,23 @@ public function query(string $query) {} /** @return mixed */ public function querySingle(string $query, bool $entire_row = false) {} - /** @return bool */ + /** + * @param callable $callback + * @return bool + */ public function createFunction(string $name, $callback, int $argument_count = -1, int $flags = 0) {} - /** @return bool */ + /** + * @param callable $step_callback + * @param callable $final_callback + * @return bool + */ public function createAggregate(string $name, $step_callback, $final_callback, int $argument_count = -1) {} - /** @return bool */ + /** + * @param callable $callback + * @return bool + */ public function createCollation(string $name, $callback) {} /** @return resource|false */ @@ -86,10 +96,10 @@ class SQLite3Stmt private function __construct(SQLite3 $sqlite3, string $sql) {} /** @return bool */ - public function bindParam($param_number, &$param, int $type = SQLITE3_TEXT) {} + public function bindParam(string|int $param_number, mixed &$param, int $type = SQLITE3_TEXT) {} /** @return bool */ - public function bindValue($param_number, $param, int $type = SQLITE3_TEXT) {} + public function bindValue(string|int $param_number, mixed $param, int $type = SQLITE3_TEXT) {} /** @return bool */ public function clear() {} diff --git a/ext/sqlite3/sqlite3_arginfo.h b/ext/sqlite3/sqlite3_arginfo.h index a723e32ef06c6..79b0cfbcb1360 100644 --- a/ext/sqlite3/sqlite3_arginfo.h +++ b/ext/sqlite3/sqlite3_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ded6aa03b742cbcf95943a6acb1101a0b700f30c */ + * Stub hash: cc36f3299089a453fac76179377b68647c33786c */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) @@ -104,14 +104,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3Stmt___construct, 0, 0, 2) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3Stmt_bindParam, 0, 0, 2) - ZEND_ARG_INFO(0, param_number) - ZEND_ARG_INFO(1, param) + ZEND_ARG_TYPE_MASK(0, param_number, MAY_BE_STRING|MAY_BE_LONG, NULL) + ZEND_ARG_TYPE_INFO(1, param, IS_MIXED, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "SQLITE3_TEXT") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3Stmt_bindValue, 0, 0, 2) - ZEND_ARG_INFO(0, param_number) - ZEND_ARG_INFO(0, param) + ZEND_ARG_TYPE_MASK(0, param_number, MAY_BE_STRING|MAY_BE_LONG, NULL) + ZEND_ARG_TYPE_INFO(0, param, IS_MIXED, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "SQLITE3_TEXT") ZEND_END_ARG_INFO() diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 75626971b61fd..2e628b8b742fc 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -120,6 +120,10 @@ function array_search(mixed $needle, array $haystack, bool $strict = false): int /** @prefer-ref $array */ function extract(array &$array, int $extract_type = EXTR_OVERWRITE, string $prefix = ""): int {} +/** + * @param string|array $var_name + * @param string|array $var_names + */ function compact($var_name, ...$var_names): array {} function array_fill(int $start_key, int $num, mixed $val): array {} @@ -177,34 +181,44 @@ function array_unique(array $array, int $flags = SORT_STRING): array {} function array_intersect_key(array $array1, array $array2, array ...$arrays): array {} +/** @param array|callable $rest */ function array_intersect_ukey(array $array1, array $array2, ...$rest): array {} function array_intersect(array $array1, array $array2, array ...$arrays): array {} +/** @param array|callable $rest */ function array_uintersect(array $array1, array $array2, ...$rest): array {} function array_intersect_assoc(array $array1, array $array2, array ...$arrays): array {} +/** @param array|callable $rest */ function array_uintersect_assoc(array $array1, array $array2, ...$rest): array {} +/** @param array|callable $rest */ function array_intersect_uassoc(array $array1, array $array2, ...$rest): array {} +/** @param array|callable $rest */ function array_uintersect_uassoc(array $array1, array $array2, ...$rest): array {} function array_diff_key(array $array1, array $array2, array ...$arrays): array {} +/** @param array|callable $rest */ function array_diff_ukey(array $array1, array $array2, ...$rest): array {} function array_diff(array $array1, array $array2, array ...$arrays): array {} +/** @param array|callable $rest */ function array_udiff(array $array1, array $array2, ...$rest): array {} function array_diff_assoc(array $array1, array $array2, array ...$arrays): array {} +/** @param array|callable $rest */ function array_diff_uassoc(array $array1, array $array2, ...$rest): array {} +/** @param array|callable $rest */ function array_udiff_assoc(array $array1, array $array2, ...$rest): array {} +/** @param array|callable $rest */ function array_udiff_uassoc(array $array1, array $array2, ...$rest): array {} /** @@ -925,14 +939,14 @@ function stat(string $filename): array|false {} function lstat(string $filename): array|false {} -function chown(string $filename, $user): bool {} +function chown(string $filename, string|int $user): bool {} -function chgrp(string $filename, $group): bool {} +function chgrp(string $filename, string|int $group): bool {} #if HAVE_LCHOWN -function lchown(string $filename, $user): bool {} +function lchown(string $filename, string|int $user): bool {} -function lchgrp(string $filename, $group): bool {} +function lchgrp(string $filename, string|int $group): bool {} #endif function chmod(string $filename, int $mode): bool {} diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 30d7dad50a922..20a0170989d67 100755 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: a26e702dd4b4a98d07d5ed47ae622431ad373123 */ + * Stub hash: 1c0060ad8608f5245e0b5319879b77510cb81683 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0) @@ -1414,25 +1414,25 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_chown, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) - ZEND_ARG_INFO(0, user) + ZEND_ARG_TYPE_MASK(0, user, MAY_BE_STRING|MAY_BE_LONG, NULL) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_chgrp, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) - ZEND_ARG_INFO(0, group) + ZEND_ARG_TYPE_MASK(0, group, MAY_BE_STRING|MAY_BE_LONG, NULL) ZEND_END_ARG_INFO() #if HAVE_LCHOWN ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_lchown, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) - ZEND_ARG_INFO(0, user) + ZEND_ARG_TYPE_MASK(0, user, MAY_BE_STRING|MAY_BE_LONG, NULL) ZEND_END_ARG_INFO() #endif #if HAVE_LCHOWN ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_lchgrp, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) - ZEND_ARG_INFO(0, group) + ZEND_ARG_TYPE_MASK(0, group, MAY_BE_STRING|MAY_BE_LONG, NULL) ZEND_END_ARG_INFO() #endif diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index d7b690689bec5..cb0b406a322c8 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -327,7 +327,8 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ { char *filename; size_t filename_len; - zval *group; + zend_string *group_str; + zend_long group_long; #if !defined(WINDOWS) gid_t gid; int ret; @@ -336,7 +337,7 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_PATH(filename, filename_len) - Z_PARAM_ZVAL(group) + Z_PARAM_STR_OR_LONG(group_str, group_long) ZEND_PARSE_PARAMETERS_END(); wrapper = php_stream_locate_url_wrapper(filename, NULL, 0); @@ -344,16 +345,14 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ if(wrapper && wrapper->wops->stream_metadata) { int option; void *value; - if (Z_TYPE_P(group) == IS_LONG) { - option = PHP_STREAM_META_GROUP; - value = &Z_LVAL_P(group); - } else if (Z_TYPE_P(group) == IS_STRING) { + if (group_str) { option = PHP_STREAM_META_GROUP_NAME; - value = Z_STRVAL_P(group); + value = ZSTR_VAL(group_str); } else { - zend_argument_type_error(2, "must be of type string|int, %s given", zend_zval_type_name(group)); - RETURN_THROWS(); + option = PHP_STREAM_META_GROUP; + value = &group_long; } + if(wrapper->wops->stream_metadata(wrapper, filename, option, value, NULL)) { RETURN_TRUE; } else { @@ -372,16 +371,13 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ /* We have no native chgrp on Windows, nothing left to do if stream doesn't have own implementation */ RETURN_FALSE; #else - if (Z_TYPE_P(group) == IS_LONG) { - gid = (gid_t)Z_LVAL_P(group); - } else if (Z_TYPE_P(group) == IS_STRING) { - if(php_get_gid_by_name(Z_STRVAL_P(group), &gid) != SUCCESS) { - php_error_docref(NULL, E_WARNING, "Unable to find gid for %s", Z_STRVAL_P(group)); + if (group_str) { + if (php_get_gid_by_name(ZSTR_VAL(group_str), &gid) != SUCCESS) { + php_error_docref(NULL, E_WARNING, "Unable to find gid for %s", ZSTR_VAL(group_str)); RETURN_FALSE; } } else { - zend_argument_type_error(2, "must be of type string|int, %s given", zend_zval_type_name(group)); - RETURN_THROWS(); + gid = (gid_t) group_long; } /* Check the basedir */ @@ -416,11 +412,7 @@ PHP_FUNCTION(chgrp) #if HAVE_LCHOWN PHP_FUNCTION(lchgrp) { -# if !defined(WINDOWS) php_do_chgrp(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -# else - RETURN_FALSE; -# endif } #endif /* }}} */ @@ -461,7 +453,8 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ { char *filename; size_t filename_len; - zval *user; + zend_string *user_str; + zend_long user_long; #if !defined(WINDOWS) uid_t uid; int ret; @@ -470,7 +463,7 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_PATH(filename, filename_len) - Z_PARAM_ZVAL(user) + Z_PARAM_STR_OR_LONG(user_str, user_long) ZEND_PARSE_PARAMETERS_END(); wrapper = php_stream_locate_url_wrapper(filename, NULL, 0); @@ -478,16 +471,14 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ if(wrapper && wrapper->wops->stream_metadata) { int option; void *value; - if (Z_TYPE_P(user) == IS_LONG) { - option = PHP_STREAM_META_OWNER; - value = &Z_LVAL_P(user); - } else if (Z_TYPE_P(user) == IS_STRING) { + if (user_str) { option = PHP_STREAM_META_OWNER_NAME; - value = Z_STRVAL_P(user); + value = ZSTR_VAL(user_str); } else { - php_error_docref(NULL, E_WARNING, "Parameter 2 should be string or int, %s given", zend_zval_type_name(user)); - RETURN_FALSE; + option = PHP_STREAM_META_OWNER; + value = &user_long; } + if(wrapper->wops->stream_metadata(wrapper, filename, option, value, NULL)) { RETURN_TRUE; } else { @@ -507,16 +498,13 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ RETURN_FALSE; #else - if (Z_TYPE_P(user) == IS_LONG) { - uid = (uid_t)Z_LVAL_P(user); - } else if (Z_TYPE_P(user) == IS_STRING) { - if(php_get_uid_by_name(Z_STRVAL_P(user), &uid) != SUCCESS) { - php_error_docref(NULL, E_WARNING, "Unable to find uid for %s", Z_STRVAL_P(user)); + if (user_str) { + if (php_get_uid_by_name(ZSTR_VAL(user_str), &uid) != SUCCESS) { + php_error_docref(NULL, E_WARNING, "Unable to find uid for %s", ZSTR_VAL(user_str)); RETURN_FALSE; } } else { - php_error_docref(NULL, E_WARNING, "Parameter 2 should be string or int, %s given", zend_zval_type_name(user)); - RETURN_FALSE; + uid = (uid_t) user_long; } /* Check the basedir */ @@ -552,12 +540,8 @@ PHP_FUNCTION(chown) #if HAVE_LCHOWN PHP_FUNCTION(lchown) { -# if !defined(WINDOWS) RETVAL_TRUE; php_do_chown(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -# else - RETURN_FALSE; -# endif } #endif /* }}} */ diff --git a/ext/standard/tests/file/chgrp.phpt b/ext/standard/tests/file/chgrp.phpt index 37ae20d40e1ae..b94def684a8c6 100644 --- a/ext/standard/tests/file/chgrp.phpt +++ b/ext/standard/tests/file/chgrp.phpt @@ -13,5 +13,5 @@ try { echo $exception->getMessage() . "\n"; } ?> ---EXPECT-- -chgrp(): Argument #2 ($group) must be of type string|int, null given +--EXPECTF-- +Warning: chgrp(): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/chown.phpt b/ext/standard/tests/file/chown.phpt index 1654e550b6a46..05cd4e4d7d414 100644 --- a/ext/standard/tests/file/chown.phpt +++ b/ext/standard/tests/file/chown.phpt @@ -11,5 +11,5 @@ chown("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", NULL); echo "ALIVE\n"; ?> --EXPECTF-- -Warning: chown(): Parameter 2 should be string or int, null given in %schown.php on line %d +Warning: chown(): No such file or directory in %s on line %d ALIVE diff --git a/ext/standard/tests/filters/php_user_filter_01.phpt b/ext/standard/tests/filters/php_user_filter_01.phpt index fb47177f4c65c..fb56857a1846f 100644 --- a/ext/standard/tests/filters/php_user_filter_01.phpt +++ b/ext/standard/tests/filters/php_user_filter_01.phpt @@ -14,4 +14,4 @@ class bar extends php_user_filter { } ?> --EXPECTF-- -Fatal error: Declaration of bar::filter($in, $out, &$consumed) must be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d +Fatal error: Declaration of bar::filter($in, $out, &$consumed) must be compatible with php_user_filter::filter($in, $out, &$consumed, bool $closing) in %s on line %d diff --git a/ext/standard/tests/filters/php_user_filter_02.phpt b/ext/standard/tests/filters/php_user_filter_02.phpt index fd0822153b1a8..b1a141e6f2be3 100644 --- a/ext/standard/tests/filters/php_user_filter_02.phpt +++ b/ext/standard/tests/filters/php_user_filter_02.phpt @@ -9,4 +9,4 @@ class foo extends php_user_filter { } ?> --EXPECTF-- -Fatal error: Declaration of foo::filter($in, $out, $consumed, $closing) must be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d +Fatal error: Declaration of foo::filter($in, $out, $consumed, $closing) must be compatible with php_user_filter::filter($in, $out, &$consumed, bool $closing) in %s on line %d diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 464f792f2e4bf..e60bce56be70f 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -41,8 +41,9 @@ static int le_bucket; PHP_METHOD(php_user_filter, filter) { - zval *in, *out, *consumed, *closing; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "zzzz", &in, &out, &consumed, &closing) == FAILURE) { + zval *in, *out, *consumed; + zend_bool closing; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrzb", &in, &out, &consumed, &closing) == FAILURE) { RETURN_THROWS(); } } diff --git a/ext/standard/user_filters.stub.php b/ext/standard/user_filters.stub.php index 38c66c6bc19ad..40657503127f4 100755 --- a/ext/standard/user_filters.stub.php +++ b/ext/standard/user_filters.stub.php @@ -4,8 +4,13 @@ class php_user_filter { - /** @return int */ - public function filter($in, $out, &$consumed, $closing) {} + /** + * @param resource $in + * @param resource $out + * @param int $consumed + * @return int + */ + public function filter($in, $out, &$consumed, bool $closing) {} /** @return void */ public function onCreate() {} diff --git a/ext/standard/user_filters_arginfo.h b/ext/standard/user_filters_arginfo.h index bf4a918923999..aabb25c9d1bdc 100644 --- a/ext/standard/user_filters_arginfo.h +++ b/ext/standard/user_filters_arginfo.h @@ -1,11 +1,11 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 1c95e4944aab77be8b65da8a6877738b1f061b69 */ + * Stub hash: b3876ce9055a9417d0d1db9f97235513740de956 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_php_user_filter_filter, 0, 0, 4) ZEND_ARG_INFO(0, in) ZEND_ARG_INFO(0, out) ZEND_ARG_INFO(1, consumed) - ZEND_ARG_INFO(0, closing) + ZEND_ARG_TYPE_INFO(0, closing, _IS_BOOL, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_php_user_filter_onCreate, 0, 0, 0) diff --git a/ext/zip/php_zip.stub.php b/ext/zip/php_zip.stub.php index 4d9ba27f866d9..01f055f0ab4ba 100644 --- a/ext/zip/php_zip.stub.php +++ b/ext/zip/php_zip.stub.php @@ -183,10 +183,18 @@ public function setExternalAttributesName(string $name, int $opsys, int $attr, i /** @return bool */ public function setExternalAttributesIndex(int $index, int $opsys, int $attr, int $flags = 0) {} - /** @return bool */ + /** + * @param int $opsys + * @param int $attr + * @return bool + */ public function getExternalAttributesName(string $name, &$opsys, &$attr, int $flags = 0) {} - /** @return bool */ + /** + * @param int $opsys + * @param int $attr + * @return bool + */ public function getExternalAttributesIndex(int $index, &$opsys, &$attr, int $flags = 0) {} #endif diff --git a/ext/zip/php_zip_arginfo.h b/ext/zip/php_zip_arginfo.h index 25157d8d7bfce..87222c9e08075 100644 --- a/ext/zip/php_zip_arginfo.h +++ b/ext/zip/php_zip_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 95608dd1d6c2ad80ada990a9e939b76dba705d48 */ + * Stub hash: 880148896a71ad9bd076bb42c735ff1b83cd0731 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)