diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index bd671018e038..31995eb80752 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -227,6 +227,13 @@ PHP 8.6 INTERNALS UPGRADE NOTES . Added zend_string_ends_with() and related variants. . Added trait support for internal classes. . Added do_php_cli(). + . Added zval_try_get_double(), which converts a defined zval to a double and + reports conversion failures through a bool pointer. String conversion uses + the numeric-string semantics of zval_try_get_long(), rather than the + zend_strtod() semantics of zval_get_double(); non-numeric strings such as + "INF" and "NAN" fail, while leading-numeric strings emit E_WARNING. When + *failed is true, the returned value must not be used and an exception may + already be pending. Passing an IS_UNDEF zval is a caller error. ======================== 2. Build system changes diff --git a/Zend/zend_attributes_arginfo.h b/Zend/zend_attributes_arginfo.h index b21b96ebe39d..2c4bfc99e1ef 100644 --- a/Zend/zend_attributes_arginfo.h +++ b/Zend/zend_attributes_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit zend_attributes.stub.php instead. * Stub hash: dc2b1de9f4d91162f0e9ab236272f79019c5b5ab */ +#include "zend_attributes.h" + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Attribute___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "Attribute::TARGET_ALL") ZEND_END_ARG_INFO() diff --git a/Zend/zend_builtin_functions_arginfo.h b/Zend/zend_builtin_functions_arginfo.h index fc8d8270b016..2fba874a8e93 100644 --- a/Zend/zend_builtin_functions_arginfo.h +++ b/Zend/zend_builtin_functions_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit zend_builtin_functions.stub.php instead. * Stub hash: 5d7145b7bc305bb50b45e75c02740206148223b1 */ +#include "zend_attributes.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_clone, 0, 1, IS_OBJECT, 0) ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, withProperties, IS_ARRAY, 0, "[]") diff --git a/Zend/zend_constants_arginfo.h b/Zend/zend_constants_arginfo.h index b10adc02d28a..b8346610ed59 100644 --- a/Zend/zend_constants_arginfo.h +++ b/Zend/zend_constants_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit zend_constants.stub.php instead. * Stub hash: 569ccba4e0a93a9ce49c81c76955413188df390e */ +#include "zend_attributes.h" +#include "zend_constants.h" + static void register_zend_constants_symbols(int module_number) { REGISTER_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT); diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index b1b1a39a536a..94c05fcee8c9 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1058,6 +1058,77 @@ ZEND_API double ZEND_FASTCALL zval_get_double_func(const zval *op) /* {{{ */ } /* }}} */ +/* + * Strings use zval_try_get_long() numeric-string semantics. If *failed is true, + * the return value must not be used and an exception may be pending. The input + * must not be IS_UNDEF. + */ +ZEND_API double ZEND_FASTCALL zval_try_get_double_func(const zval *op, bool *failed) +{ + *failed = false; +try_again: + switch (Z_TYPE_P(op)) { + case IS_NULL: + case IS_FALSE: + return 0.0; + case IS_TRUE: + return 1.0; + case IS_LONG: + return (double) Z_LVAL_P(op); + case IS_DOUBLE: + return Z_DVAL_P(op); + case IS_STRING: + { + uint8_t type; + zend_long lval; + double dval; + double result; + bool trailing_data = false; + + type = is_numeric_string_ex(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval, + /* allow errors */ true, NULL, &trailing_data); + if (type == 0) { + *failed = true; + return 0.0; + } + if (type == IS_DOUBLE) { + result = dval; + } else if (UNEXPECTED(lval == 0)) { + result = zend_strtod(Z_STRVAL_P(op), NULL); + } else { + result = (double) lval; + } + if (UNEXPECTED(trailing_data)) { + zend_error(E_WARNING, "A non-numeric value encountered"); + if (UNEXPECTED(EG(exception))) { + *failed = true; + return 0.0; + } + } + return result; + } + case IS_OBJECT: + { + zval dst; + if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), &dst, IS_DOUBLE) == FAILURE + || EG(exception)) { + *failed = true; + return 0.0; + } + ZEND_ASSERT(Z_TYPE(dst) == IS_DOUBLE); + return Z_DVAL(dst); + } + case IS_RESOURCE: + case IS_ARRAY: + *failed = true; + return 0.0; + case IS_REFERENCE: + op = Z_REFVAL_P(op); + goto try_again; + default: ZEND_UNREACHABLE(); + } +} + static zend_always_inline zend_string* __zval_get_string_func(const zval *op, bool try) /* {{{ */ { try_again: diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 27aa4fdb0486..153a6cea6b43 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -323,6 +323,7 @@ ZEND_API void ZEND_FASTCALL convert_to_object(zval *op); ZEND_API zend_long ZEND_FASTCALL zval_get_long_func(const zval *op, bool is_strict); ZEND_API zend_long ZEND_FASTCALL zval_try_get_long(const zval *op, bool *failed); ZEND_API double ZEND_FASTCALL zval_get_double_func(const zval *op); +ZEND_API double ZEND_FASTCALL zval_try_get_double_func(const zval *op, bool *failed); ZEND_API zend_string* ZEND_FASTCALL zval_get_string_func(const zval *op); ZEND_API zend_string* ZEND_FASTCALL zval_try_get_string_func(const zval *op); @@ -335,6 +336,13 @@ static zend_always_inline zend_long zval_get_long_ex(const zval *op, bool is_str static zend_always_inline double zval_get_double(const zval *op) { return EXPECTED(Z_TYPE_P(op) == IS_DOUBLE) ? Z_DVAL_P(op) : zval_get_double_func(op); } +static zend_always_inline double zval_try_get_double(const zval *op, bool *failed) { + if (EXPECTED(Z_TYPE_P(op) == IS_DOUBLE)) { + *failed = false; + return Z_DVAL_P(op); + } + return zval_try_get_double_func(op, failed); +} static zend_always_inline zend_string *zval_get_string(const zval *op) { return EXPECTED(Z_TYPE_P(op) == IS_STRING) ? zend_string_copy(Z_STR_P(op)) : zval_get_string_func(op); } diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index 02c286ac486a..1ee84ce5c7a1 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -101,19 +101,16 @@ ZEND_API void zval_ptr_safe_dtor(zval *zval_ptr) ZEND_API void zval_internal_ptr_dtor(zval *zval_ptr) /* {{{ */ { if (Z_REFCOUNTED_P(zval_ptr)) { + ZEND_ASSERT(Z_TYPE_P(zval_ptr) == IS_STRING && "Internal zval's can't be arrays, objects, resources or reference"); zend_refcounted *ref = Z_COUNTED_P(zval_ptr); if (GC_DELREF(ref) == 0) { - if (Z_TYPE_P(zval_ptr) == IS_STRING) { - zend_string *str = (zend_string*)ref; - - CHECK_ZVAL_STRING(str); - ZEND_ASSERT(!ZSTR_IS_INTERNED(str)); - ZEND_ASSERT((GC_FLAGS(str) & IS_STR_PERSISTENT)); - free(str); - } else { - zend_error_noreturn(E_CORE_ERROR, "Internal zval's can't be arrays, objects, resources or reference"); - } + zend_string *str = (zend_string*)ref; + + CHECK_ZVAL_STRING(str); + ZEND_ASSERT(!ZSTR_IS_INTERNED(str)); + ZEND_ASSERT((GC_FLAGS(str) & IS_STR_PERSISTENT)); + free(str); } } } diff --git a/build/gen_stub.php b/build/gen_stub.php index 80115dc97e20..ee1f6914aa28 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -230,6 +230,57 @@ class Context { public array $parsedFiles = []; } +// Headers the generated arginfo file needs to be self-contained, each with the +// preprocessor condition and minimum PHP version its code is guarded by +class HeaderDependencies { + /** @var array> */ + private array $headers = []; + + public function add(string $header, ?string $cond = null, ?int $minPhpVersionId = null): void { + $this->headers[$header][] = [$cond, $minPhpVersionId]; + } + + public function generateCode(): string { + ksort($this->headers); + + $code = ""; + foreach ($this->headers as $header => $guards) { + $conds = []; + $minPhpVersionId = null; + + foreach ($guards as [$cond, $versionId]) { + // An unconditional use overrides any guarded ones + if ($cond === null) { + $conds = null; + } elseif ($conds !== null) { + $conds[$cond] = $cond; + } + + if ($versionId !== null && ($minPhpVersionId === null || $versionId < $minPhpVersionId)) { + $minPhpVersionId = $versionId; + } + } + + $include = "#include \"$header\"\n"; + + if ($conds) { + $cond = count($conds) === 1 + ? reset($conds) + : implode(" || ", array_map(static fn (string $cond): string => "($cond)", $conds)); + $include = "#if $cond\n" . $include . "#endif\n"; + } + + if ($minPhpVersionId !== null) { + $include = "#if (PHP_VERSION_ID >= $minPhpVersionId)\n" . $include . "#endif\n"; + } + + $code .= $include; + } + + return $code; + } +} + class ArrayType extends SimpleType { public function __construct( @@ -2649,7 +2700,7 @@ public function discardInfoForOldPhpVersions(?int $minimumPhpVersionIdCompatibil } /** @param array $allConstInfos */ - public function getDeclaration(array $allConstInfos): string + public function getDeclaration(array $allConstInfos, HeaderDependencies $headerDependencies): string { $type = $this->phpDocType ?? $this->type; $simpleType = $type?->tryToSimpleType(); @@ -2672,15 +2723,17 @@ public function getDeclaration(array $allConstInfos): string if ($this->name instanceof ClassConstName) { $code = $this->getClassConstDeclaration($value); } else { - $code = $this->getGlobalConstDeclaration($value); + $code = $this->getGlobalConstDeclaration($value, $headerDependencies); } $code .= $this->getValueAssertion($value); return $code; } - private function getGlobalConstDeclaration(EvaluatedValue $value): string + private function getGlobalConstDeclaration(EvaluatedValue $value, HeaderDependencies $headerDependencies): string { + $headerDependencies->add("zend_constants.h", $this->cond); + $constName = str_replace('\\', '\\\\', $this->name->__toString()); $constValue = $value->value; $cExpr = $value->getCExpr(); @@ -3226,7 +3279,9 @@ public function __construct( ) {} /** @param array $allConstInfos */ - public function getDeclaration(array $allConstInfos): string { + public function getDeclaration(array $allConstInfos, HeaderDependencies $headerDependencies, ?string $cond = null, ?int $minPhpVersionId = null): string { + $headerDependencies->add("zend_enum.h", $cond, $minPhpVersionId); + $escapedName = addslashes($this->name->case); if ($this->value === null) { return "\n\tzend_enum_add_case_cstr(class_entry, \"$escapedName\", NULL);\n"; @@ -3305,7 +3360,13 @@ public function __construct( * @param array &$declaredStrings Map of string content to * the name of a zend_string already created with that content */ - public function generateCode(string $invocation, string $nameSuffix, array $allConstInfos, ?int $phpVersionIdMinimumCompatibility, array &$declaredStrings = []): string { + public function generateCode(string $invocation, string $nameSuffix, array $allConstInfos, ?int $phpVersionIdMinimumCompatibility, HeaderDependencies $headerDependencies, ?string $cond = null, array &$declaredStrings = []): string { + $headerDependencies->add( + "zend_attributes.h", + $cond, + $phpVersionIdMinimumCompatibility !== null && $phpVersionIdMinimumCompatibility < PHP_80_VERSION_ID ? PHP_80_VERSION_ID : null + ); + $escapedAttributeName = strtr($this->class, '\\', '_'); [$stringInit, $nameCode, $stringRelease] = StringBuilder::getString( "attribute_name_{$escapedAttributeName}_$nameSuffix", @@ -3419,7 +3480,7 @@ public function __construct( ) {} /** @param array $allConstInfos */ - public function getRegistration(array $allConstInfos): string + public function getRegistration(array $allConstInfos, HeaderDependencies $headerDependencies): string { $params = []; foreach ($this->extends as $extends) { @@ -3459,6 +3520,7 @@ public function getRegistration(array $allConstInfos): string $name = addslashes((string) $this->name); $backingType = $this->enumBackingType ? $this->enumBackingType->toTypeCode() : "IS_UNDEF"; + $headerDependencies->add("zend_enum.h", $this->cond, $php81MinimumCompatibility ? null : PHP_81_VERSION_ID); $code .= "\tzend_class_entry *class_entry = zend_register_internal_enum(\"$name\", $backingType, $classMethods);\n"; if (!$flags->isEmpty()) { $code .= $this->getFlagsByPhpVersion()->generateVersionDependentFlagCode("\tclass_entry->ce_flags = %s;\n", $this->phpVersionIdMinimumCompatibility); @@ -3546,11 +3608,11 @@ function (Name $item) { $code .= generateCodeWithConditions( $this->constInfos, '', - static fn (ConstInfo $const): string => $const->getDeclaration($allConstInfos) + static fn (ConstInfo $const): string => $const->getDeclaration($allConstInfos, $headerDependencies) ); foreach ($this->enumCaseInfos as $enumCase) { - $code .= $enumCase->getDeclaration($allConstInfos); + $code .= $enumCase->getDeclaration($allConstInfos, $headerDependencies, $this->cond, $php81MinimumCompatibility ? null : PHP_81_VERSION_ID); } foreach ($this->propertyInfos as $property) { @@ -3576,6 +3638,8 @@ function (Name $item) { "class_{$escapedName}_$key", $allConstInfos, $this->phpVersionIdMinimumCompatibility, + $headerDependencies, + $this->cond, $declaredStrings ); } @@ -3583,19 +3647,19 @@ function (Name $item) { $code .= $php80CondEnd; } - if ($attributeInitializationCode = generateConstantAttributeInitialization($this->constInfos, $allConstInfos, $this->phpVersionIdMinimumCompatibility, $this->cond, $declaredStrings)) { + if ($attributeInitializationCode = generateConstantAttributeInitialization($this->constInfos, $allConstInfos, $this->phpVersionIdMinimumCompatibility, $headerDependencies, $this->cond, $declaredStrings)) { $code .= $php80CondStart; $code .= "\n" . $attributeInitializationCode; $code .= $php80CondEnd; } - if ($attributeInitializationCode = generatePropertyAttributeInitialization($this->propertyInfos, $allConstInfos, $this->phpVersionIdMinimumCompatibility, $declaredStrings)) { + if ($attributeInitializationCode = generatePropertyAttributeInitialization($this->propertyInfos, $allConstInfos, $this->phpVersionIdMinimumCompatibility, $headerDependencies, $this->cond, $declaredStrings)) { $code .= $php80CondStart; $code .= "\n" . $attributeInitializationCode; $code .= $php80CondEnd; } - if ($attributeInitializationCode = generateFunctionAttributeInitialization($this->funcInfos, $allConstInfos, $this->phpVersionIdMinimumCompatibility, $this->cond, $declaredStrings)) { + if ($attributeInitializationCode = generateFunctionAttributeInitialization($this->funcInfos, $allConstInfos, $this->phpVersionIdMinimumCompatibility, $headerDependencies, $this->cond, $declaredStrings)) { $code .= $php80CondStart; $code .= "\n" . $attributeInitializationCode; $code .= $php80CondEnd; @@ -4562,11 +4626,11 @@ private static function handlePreprocessorConditions(array &$conds, Stmt $stmt): } /** @param array $allConstInfos */ - public function generateClassEntryCode(array $allConstInfos): string { + public function generateClassEntryCode(array $allConstInfos, HeaderDependencies $headerDependencies): string { $code = ""; foreach ($this->classInfos as $class) { - $code .= "\n" . $class->getRegistration($allConstInfos); + $code .= "\n" . $class->getRegistration($allConstInfos, $headerDependencies); } return $code; @@ -4599,6 +4663,7 @@ public function generateArgInfoCode( array $allConstInfos, string $stubHash ): array { + $headerDependencies = new HeaderDependencies(); $code = ""; $generatedFuncInfos = []; @@ -4662,8 +4727,8 @@ function (FuncInfo $funcInfo) use (&$generatedFunctionDeclarations) { if ($this->generateClassEntries) { $declaredStrings = []; - $attributeInitializationCode = generateFunctionAttributeInitialization($this->funcInfos, $allConstInfos, $this->getMinimumPhpVersionIdCompatibility(), null, $declaredStrings); - $attributeInitializationCode .= generateGlobalConstantAttributeInitialization($this->constInfos, $allConstInfos, $this->getMinimumPhpVersionIdCompatibility(), null, $declaredStrings); + $attributeInitializationCode = generateFunctionAttributeInitialization($this->funcInfos, $allConstInfos, $this->getMinimumPhpVersionIdCompatibility(), $headerDependencies, null, $declaredStrings); + $attributeInitializationCode .= generateGlobalConstantAttributeInitialization($this->constInfos, $allConstInfos, $this->getMinimumPhpVersionIdCompatibility(), $headerDependencies, null, $declaredStrings); if ($attributeInitializationCode) { if (!$php80MinimumCompatibility) { $attributeInitializationCode = "\n#if (PHP_VERSION_ID >= " . PHP_80_VERSION_ID . ")" . $attributeInitializationCode . "#endif\n"; @@ -4677,7 +4742,7 @@ function (FuncInfo $funcInfo) use (&$generatedFunctionDeclarations) { $code .= generateCodeWithConditions( $this->constInfos, '', - static fn (ConstInfo $constInfo): string => $constInfo->getDeclaration($allConstInfos) + static fn (ConstInfo $constInfo): string => $constInfo->getDeclaration($allConstInfos, $headerDependencies) ); if ($attributeInitializationCode !== "" && $this->constInfos) { @@ -4688,7 +4753,7 @@ function (FuncInfo $funcInfo) use (&$generatedFunctionDeclarations) { $code .= "}\n"; } - $code .= $this->generateClassEntryCode($allConstInfos); + $code .= $this->generateClassEntryCode($allConstInfos, $headerDependencies); } $hasDeclFile = false; @@ -4705,9 +4770,12 @@ function (FuncInfo $funcInfo) use (&$generatedFunctionDeclarations) { . "#endif /* {$headerName} */\n"; } + $includeCode = $headerDependencies->generateCode(); + $code = "/* This is a generated file, edit {$stubFilenameWithoutExtension}.stub.php instead.\n" . " * Stub hash: $stubHash" . ($hasDeclFile ? "\n * Has decl header: yes */\n" : " */\n") + . ($includeCode !== "" ? "\n" . $includeCode : "") . $code; return [$code, $declCode]; @@ -5378,11 +5446,11 @@ function generateFunctionEntries(?Name $className, array $funcInfos, ?string $co * @param array &$declaredStrings Map of string content to * the name of a zend_string already created with that content */ -function generateFunctionAttributeInitialization(iterable $funcInfos, array $allConstInfos, ?int $phpVersionIdMinimumCompatibility, ?string $parentCond = null, array &$declaredStrings = []): string { +function generateFunctionAttributeInitialization(iterable $funcInfos, array $allConstInfos, ?int $phpVersionIdMinimumCompatibility, HeaderDependencies $headerDependencies, ?string $parentCond = null, array &$declaredStrings = []): string { return generateCodeWithConditions( $funcInfos, "", - static function (FuncInfo $funcInfo) use ($allConstInfos, $phpVersionIdMinimumCompatibility, &$declaredStrings) { + static function (FuncInfo $funcInfo) use ($allConstInfos, $phpVersionIdMinimumCompatibility, $headerDependencies, $parentCond, &$declaredStrings) { $code = null; if ($funcInfo->name instanceof MethodName) { @@ -5406,6 +5474,8 @@ static function (FuncInfo $funcInfo) use ($allConstInfos, $phpVersionIdMinimumCo "func_" . $funcInfo->name->getNameForAttributes() . "_$key", $allConstInfos, $phpVersionIdMinimumCompatibility, + $headerDependencies, + $funcInfo->cond ?? $parentCond, $useDeclared ); } @@ -5417,6 +5487,8 @@ static function (FuncInfo $funcInfo) use ($allConstInfos, $phpVersionIdMinimumCo "func_{$funcInfo->name->getNameForAttributes()}_arg{$index}_$key", $allConstInfos, $phpVersionIdMinimumCompatibility, + $headerDependencies, + $funcInfo->cond ?? $parentCond, $useDeclared ); } @@ -5438,6 +5510,7 @@ function generateGlobalConstantAttributeInitialization( iterable $constInfos, array $allConstInfos, ?int $phpVersionIdMinimumCompatibility, + HeaderDependencies $headerDependencies, ?string $parentCond = null, array &$declaredStrings = [] ): string { @@ -5448,7 +5521,7 @@ function generateGlobalConstantAttributeInitialization( $code = generateCodeWithConditions( $constInfos, "", - static function (ConstInfo $constInfo) use ($allConstInfos, $isConditional, &$declaredStrings) { + static function (ConstInfo $constInfo) use ($allConstInfos, $isConditional, $headerDependencies, $parentCond, &$declaredStrings) { $code = ""; if ($constInfo->attributes === []) { @@ -5477,6 +5550,8 @@ static function (ConstInfo $constInfo) use ($allConstInfos, $isConditional, &$de $constVarName . "_$key", $allConstInfos, PHP_85_VERSION_ID, + $headerDependencies, + $constInfo->cond ?? $parentCond, $useDeclared ); } @@ -5501,13 +5576,14 @@ function generateConstantAttributeInitialization( iterable $constInfos, array $allConstInfos, ?int $phpVersionIdMinimumCompatibility, + HeaderDependencies $headerDependencies, ?string $parentCond = null, array &$declaredStrings = [] ): string { return generateCodeWithConditions( $constInfos, "", - static function (ConstInfo $constInfo) use ($allConstInfos, $phpVersionIdMinimumCompatibility, &$declaredStrings) { + static function (ConstInfo $constInfo) use ($allConstInfos, $phpVersionIdMinimumCompatibility, $headerDependencies, $parentCond, &$declaredStrings) { $code = null; // Make sure we don't try and use strings that might only be @@ -5524,6 +5600,8 @@ static function (ConstInfo $constInfo) use ($allConstInfos, $phpVersionIdMinimum "const_" . $constInfo->name->getDeclarationName() . "_$key", $allConstInfos, $phpVersionIdMinimumCompatibility, + $headerDependencies, + $constInfo->cond ?? $parentCond, $useDeclared ); } @@ -5544,6 +5622,8 @@ function generatePropertyAttributeInitialization( iterable $propertyInfos, array $allConstInfos, ?int $phpVersionIdMinimumCompatibility, + HeaderDependencies $headerDependencies, + ?string $cond, array &$declaredStrings ): string { $code = ""; @@ -5554,6 +5634,8 @@ function generatePropertyAttributeInitialization( "property_" . $propertyInfo->name->getDeclarationName() . "_" . $key, $allConstInfos, $phpVersionIdMinimumCompatibility, + $headerDependencies, + $cond, $declaredStrings ); } diff --git a/ext/calendar/calendar_arginfo.h b/ext/calendar/calendar_arginfo.h index 9a05561a3bbd..c35913d63e67 100644 --- a/ext/calendar/calendar_arginfo.h +++ b/ext/calendar/calendar_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit calendar.stub.php instead. * Stub hash: f45116785b01842f56ff923a54f65ab839b3dd61 */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cal_days_in_month, 0, 3, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, calendar, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0) diff --git a/ext/com_dotnet/com_extension_arginfo.h b/ext/com_dotnet/com_extension_arginfo.h index d0fcf6645717..805719078124 100644 --- a/ext/com_dotnet/com_extension_arginfo.h +++ b/ext/com_dotnet/com_extension_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit com_extension.stub.php instead. * Stub hash: 9b2eea541946c291eb002ee98997f3dcad8bdfce */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_set, 0, 2, IS_VOID, 0) ZEND_ARG_OBJ_INFO(0, variant, variant, 0) ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) diff --git a/ext/curl/curl_arginfo.h b/ext/curl/curl_arginfo.h index ea354d16df56..c38d581cb3cd 100644 --- a/ext/curl/curl_arginfo.h +++ b/ext/curl/curl_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit curl.stub.php instead. * Stub hash: 5da31d6790f9db408cac4aed3f81f7affb2849a6 */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_close, 0, 1, IS_VOID, 0) ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0) ZEND_END_ARG_INFO() diff --git a/ext/curl/interface.c b/ext/curl/interface.c index db3dd01b5505..55bcebbe7113 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -44,7 +44,6 @@ # pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif -#include "zend_attributes.h" #include "curl_arginfo.h" ZEND_DECLARE_MODULE_GLOBALS(curl) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 27664623c6b9..1795d41b27ce 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -19,7 +19,6 @@ #include "ext/standard/php_versioning.h" #include "php_date.h" #include "php_time.h" -#include "zend_attributes.h" #include "zend_interfaces.h" #include "zend_exceptions.h" #include "lib/timelib.h" diff --git a/ext/date/php_date_arginfo.h b/ext/date/php_date_arginfo.h index db2b4d5ea9e1..ce72ee903d96 100644 --- a/ext/date/php_date_arginfo.h +++ b/ext/date/php_date_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit php_date.stub.php instead. * Stub hash: 8556e1b5f05ae9f78200f05f01d9f8e815cba49d */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtotime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, datetime, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, baseTimestamp, IS_LONG, 1, "null") diff --git a/ext/dba/dba_arginfo.h b/ext/dba/dba_arginfo.h index 22978b68fc7b..1a2f230e669c 100644 --- a/ext/dba/dba_arginfo.h +++ b/ext/dba/dba_arginfo.h @@ -1,6 +1,10 @@ /* This is a generated file, edit dba.stub.php instead. * Stub hash: d7ff53b73d3921c41ffd8279ea724bcd3a6d8542 */ +#if defined(DBA_LMDB) +#include "zend_constants.h" +#endif + ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_dba_popen, 0, 2, Dba\\Connection, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0) diff --git a/ext/dl_test/dl_test_arginfo.h b/ext/dl_test/dl_test_arginfo.h index b3fcab818d2f..800d4fe8dd35 100644 --- a/ext/dl_test/dl_test_arginfo.h +++ b/ext/dl_test/dl_test_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit dl_test.stub.php instead. * Stub hash: 3c47a0da41b4548eb68c4124bd54cbac22f60c01 */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dl_test_test1, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index ebbe4a2bf441..845507924c1e 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -20,8 +20,6 @@ #include "php.h" #if defined(HAVE_LIBXML) && defined(HAVE_DOM) -#include "zend_enum.h" -#include "zend_attributes.h" #include "php_dom.h" #include "obj_map.h" #include "nodelist.h" diff --git a/ext/dom/php_dom_arginfo.h b/ext/dom/php_dom_arginfo.h index 0274186380dc..6a15f911e610 100644 --- a/ext/dom/php_dom_arginfo.h +++ b/ext/dom/php_dom_arginfo.h @@ -2,6 +2,10 @@ * Stub hash: 8d7713834c924709155ed7acc554c9efc55e96c1 * Has decl header: yes */ +#include "zend_attributes.h" +#include "zend_constants.h" +#include "zend_enum.h" + ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_dom_import_simplexml, 0, 1, DOMAttr|DOMElement, 0) ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0) ZEND_END_ARG_INFO() diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index a109c24062f0..d84bd9a94256 100644 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -20,7 +20,6 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "Zend/zend_attributes.h" #include "Zend/zend_exceptions.h" #include #include "php_enchant.h" diff --git a/ext/enchant/enchant_arginfo.h b/ext/enchant/enchant_arginfo.h index 39e7e577bf9a..d60fe4dde0a1 100644 --- a/ext/enchant/enchant_arginfo.h +++ b/ext/enchant/enchant_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit enchant.stub.php instead. * Stub hash: 31974eb901477da53ede7476953d461d32f772ba */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_enchant_broker_init, 0, 0, EnchantBroker, MAY_BE_FALSE) ZEND_END_ARG_INFO() diff --git a/ext/exif/exif_arginfo.h b/ext/exif/exif_arginfo.h index 4821fd7fbafd..f80f04f0ed2e 100644 --- a/ext/exif/exif_arginfo.h +++ b/ext/exif/exif_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit exif.stub.php instead. * Stub hash: 633b2db018fa1453845a854a6361f11f107f4653 */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_exif_tagname, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index 4c5c0e88c5ce..36247b7196f4 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -29,7 +29,6 @@ #include "php_ini.h" #include "ext/standard/info.h" #include "ext/standard/file.h" /* needed for context stuff */ -#include "Zend/zend_attributes.h" #include "Zend/zend_exceptions.h" #include "php_fileinfo.h" #include "fileinfo_arginfo.h" diff --git a/ext/fileinfo/fileinfo_arginfo.h b/ext/fileinfo/fileinfo_arginfo.h index 4dd001ca05b6..21b1c452d611 100644 --- a/ext/fileinfo/fileinfo_arginfo.h +++ b/ext/fileinfo/fileinfo_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit fileinfo.stub.php instead. * Stub hash: 311d1049e32af017b44e260a00f13830714b1e96 */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_finfo_open, 0, 0, finfo, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, magic_database, IS_STRING, 1, "null") diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 30821411a326..91cb7c092af7 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -25,7 +25,6 @@ ZEND_DECLARE_MODULE_GLOBALS(filter) -#include "zend_attributes.h" #include "filter_private.h" #include "filter_arginfo.h" #include "zend_exceptions.h" diff --git a/ext/filter/filter_arginfo.h b/ext/filter/filter_arginfo.h index 891647362997..6d9ac902e2b5 100644 --- a/ext/filter/filter_arginfo.h +++ b/ext/filter/filter_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit filter.stub.php instead. * Stub hash: bd421586fdc068c456415b597d718787eb140517 */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_filter_has_var, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, input_type, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, var_name, IS_STRING, 0) diff --git a/ext/ftp/ftp_arginfo.h b/ext/ftp/ftp_arginfo.h index edb0b4b8a91b..420fc3553ea6 100644 --- a/ext/ftp/ftp_arginfo.h +++ b/ext/ftp/ftp_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit ftp.stub.php instead. * Stub hash: 29606d7114a0698b8ae231173a624b17c196ffec */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_ftp_connect, 0, 1, FTP\\Connection, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, port, IS_LONG, 0, "21") diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index 56938459bb33..312f87c2781b 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -27,7 +27,6 @@ #include "ext/standard/info.h" #include "ext/standard/file.h" -#include "Zend/zend_attributes.h" #include "Zend/zend_exceptions.h" #include "php_ftp.h" diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 6a056287c451..8d65d12aef65 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -32,7 +32,6 @@ #include "ext/standard/info.h" #include "php_open_temporary_file.h" #include "php_memory_streams.h" -#include "zend_attributes.h" #include "zend_object_handlers.h" #ifdef HAVE_SYS_WAIT_H diff --git a/ext/gd/gd_arginfo.h b/ext/gd/gd_arginfo.h index 978a7744ec28..ee28379b30c9 100644 --- a/ext/gd/gd_arginfo.h +++ b/ext/gd/gd_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit gd.stub.php instead. * Stub hash: 21f8a978b8e54da880315dd9dfeecaf0f7d5593b */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gd_info, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() diff --git a/ext/gmp/gmp_arginfo.h b/ext/gmp/gmp_arginfo.h index dddaa7e528c9..038ce3890158 100644 --- a/ext/gmp/gmp_arginfo.h +++ b/ext/gmp/gmp_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit gmp.stub.php instead. * Stub hash: 743a4be1078abfa29294336564126ace8c194cbe */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_gmp_init, 0, 1, GMP, 0) ZEND_ARG_TYPE_MASK(0, num, MAY_BE_LONG|MAY_BE_STRING, NULL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, base, IS_LONG, 0, "0") diff --git a/ext/hash/hash_arginfo.h b/ext/hash/hash_arginfo.h index 798bf66dc33c..bc213d02bfbb 100644 --- a/ext/hash/hash_arginfo.h +++ b/ext/hash/hash_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit hash.stub.php instead. * Stub hash: b0fe91da9b0469b44a9647b774b9b00498592e30 */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash, 0, 2, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) diff --git a/ext/iconv/iconv_arginfo.h b/ext/iconv/iconv_arginfo.h index fd23b7113cef..d85eaf1de005 100644 --- a/ext/iconv/iconv_arginfo.h +++ b/ext/iconv/iconv_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit iconv.stub.php instead. * Stub hash: 4367fa431d3e4814e42d9aa514c10cae1d842d8f */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_strlen, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") diff --git a/ext/intl/collator/collator_arginfo.h b/ext/intl/collator/collator_arginfo.h index 4367d12be4f7..bf8345cd8be0 100644 --- a/ext/intl/collator/collator_arginfo.h +++ b/ext/intl/collator/collator_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit collator.stub.php instead. * Stub hash: cbe3c5f4c35d93f90c3e7164bdfc4e2fefc88c83 */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0) ZEND_END_ARG_INFO() diff --git a/ext/intl/common/common_arginfo.h b/ext/intl/common/common_arginfo.h index 2a15cccab892..2ca89fe96037 100644 --- a/ext/intl/common/common_arginfo.h +++ b/ext/intl/common/common_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit common.stub.php instead. * Stub hash: 9ed8bfc955a557c02171ec12b4634c60c6fb513e */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_IntlIterator_current, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() diff --git a/ext/intl/formatter/formatter_arginfo.h b/ext/intl/formatter/formatter_arginfo.h index d3d29f70168d..fb3e3619ad50 100644 --- a/ext/intl/formatter/formatter_arginfo.h +++ b/ext/intl/formatter/formatter_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit formatter.stub.php instead. * Stub hash: d886941aa76837aed1da08845dbaff9442107203 */ +#include "zend_attributes.h" + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter___construct, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, style, IS_LONG, 0) diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 7bc599728e68..ce938b915595 100644 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -75,7 +75,6 @@ #include "php_ini.h" -#include "zend_attributes.h" #include "php_intl_arginfo.h" diff --git a/ext/intl/php_intl_arginfo.h b/ext/intl/php_intl_arginfo.h index 00de5986f1ef..f46192618b91 100644 --- a/ext/intl/php_intl_arginfo.h +++ b/ext/intl/php_intl_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit php_intl.stub.php instead. * Stub hash: f94e7c9cc372878f1f8bd0e948092ea72076e687 */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_create_instance, 0, 0, IntlCalendar, 1) ZEND_ARG_OBJ_TYPE_MASK(0, timezone, IntlTimeZone|DateTimeZone, MAY_BE_STRING|MAY_BE_NULL, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, locale, IS_STRING, 1, "null") diff --git a/ext/json/json_arginfo.h b/ext/json/json_arginfo.h index 87ba9cce3afd..01ebf40727c3 100644 --- a/ext/json/json_arginfo.h +++ b/ext/json/json_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit json.stub.php instead. * Stub hash: 0ceb50047401c4b9e878c09cc518eacc274f7fff */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_json_encode, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 7a089625aa48..3e03df4c3375 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -26,7 +26,6 @@ #include "php.h" #include "php_ini.h" -#include "Zend/zend_attributes.h" #include diff --git a/ext/ldap/ldap_arginfo.h b/ext/ldap/ldap_arginfo.h index 8f5e7e34ba32..cea79a70d902 100644 --- a/ext/ldap/ldap_arginfo.h +++ b/ext/ldap/ldap_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit ldap.stub.php instead. * Stub hash: 0dde8fd813f43640dee842c03365d7431858a56d */ +#include "zend_attributes.h" +#include "zend_constants.h" + #if defined(HAVE_ORALDAP) ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_ldap_connect, 0, 0, LDAP\\Connection, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, uri, IS_STRING, 1, "null") diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 1f3d7c4d8789..42cd0ceb9711 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -20,7 +20,6 @@ #include "php.h" #include "SAPI.h" -#include "zend_attributes.h" #include "zend_variables.h" #include "ext/standard/info.h" #include "ext/standard/file.h" diff --git a/ext/libxml/libxml_arginfo.h b/ext/libxml/libxml_arginfo.h index 24459da5c0cb..2d77e2498117 100644 --- a/ext/libxml/libxml_arginfo.h +++ b/ext/libxml/libxml_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit libxml.stub.php instead. * Stub hash: 6dceb619736a3de55b84609a9e3aeb13405bbfde */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_set_streams_context, 0, 1, IS_VOID, 0) ZEND_ARG_INFO(0, context) ZEND_END_ARG_INFO() diff --git a/ext/mbstring/mbstring_arginfo.h b/ext/mbstring/mbstring_arginfo.h index 7426387b3386..593589b66db1 100644 --- a/ext/mbstring/mbstring_arginfo.h +++ b/ext/mbstring/mbstring_arginfo.h @@ -1,6 +1,11 @@ /* This is a generated file, edit mbstring.stub.php instead. * Stub hash: f02c317efd6814f902ea75c9d222893713546845 */ +#if defined(HAVE_MBREGEX) +#include "zend_attributes.h" +#endif +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_language, 0, 0, MAY_BE_STRING|MAY_BE_BOOL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, language, IS_STRING, 1, "null") ZEND_END_ARG_INFO() diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index e6f876433571..23fd70247fe4 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -26,7 +26,6 @@ #include "php_mysqli.h" #include "php_mysqli_structs.h" #include "mysqli_priv.h" -#include "zend_attributes.h" #include "zend_exceptions.h" #include "ext/spl/spl_exceptions.h" #include "zend_interfaces.h" diff --git a/ext/mysqli/mysqli_arginfo.h b/ext/mysqli/mysqli_arginfo.h index 32588d45e268..dac51d7f4959 100644 --- a/ext/mysqli/mysqli_arginfo.h +++ b/ext/mysqli/mysqli_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit mysqli.stub.php instead. * Stub hash: f5327d48b275a5358b740232281478c83bb8a3db */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_affected_rows, 0, 1, MAY_BE_LONG|MAY_BE_STRING) ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0) ZEND_END_ARG_INFO() diff --git a/ext/odbc/odbc_arginfo.h b/ext/odbc/odbc_arginfo.h index badd1400148d..958917d60012 100644 --- a/ext/odbc/odbc_arginfo.h +++ b/ext/odbc/odbc_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit odbc.stub.php instead. * Stub hash: f9ba28767b256dbcea087a65aa4bb5f5b509d6f3 */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_close_all, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 3e7cdbb01b64..5a1a20e10686 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -22,7 +22,6 @@ #include "php.h" #include "php_globals.h" -#include "zend_attributes.h" #include "ext/standard/info.h" #include "Zend/zend_interfaces.h" diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 80c0a8bab073..c8ca39ad0aab 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -26,7 +26,6 @@ #include "php_ini.h" #include "php_openssl.h" #include "php_openssl_backend.h" -#include "zend_attributes.h" #include "zend_exceptions.h" /* PHP Includes */ diff --git a/ext/openssl/openssl_arginfo.h b/ext/openssl/openssl_arginfo.h index b1742dcb05f8..c7fdf82c7861 100644 --- a/ext/openssl/openssl_arginfo.h +++ b/ext/openssl/openssl_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit openssl.stub.php instead. * Stub hash: 7cad995b734d69f98d489edb97a7878a4ea8f47e */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) ZEND_ARG_TYPE_INFO(0, output_filename, IS_STRING, 0) diff --git a/ext/openssl/openssl_pwhash_arginfo.h b/ext/openssl/openssl_pwhash_arginfo.h index 2e78aec41afb..dead1e12c8a6 100644 --- a/ext/openssl/openssl_pwhash_arginfo.h +++ b/ext/openssl/openssl_pwhash_arginfo.h @@ -1,6 +1,10 @@ /* This is a generated file, edit openssl_pwhash.stub.php instead. * Stub hash: 23ee957ba4945be3a21db58051e548729c3ff44e */ +#if defined(HAVE_OPENSSL_ARGON2) +#include "zend_constants.h" +#endif + static void register_openssl_pwhash_symbols(int module_number) { #if defined(HAVE_OPENSSL_ARGON2) diff --git a/ext/pcntl/pcntl_arginfo.h b/ext/pcntl/pcntl_arginfo.h index a0ba6f712e5f..a9d6bb010e29 100644 --- a/ext/pcntl/pcntl_arginfo.h +++ b/ext/pcntl/pcntl_arginfo.h @@ -2,6 +2,9 @@ * Stub hash: ec6306e93fad6d127ff880fc01736ac287619cf7 * Has decl header: yes */ +#include "zend_constants.h" +#include "zend_enum.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_fork, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/ext/pcre/php_pcre_arginfo.h b/ext/pcre/php_pcre_arginfo.h index 0d22c2414fb8..2f64048decff 100644 --- a/ext/pcre/php_pcre_arginfo.h +++ b/ext/pcre/php_pcre_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit php_pcre.stub.php instead. * Stub hash: 63de1d37ab303e1d6af7c96eaeeba09d7f35d116 */ +#include "zend_constants.h" + 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) ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0) diff --git a/ext/pdo/pdo_dbh_arginfo.h b/ext/pdo/pdo_dbh_arginfo.h index 90da5123a487..1e4cc4328b9b 100644 --- a/ext/pdo/pdo_dbh_arginfo.h +++ b/ext/pdo/pdo_dbh_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit pdo_dbh.stub.php instead. * Stub hash: 006be61b2c519e7d9ca997a7f12135eb3e0f3500 */ +#include "zend_attributes.h" + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, dsn, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, username, IS_STRING, 1, "null") diff --git a/ext/pdo_odbc/pdo_odbc_arginfo.h b/ext/pdo_odbc/pdo_odbc_arginfo.h index 9492f8c374e0..b9b2fff674c7 100644 --- a/ext/pdo_odbc/pdo_odbc_arginfo.h +++ b/ext/pdo_odbc/pdo_odbc_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit pdo_odbc.stub.php instead. * Stub hash: 9136c911494c9e3462c49b3e58f4bcc15ebb2a9c */ +#include "zend_constants.h" + static void register_pdo_odbc_symbols(int module_number) { REGISTER_STRING_CONSTANT("PDO_ODBC_TYPE", PDO_ODBC_TYPE, CONST_PERSISTENT); diff --git a/ext/pdo_pgsql/config.m4 b/ext/pdo_pgsql/config.m4 index 406f08465e90..b6e1ec6edb8f 100644 --- a/ext/pdo_pgsql/config.m4 +++ b/ext/pdo_pgsql/config.m4 @@ -25,6 +25,12 @@ if test "$PHP_PDO_PGSQL" != "no"; then or later).])],, [$PGSQL_LIBS]) + PHP_CHECK_LIBRARY([pq], [PQclosePortal], + [AC_DEFINE([HAVE_PQCLOSEPORTAL], [1], + [Define to 1 if libpq has the 'PQclosePortal' function (PostgreSQL 17 + or later).])],, + [$PGSQL_LIBS]) + old_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $PGSQL_CFLAGS" diff --git a/ext/pdo_pgsql/config.w32 b/ext/pdo_pgsql/config.w32 index 87ad0a661b53..5739e3060efb 100644 --- a/ext/pdo_pgsql/config.w32 +++ b/ext/pdo_pgsql/config.w32 @@ -10,6 +10,10 @@ if (PHP_PDO_PGSQL != "no") { AC_DEFINE('HAVE_PG_RESULT_MEMORY_SIZE', 1, "Define to 1 if libpq has the 'PQresultMemorySize' function (PostgreSQL 12 or later)."); AC_DEFINE('HAVE_PDO_PGSQL', 1, "Define to 1 if the PHP extension 'pdo_pgsql' is available."); + if (GREP_HEADER("libpq-fe.h", "PQclosePortal", PHP_PDO_PGSQL + "\\include;" + PHP_PHP_BUILD + "\\include\\pgsql;" + PHP_PHP_BUILD + "\\include\\libpq;")) { + AC_DEFINE('HAVE_PQCLOSEPORTAL', 1, "Define to 1 if libpq has the 'PQclosePortal' function (PostgreSQL 17 or later)."); + } + ADD_EXTENSION_DEP('pdo_pgsql', 'pdo'); ADD_MAKEFILE_FRAGMENT(); } else { diff --git a/ext/pdo_pgsql/pdo_pgsql_arginfo.h b/ext/pdo_pgsql/pdo_pgsql_arginfo.h index 80127659a567..2178d3086f65 100644 --- a/ext/pdo_pgsql/pdo_pgsql_arginfo.h +++ b/ext/pdo_pgsql/pdo_pgsql_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit pdo_pgsql.stub.php instead. * Stub hash: 3f62627e74ad08de8e95c9862e3d209ae63d971a */ +#include "zend_attributes.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Pdo_Pgsql_escapeIdentifier, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0) ZEND_END_ARG_INFO() diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index f6f87139958c..2f0725534937 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -73,6 +73,47 @@ static bool pgsql_result_status_ok(ExecStatusType status) } } +#ifndef HAVE_PQCLOSEPORTAL +static bool pdo_pgsql_try_cmd(const char *cmd, const char *ok_sqlstate, pdo_pgsql_db_handle *H) +{ + bool result = false; + char *q = NULL; + PGresult *res = NULL; + + PGTransactionStatusType status = PQtransactionStatus(H->server); + + switch (status) { + case PQTRANS_ACTIVE: + case PQTRANS_INERROR: + break; + case PQTRANS_INTRANS: /* failure must not abort the caller's transaction */ + /* PQexec does not run the statements following a failed one */ + spprintf(&q, 0, "SAVEPOINT pdo_pgsql_savepoint; %s; RELEASE SAVEPOINT pdo_pgsql_savepoint;", cmd); + res = PQexec(H->server, q); + + if (PQresultStatus(res) != PGRES_COMMAND_OK) { + PQclear(PQexec(H->server, "ROLLBACK TO SAVEPOINT pdo_pgsql_savepoint; RELEASE SAVEPOINT pdo_pgsql_savepoint")); + } + + break; + default: + res = PQexec(H->server, cmd); + } + + if (PQresultStatus(res) == PGRES_COMMAND_OK) { + result = true; + } else if (res) { + const char *sqlstate = pdo_pgsql_sqlstate(res); + + result = sqlstate && !strcmp(sqlstate, ok_sqlstate); + } + + if (q) efree(q); + if (res) PQclear(res); + + return result; +} +#endif static void pgsql_stmt_finish(pdo_pgsql_stmt *S, int fin_mode) @@ -193,15 +234,16 @@ static int pgsql_stmt_dtor(pdo_stmt_t *stmt) } if (S->cursor_name) { - if (server_obj_usable) { + if (S->is_cursor_declared && server_obj_usable) { pdo_pgsql_db_handle *H = S->H; - char *q = NULL; - PGresult *res; - +#ifndef HAVE_PQCLOSEPORTAL + char *q; spprintf(&q, 0, "CLOSE %s", S->cursor_name); - res = PQexec(H->server, q); + pdo_pgsql_try_cmd(q, "34000", H); /* 34000: invalid_cursor_name */ efree(q); - if (res) PQclear(res); +#else + PQclear(PQclosePortal(H->server, S->cursor_name)); +#endif } efree(S->cursor_name); S->cursor_name = NULL; @@ -241,10 +283,25 @@ static int pgsql_stmt_execute(pdo_stmt_t *stmt) if (S->cursor_name) { char *q = NULL; - if (S->is_prepared) { + if (S->is_cursor_declared) { +#ifndef HAVE_PQCLOSEPORTAL spprintf(&q, 0, "CLOSE %s", S->cursor_name); - PQclear(PQexec(H->server, q)); + + /* 34000: invalid_cursor_name */ + if (pdo_pgsql_try_cmd(q, "34000", H)) { + S->is_cursor_declared = false; + } + efree(q); +#else + PGresult *res = PQclosePortal(H->server, S->cursor_name); + + if (PQresultStatus(res) == PGRES_COMMAND_OK) { + S->is_cursor_declared = false; + } + + PQclear(res); +#endif } spprintf(&q, 0, "DECLARE %s SCROLL CURSOR WITH HOLD FOR %s", S->cursor_name, ZSTR_VAL(stmt->active_query_string)); @@ -260,7 +317,7 @@ static int pgsql_stmt_execute(pdo_stmt_t *stmt) PQclear(S->result); /* the cursor was declared correctly */ - S->is_prepared = true; + S->is_cursor_declared = true; /* fetch to be able to get the number of tuples later, but don't advance the cursor pointer */ spprintf(&q, 0, "FETCH FORWARD 0 FROM %s", S->cursor_name); diff --git a/ext/pdo_pgsql/php_pdo_pgsql_int.h b/ext/pdo_pgsql/php_pdo_pgsql_int.h index a9a09a24b707..dc71d5ae7a5f 100644 --- a/ext/pdo_pgsql/php_pdo_pgsql_int.h +++ b/ext/pdo_pgsql/php_pdo_pgsql_int.h @@ -69,6 +69,7 @@ struct pdo_pgsql_stmt { int current_row; zend_long chunk_size; bool is_prepared; + bool is_cursor_declared; bool is_unbuffered; bool is_running_unbuffered; }; diff --git a/ext/pdo_pgsql/tests/cursor_scroll_close_failed_before_redeclare.phpt b/ext/pdo_pgsql/tests/cursor_scroll_close_failed_before_redeclare.phpt new file mode 100644 index 000000000000..1877b0be1390 --- /dev/null +++ b/ext/pdo_pgsql/tests/cursor_scroll_close_failed_before_redeclare.phpt @@ -0,0 +1,44 @@ +--TEST-- +PDO PgSQL PDO::CURSOR_SCROLL keeps track of a held cursor when the CLOSE before a re-declare fails +--EXTENSIONS-- +pdo_pgsql +--SKIPIF-- + +--FILE-- +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + +$stmt = $db->prepare('SELECT CAST(:v AS int)', [PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL]); +$stmt->execute([':v' => '1']); + +$db->beginTransaction(); + +try { + $db->exec('SELECT 1 / 0'); +} catch (PDOException $e) { + echo $e::class, ': ', $e->getCode(), PHP_EOL; +} + +try { + $stmt->execute([':v' => '2']); +} catch (PDOException $e) { + echo $e::class, ': ', $e->getCode(), PHP_EOL; +} + +$db->rollBack(); +unset($stmt); + +var_dump($db->query("SELECT count(*) FROM pg_cursors WHERE name LIKE 'pdo\_crsr\_%'")->fetchColumn()); + +?> +--EXPECT-- +PDOException: 22012 +PDOException: 25P02 +string(1) "0" diff --git a/ext/pdo_pgsql/tests/cursor_scroll_discard_all.phpt b/ext/pdo_pgsql/tests/cursor_scroll_discard_all.phpt new file mode 100644 index 000000000000..216766ddb9cf --- /dev/null +++ b/ext/pdo_pgsql/tests/cursor_scroll_discard_all.phpt @@ -0,0 +1,37 @@ +--TEST-- +PDO PgSQL PDO::CURSOR_SCROLL cursor destroyed by DISCARD ALL does not break the transaction +--EXTENSIONS-- +pdo_pgsql +--SKIPIF-- + +--FILE-- +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + +$stmt = $db->prepare('SELECT 1', [PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL]); +$stmt->execute(); + +/* a connection pooler issues this when handing the connection back */ +$db->exec('DISCARD ALL'); + +$db->beginTransaction(); + +unset($stmt); + +echo $db->query('SELECT 2')->fetchColumn(), PHP_EOL; + +$db->rollBack(); + +echo 'Done', PHP_EOL; + +?> +--EXPECT-- +2 +Done diff --git a/ext/pdo_pgsql/tests/cursor_scroll_failed_redeclare.phpt b/ext/pdo_pgsql/tests/cursor_scroll_failed_redeclare.phpt new file mode 100644 index 000000000000..a836294e03cb --- /dev/null +++ b/ext/pdo_pgsql/tests/cursor_scroll_failed_redeclare.phpt @@ -0,0 +1,37 @@ +--TEST-- +PDO PgSQL PDO::CURSOR_SCROLL sends no CLOSE after a failed re-declare +--EXTENSIONS-- +pdo_pgsql +--SKIPIF-- + +--FILE-- +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + +$stmt = $db->prepare('SELECT CAST(:v AS int)', [PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL]); +$stmt->execute([':v' => '1']); + +try { + $stmt->execute([':v' => 'not an int']); +} catch (PDOException $e) { + echo $e::class, ': ', $e->getCode(), PHP_EOL; +} + +$db->beginTransaction(); +unset($stmt); + +$db->exec('SELECT 2'); + +echo 'Done', PHP_EOL; + +?> +--EXPECT-- +PDOException: 22P02 +Done diff --git a/ext/pdo_pgsql/tests/cursor_scroll_reexecute_after_rollback.phpt b/ext/pdo_pgsql/tests/cursor_scroll_reexecute_after_rollback.phpt new file mode 100644 index 000000000000..e434d74fdda3 --- /dev/null +++ b/ext/pdo_pgsql/tests/cursor_scroll_reexecute_after_rollback.phpt @@ -0,0 +1,40 @@ +--TEST-- +PDO PgSQL PDO::CURSOR_SCROLL re-execute after a rollback destroyed the cursor +--EXTENSIONS-- +pdo_pgsql +--SKIPIF-- + +--FILE-- +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + +$db->beginTransaction(); + +$stmt = $db->prepare('SELECT 1', [PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL]); +$stmt->execute(); + +$db->rollBack(); + +$db->beginTransaction(); + +$stmt->execute(); +echo $stmt->fetchColumn(), PHP_EOL; + +echo $db->query('SELECT 2')->fetchColumn(), PHP_EOL; + +$db->rollBack(); + +echo 'Done', PHP_EOL; + +?> +--EXPECT-- +1 +2 +Done diff --git a/ext/pdo_pgsql/tests/cursor_scroll_rollback_destroyed.phpt b/ext/pdo_pgsql/tests/cursor_scroll_rollback_destroyed.phpt new file mode 100644 index 000000000000..8dc6f7620048 --- /dev/null +++ b/ext/pdo_pgsql/tests/cursor_scroll_rollback_destroyed.phpt @@ -0,0 +1,34 @@ +--TEST-- +PDO PgSQL PDO::CURSOR_SCROLL sends no CLOSE for a cursor a rollback already destroyed +--EXTENSIONS-- +pdo_pgsql +--SKIPIF-- + +--FILE-- +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + +$db->beginTransaction(); + +$stmt = $db->prepare('SELECT 1', [PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL]); +$stmt->execute(); + +$db->rollBack(); + +$db->beginTransaction(); +unset($stmt); + +$db->exec('SELECT 2'); + +echo 'Done', PHP_EOL; + +?> +--EXPECT-- +Done diff --git a/ext/pdo_pgsql/tests/cursor_scroll_without_declare.phpt b/ext/pdo_pgsql/tests/cursor_scroll_without_declare.phpt new file mode 100644 index 000000000000..437ea341b0cf --- /dev/null +++ b/ext/pdo_pgsql/tests/cursor_scroll_without_declare.phpt @@ -0,0 +1,29 @@ +--TEST-- +PDO PgSQL PDO::CURSOR_SCROLL sends no CLOSE for a cursor it never declared +--EXTENSIONS-- +pdo_pgsql +--SKIPIF-- + +--FILE-- +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + +$db->beginTransaction(); + +$stmt = $db->prepare('SELECT 1', [PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL]); +unset($stmt); + +$db->exec('SELECT 2'); + +echo 'Done'; + +?> +--EXPECT-- +Done diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 791cbfd2c8fe..351e1b5e3aa3 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -35,7 +35,6 @@ #include "php_pgsql.h" #include "php_globals.h" #include "zend_exceptions.h" -#include "zend_attributes.h" #include "zend_interfaces.h" #include "php_network.h" diff --git a/ext/pgsql/pgsql_arginfo.h b/ext/pgsql/pgsql_arginfo.h index 974a6e9117cd..ccaab3ddc862 100644 --- a/ext/pgsql/pgsql_arginfo.h +++ b/ext/pgsql/pgsql_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit pgsql.stub.php instead. * Stub hash: fa7cd778f4e791b15ffc8f1786384332449bda5a */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_connect, 0, 1, PgSql\\Connection, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") diff --git a/ext/posix/posix_arginfo.h b/ext/posix/posix_arginfo.h index 835ad31fa1a8..6172cdf3a1ce 100644 --- a/ext/posix/posix_arginfo.h +++ b/ext/posix/posix_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit posix.stub.php instead. * Stub hash: 25e0aa769d72988ebca07fff96c8ed1fcb6b7d5e */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_kill, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, process_id, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, signal, IS_LONG, 0) diff --git a/ext/random/random.c b/ext/random/random.c index e7fe2c21801e..fe4176418e41 100644 --- a/ext/random/random.c +++ b/ext/random/random.c @@ -25,8 +25,6 @@ #include "php.h" -#include "Zend/zend_attributes.h" -#include "Zend/zend_enum.h" #include "Zend/zend_exceptions.h" #include "php_random.h" diff --git a/ext/random/random_arginfo.h b/ext/random/random_arginfo.h index 8332fdc41fd4..fb71235d8150 100644 --- a/ext/random/random_arginfo.h +++ b/ext/random/random_arginfo.h @@ -2,6 +2,10 @@ * Stub hash: 245fb5b66e540814c8595a06182886aee3e32f2c * Has decl header: yes */ +#include "zend_attributes.h" +#include "zend_constants.h" +#include "zend_enum.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_lcg_value, 0, 0, IS_DOUBLE, 0) ZEND_END_ARG_INFO() diff --git a/ext/readline/readline_arginfo.h b/ext/readline/readline_arginfo.h index 1ce08c443eeb..2e17c9ee046a 100644 --- a/ext/readline/readline_arginfo.h +++ b/ext/readline/readline_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit readline.stub.php instead. * Stub hash: 848e798481f62ee09cfd8cc3dfa6b0814cfdd979 */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_readline, 0, 0, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, prompt, IS_STRING, 1, "null") ZEND_END_ARG_INFO() diff --git a/ext/reflection/php_reflection_arginfo.h b/ext/reflection/php_reflection_arginfo.h index 7da379d7b989..661372516d50 100644 --- a/ext/reflection/php_reflection_arginfo.h +++ b/ext/reflection/php_reflection_arginfo.h @@ -2,6 +2,9 @@ * Stub hash: c4dcc2653f826c2c437065faec4bf77772ef88b1 * Has decl header: yes */ +#include "zend_attributes.h" +#include "zend_enum.h" + ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 1, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/ext/session/session_arginfo.h b/ext/session/session_arginfo.h index dfcccc643410..091317182afb 100644 --- a/ext/session/session_arginfo.h +++ b/ext/session/session_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit session.stub.php instead. * Stub hash: 5109ef5c81733a112fe20d2626b8572d0969973c */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_name, 0, 0, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, name, IS_STRING, 1, "null") ZEND_END_ARG_INFO() diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c index 7903a294a037..47ca1c2112ef 100644 --- a/ext/shmop/shmop.c +++ b/ext/shmop/shmop.c @@ -19,7 +19,6 @@ #include "php.h" #include "php_shmop.h" -#include "Zend/zend_attributes.h" #include "shmop_arginfo.h" diff --git a/ext/shmop/shmop_arginfo.h b/ext/shmop/shmop_arginfo.h index 9d88fe63c32b..464a6a462ae3 100644 --- a/ext/shmop/shmop_arginfo.h +++ b/ext/shmop/shmop_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit shmop.stub.php instead. * Stub hash: e7f250077b6721539caee96afe4ed392396018f9 */ +#include "zend_attributes.h" + ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_shmop_open, 0, 4, Shmop, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0) diff --git a/ext/snmp/snmp_arginfo.h b/ext/snmp/snmp_arginfo.h index 67d72cf75bd4..1e134c627645 100644 --- a/ext/snmp/snmp_arginfo.h +++ b/ext/snmp/snmp_arginfo.h @@ -2,6 +2,9 @@ * Stub hash: 9916f5e1d4db267e7f5d6709adf90decc9dc7f0a * Has decl header: yes */ +#include "zend_constants.h" +#include "zend_enum.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmpget, 0, 3, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, community, IS_STRING, 0) diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 506a46113861..d89ef349799e 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -19,7 +19,6 @@ #endif #include "php_soap.h" #include "ext/session/php_session.h" -#include "zend_attributes.h" #include "soap_arginfo.h" #include "zend_exceptions.h" #include "zend_interfaces.h" diff --git a/ext/soap/soap_arginfo.h b/ext/soap/soap_arginfo.h index 2f7d56ca4221..f6b146d779d6 100644 --- a/ext/soap/soap_arginfo.h +++ b/ext/soap/soap_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit soap.stub.php instead. * Stub hash: 14c74a5d6f547837f536920d5abb741e2b6e4373 */ +#include "zend_attributes.h" +#include "zend_constants.h" + 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, enable, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() diff --git a/ext/sockets/sockets_arginfo.h b/ext/sockets/sockets_arginfo.h index 203c010f5171..3f62bb3607fe 100644 --- a/ext/sockets/sockets_arginfo.h +++ b/ext/sockets/sockets_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit sockets.stub.php instead. * Stub hash: aceee39bed5332f7f26d5d768976c4d5ab96ab3c */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_select, 0, 4, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(1, read, IS_ARRAY, 1) ZEND_ARG_TYPE_INFO(1, write, IS_ARRAY, 1) diff --git a/ext/sodium/libsodium.c b/ext/sodium/libsodium.c index 814258d6a84f..f54d35506ab1 100644 --- a/ext/sodium/libsodium.c +++ b/ext/sodium/libsodium.c @@ -19,7 +19,6 @@ #include "php.h" #include "ext/standard/info.h" #include "php_libsodium.h" -#include "zend_attributes.h" #include "zend_exceptions.h" #include diff --git a/ext/sodium/libsodium_arginfo.h b/ext/sodium/libsodium_arginfo.h index 548cd132c555..fbeb30fdd630 100644 --- a/ext/sodium/libsodium_arginfo.h +++ b/ext/sodium/libsodium_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit libsodium.stub.php instead. * Stub hash: 82dc3f80ea85b0c71ed9db9b111097f3eb49d71d */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_aes256gcm_is_available, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() diff --git a/ext/sodium/sodium_pwhash_arginfo.h b/ext/sodium/sodium_pwhash_arginfo.h index 6f4161900384..42cd454772c1 100644 --- a/ext/sodium/sodium_pwhash_arginfo.h +++ b/ext/sodium/sodium_pwhash_arginfo.h @@ -1,6 +1,10 @@ /* This is a generated file, edit sodium_pwhash.stub.php instead. * Stub hash: d1e804ceea5e18fc5a4eca50b318d98387b2a470 */ +#if SODIUM_LIBRARY_VERSION_MAJOR > 9 || (SODIUM_LIBRARY_VERSION_MAJOR == 9 && SODIUM_LIBRARY_VERSION_MINOR >= 6) +#include "zend_constants.h" +#endif + static void register_sodium_pwhash_symbols(int module_number) { #if SODIUM_LIBRARY_VERSION_MAJOR > 9 || (SODIUM_LIBRARY_VERSION_MAJOR == 9 && SODIUM_LIBRARY_VERSION_MINOR >= 6) diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 36be19ed3996..0c5f1ba99c19 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -17,7 +17,6 @@ #endif #include "php_spl.h" -#include "zend_attributes.h" #include "php_spl_arginfo.h" #include "zend_autoload.h" #include "zend_exceptions.h" diff --git a/ext/spl/php_spl_arginfo.h b/ext/spl/php_spl_arginfo.h index 6a561404b5ff..360067c0172a 100644 --- a/ext/spl/php_spl_arginfo.h +++ b/ext/spl/php_spl_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit php_spl.stub.php instead. * Stub hash: 5f9f72a101d08dc67472461115b90534d4805ddc */ +#include "zend_attributes.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_implements, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) ZEND_ARG_INFO(0, object_or_class) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, autoload, _IS_BOOL, 0, "true") diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 257a7077a208..af603f3abf6b 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -18,7 +18,6 @@ #include "php.h" #include "ext/standard/php_var.h" -#include "zend_attributes.h" #include "zend_smart_str.h" #include "zend_interfaces.h" #include "zend_exceptions.h" diff --git a/ext/spl/spl_array_arginfo.h b/ext/spl/spl_array_arginfo.h index 3d7d64818d16..96523bd7a754 100644 --- a/ext/spl/spl_array_arginfo.h +++ b/ext/spl/spl_array_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit spl_array.stub.php instead. * Stub hash: c50ad88a1603d7805b7b77b60bd9c9bf0aa0a008 */ +#include "zend_attributes.h" + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayObject___construct, 0, 0, 0) ZEND_ARG_TYPE_MASK(0, array, MAY_BE_ARRAY|MAY_BE_OBJECT, "[]") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index daad1a4908f2..16571158610d 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -22,7 +22,6 @@ #include "ext/standard/flock_compat.h" #include "ext/standard/scanf.h" #include "ext/standard/php_string.h" /* For php_basename() */ -#include "zend_attributes.h" #include "zend_exceptions.h" #include "zend_interfaces.h" diff --git a/ext/spl/spl_directory_arginfo.h b/ext/spl/spl_directory_arginfo.h index 0eb6969cb517..7cf3c04cf35e 100644 --- a/ext/spl/spl_directory_arginfo.h +++ b/ext/spl/spl_directory_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit spl_directory.stub.php instead. * Stub hash: 3313c7bc6d9691a01903e6625630863e2b1e1bf7 */ +#include "zend_attributes.h" + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileInfo___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) ZEND_END_ARG_INFO() diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index d2eae52e3c0c..a53a2cc73a18 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -20,7 +20,6 @@ #include "php.h" #include "zend_interfaces.h" #include "zend_exceptions.h" -#include "zend_attributes.h" #include "spl_fixedarray_arginfo.h" #include "spl_fixedarray.h" diff --git a/ext/spl/spl_fixedarray_arginfo.h b/ext/spl/spl_fixedarray_arginfo.h index 1c5545ab3e52..2f2a264fe621 100644 --- a/ext/spl/spl_fixedarray_arginfo.h +++ b/ext/spl/spl_fixedarray_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit spl_fixedarray.stub.php instead. * Stub hash: 0c838fed60b29671fe04e63315ab662d8cb16f0c */ +#include "zend_attributes.h" + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFixedArray___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, size, IS_LONG, 0, "0") ZEND_END_ARG_INFO() diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index a980828cdcb2..7ad54781884c 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -23,7 +23,6 @@ #include "zend_smart_str.h" #include "zend_interfaces.h" #include "zend_exceptions.h" -#include "zend_attributes.h" #include "php_spl.h" /* For php_spl_object_hash() */ #include "spl_observer.h" diff --git a/ext/spl/spl_observer_arginfo.h b/ext/spl/spl_observer_arginfo.h index 142c400bcfe8..14ba7ef995db 100644 --- a/ext/spl/spl_observer_arginfo.h +++ b/ext/spl/spl_observer_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit spl_observer.stub.php instead. * Stub hash: 9dfd8bcf8946cbee550c9a46da07c424c3505408 */ +#include "zend_attributes.h" + ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SplObserver_update, 0, 1, IS_VOID, 0) ZEND_ARG_OBJ_INFO(0, subject, SplSubject, 0) ZEND_END_ARG_INFO() diff --git a/ext/sqlite3/sqlite3_arginfo.h b/ext/sqlite3/sqlite3_arginfo.h index 60f63cb1094e..3917ef63e280 100644 --- a/ext/sqlite3/sqlite3_arginfo.h +++ b/ext/sqlite3/sqlite3_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit sqlite3.stub.php instead. * Stub hash: 247f02e9b12b901b36bb863cf2a8e73b3d97a191 */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE") diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index a87ab1b5ad62..3438d6037526 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -31,8 +31,6 @@ #include "ext/standard/info.h" #include "ext/session/php_session.h" #include "zend_exceptions.h" -#include "zend_attributes.h" -#include "zend_enum.h" #include "zend_ini.h" #include "zend_operators.h" #include "ext/standard/php_dns.h" diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 7d9a42460534..677c5e668600 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -2,6 +2,10 @@ * Stub hash: 4feeab72edf6b7440af99a60e1401492828f141e * Has decl header: yes */ +#include "zend_attributes.h" +#include "zend_constants.h" +#include "zend_enum.h" + 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) ZEND_END_ARG_INFO() diff --git a/ext/standard/dir_arginfo.h b/ext/standard/dir_arginfo.h index 7ff39528d526..afd2ed76fd5c 100644 --- a/ext/standard/dir_arginfo.h +++ b/ext/standard/dir_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit dir.stub.php instead. * Stub hash: e21d382cd4001001874c49d8c5244efb57613910 */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Directory_close, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() diff --git a/ext/standard/file.c b/ext/standard/file.c index d6a8b9f1d0ea..b52e5ba9525f 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -92,7 +92,6 @@ php_file_globals file_globals; # include #endif -#include "zend_attributes.h" #include "file_arginfo.h" /* }}} */ diff --git a/ext/standard/file_arginfo.h b/ext/standard/file_arginfo.h index 24e3722cd86e..dd8a64910be8 100644 --- a/ext/standard/file_arginfo.h +++ b/ext/standard/file_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit file.stub.php instead. * Stub hash: 0c62c6fb217a87010a9e2e63d4b104cde0138655 */ +#include "zend_attributes.h" +#include "zend_constants.h" + static void register_file_symbols(int module_number) { REGISTER_LONG_CONSTANT("SEEK_SET", SEEK_SET, CONST_PERSISTENT); diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 70829eb8465e..4a0f95062bcd 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -187,21 +187,17 @@ static bool php_stream_http_response_header_trim(char *http_header_line, * last header line. */ static zend_string *php_stream_http_response_headers_parse(php_stream_wrapper *wrapper, php_stream *stream, php_stream_context *context, int options, - zend_string *last_header_line_str, char *header_line, size_t *header_line_length, + zend_string *last_header_line, char *header_line, size_t *header_line_length, int response_code, zval *response_header, php_stream_http_response_header_info *header_info) { - char *last_header_line = ZSTR_VAL(last_header_line_str); - size_t last_header_line_length = ZSTR_LEN(last_header_line_str); - char *last_header_line_end = ZSTR_VAL(last_header_line_str) + ZSTR_LEN(last_header_line_str) - 1; - /* Process non empty header line. */ if (header_line && (*header_line != '\n' && *header_line != '\r')) { /* Removing trailing white spaces. */ if (php_stream_http_response_header_trim(header_line, header_line_length) && *header_line_length == 0) { /* Only spaces so treat as an empty folding header. */ - return last_header_line_str; + return last_header_line; } /* Process folding headers if starting with a space or a tab. */ @@ -218,27 +214,27 @@ static zend_string *php_stream_http_response_headers_parse(php_stream_wrapper *w ZEND_ASSERT(http_folded_header_line_length > 0); /* Concatenate last header line, space and current header line. */ zend_string *extended_header_str = zend_string_concat3( - last_header_line, last_header_line_length, + ZSTR_VAL(last_header_line), ZSTR_LEN(last_header_line), " ", 1, http_folded_header_line, http_folded_header_line_length); - zend_string_efree(last_header_line_str); - last_header_line_str = extended_header_str; + zend_string_efree(last_header_line); + last_header_line = extended_header_str; /* Return new header line. */ - return last_header_line_str; + return last_header_line; } } /* Find header separator position. */ - char *last_header_value = memchr(last_header_line, ':', last_header_line_length); + char *last_header_value = memchr(ZSTR_VAL(last_header_line), ':', ZSTR_LEN(last_header_line)); if (last_header_value) { /* Verify there is no space in header name */ - const char *last_header_name = last_header_line + 1; + const char *last_header_name = ZSTR_VAL(last_header_line) + 1; while (last_header_name < last_header_value) { if (*last_header_name == ' ' || *last_header_name == '\t') { header_info->error = true; php_stream_wrapper_log_warn(wrapper, context, options, InvalidResponse, "HTTP invalid response format (space in header name)!"); - zend_string_efree(last_header_line_str); + zend_string_efree(last_header_line); return NULL; } ++last_header_name; @@ -247,6 +243,7 @@ static zend_string *php_stream_http_response_headers_parse(php_stream_wrapper *w last_header_value++; /* Skip ':'. */ /* Strip leading whitespace. */ + const char *last_header_line_end = ZSTR_VAL(last_header_line) + ZSTR_LEN(last_header_line) - 1; while (last_header_value < last_header_line_end && (*last_header_value == ' ' || *last_header_value == '\t')) { last_header_value++; @@ -256,14 +253,14 @@ static zend_string *php_stream_http_response_headers_parse(php_stream_wrapper *w header_info->error = true; php_stream_wrapper_log_warn(wrapper, context, options, InvalidResponse, "HTTP invalid response format (no colon in header line)!"); - zend_string_efree(last_header_line_str); + zend_string_efree(last_header_line); return NULL; } bool store_header = true; zval *tmpzval = NULL; - if (!strncasecmp(last_header_line, "Location:", sizeof("Location:")-1)) { + if (zend_string_starts_with_literal_ci(last_header_line, "Location:")) { /* Check if the location should be followed. */ if (context && (tmpzval = php_stream_context_get_option(context, "http", "follow_location")) != NULL) { header_info->follow_location = zend_is_true(tmpzval); @@ -281,7 +278,7 @@ static zend_string *php_stream_http_response_headers_parse(php_stream_wrapper *w php_stream_wrapper_log_warn(wrapper, context, options, InvalidResponse, "HTTP Location header size is over the limit of %d bytes", HTTP_HEADER_MAX_LOCATION_SIZE); - zend_string_efree(last_header_line_str); + zend_string_efree(last_header_line); return NULL; } if (header_info->location_len == 0) { @@ -291,9 +288,9 @@ static zend_string *php_stream_http_response_headers_parse(php_stream_wrapper *w } header_info->location_len = last_header_value_len; memcpy(header_info->location, last_header_value, last_header_value_len + 1); - } else if (!strncasecmp(last_header_line, "Content-Type:", sizeof("Content-Type:")-1)) { + } else if (zend_string_starts_with_literal_ci(last_header_line, "Content-Type:")) { php_stream_notify_info(context, PHP_STREAM_NOTIFY_MIME_TYPE_IS, last_header_value, 0); - } else if (!strncasecmp(last_header_line, "Content-Length:", sizeof("Content-Length:")-1)) { + } else if (zend_string_starts_with_literal_ci(last_header_line, "Content-Length:")) { /* https://www.rfc-editor.org/rfc/rfc9110.html#name-content-length */ const char *ptr = last_header_value; /* must contain only digits, no + or - symbols */ @@ -304,11 +301,11 @@ static zend_string *php_stream_http_response_headers_parse(php_stream_wrapper *w if (endptr && !*endptr) { /* truncate for 32-bit such that no negative file sizes occur */ header_info->file_size = MIN(parsed, ZEND_LONG_MAX); - php_stream_notify_file_size(context, header_info->file_size, last_header_line, 0); + php_stream_notify_file_size(context, header_info->file_size, ZSTR_VAL(last_header_line), 0); } } } else if ( - !strncasecmp(last_header_line, "Transfer-Encoding:", sizeof("Transfer-Encoding:")-1) + zend_string_starts_with_literal_ci(last_header_line, "Transfer-Encoding:") && !strncasecmp(last_header_value, "Chunked", sizeof("Chunked")-1) ) { /* Create filter to decode response body. */ @@ -335,10 +332,10 @@ static zend_string *php_stream_http_response_headers_parse(php_stream_wrapper *w if (store_header) { zval http_header; - ZVAL_NEW_STR(&http_header, last_header_line_str); + ZVAL_NEW_STR(&http_header, last_header_line); zend_hash_next_index_insert(Z_ARRVAL_P(response_header), &http_header); } else { - zend_string_efree(last_header_line_str); + zend_string_efree(last_header_line); } return NULL; diff --git a/ext/standard/io_poll_arginfo.h b/ext/standard/io_poll_arginfo.h index 801df235c26b..925f483ddc88 100644 --- a/ext/standard/io_poll_arginfo.h +++ b/ext/standard/io_poll_arginfo.h @@ -2,6 +2,8 @@ * Stub hash: 2f52b00fd6dfc62291e0dd288ffd68547b29bdaa * Has decl header: yes */ +#include "zend_enum.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Io_Poll_Backend_getAvailableBackends, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() diff --git a/ext/standard/password_arginfo.h b/ext/standard/password_arginfo.h index f3d74a96d318..2a7b19f6108a 100644 --- a/ext/standard/password_arginfo.h +++ b/ext/standard/password_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit password.stub.php instead. * Stub hash: f61df8d477588718e0eb1b055e5a3e138e6bcad3 */ +#include "zend_constants.h" + static void register_password_symbols(int module_number) { REGISTER_STRING_CONSTANT("PASSWORD_DEFAULT", "2y", CONST_PERSISTENT); diff --git a/ext/standard/user_filters_arginfo.h b/ext/standard/user_filters_arginfo.h index f5b8a7dfa472..ff65a8083c44 100644 --- a/ext/standard/user_filters_arginfo.h +++ b/ext/standard/user_filters_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit user_filters.stub.php instead. * Stub hash: 01be6d52377ecd1940c14e3d508df28a70456c58 */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_php_user_filter_filter, 0, 4, IS_LONG, 0) ZEND_ARG_INFO(0, in) ZEND_ARG_INFO(0, out) diff --git a/ext/sysvmsg/sysvmsg_arginfo.h b/ext/sysvmsg/sysvmsg_arginfo.h index 9dee3e0f4840..971681cb453f 100644 --- a/ext/sysvmsg/sysvmsg_arginfo.h +++ b/ext/sysvmsg/sysvmsg_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit sysvmsg.stub.php instead. * Stub hash: ed5b1e4e5dda6a65ce336fc4daa975520c354f17 */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_msg_get_queue, 0, 1, SysvMessageQueue, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, permissions, IS_LONG, 0, "0666") diff --git a/ext/tidy/tidy_arginfo.h b/ext/tidy/tidy_arginfo.h index cded60957021..d402a3167ab0 100644 --- a/ext/tidy/tidy_arginfo.h +++ b/ext/tidy/tidy_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit tidy.stub.php instead. * Stub hash: 7a1ba6bc8ec95e846ec89060b30f54d2c32486ef */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_tidy_parse_string, 0, 1, tidy, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) ZEND_ARG_TYPE_MASK(0, config, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null") diff --git a/ext/tokenizer/tokenizer_arginfo.h b/ext/tokenizer/tokenizer_arginfo.h index d2f8f9254f73..20e0f0624d7a 100644 --- a/ext/tokenizer/tokenizer_arginfo.h +++ b/ext/tokenizer/tokenizer_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit tokenizer.stub.php instead. * Stub hash: a89f03303f8a7d254509ae2bc46a36bb79a3c900 */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_token_get_all, 0, 1, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO(0, code, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") diff --git a/ext/tokenizer/tokenizer_data_arginfo.h b/ext/tokenizer/tokenizer_data_arginfo.h index b82842ede0f1..20e5a5f776f5 100644 --- a/ext/tokenizer/tokenizer_data_arginfo.h +++ b/ext/tokenizer/tokenizer_data_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit tokenizer_data.stub.php instead. * Stub hash: c5235344b7c651d27c2c33c90696a418a9c96837 */ +#include "zend_constants.h" + static void register_tokenizer_data_symbols(int module_number) { REGISTER_LONG_CONSTANT("T_LNUMBER", T_LNUMBER, CONST_PERSISTENT); diff --git a/ext/uri/php_uri.c b/ext/uri/php_uri.c index bb1d8c8bb13c..5f343240bbf6 100644 --- a/ext/uri/php_uri.c +++ b/ext/uri/php_uri.c @@ -19,8 +19,6 @@ #include "php.h" #include "Zend/zend_interfaces.h" #include "Zend/zend_exceptions.h" -#include "Zend/zend_attributes.h" -#include "Zend/zend_enum.h" #include "ext/standard/info.h" #include "php_uri.h" diff --git a/ext/uri/php_uri_arginfo.h b/ext/uri/php_uri_arginfo.h index c77d0485d052..b9b4fedc10c6 100644 --- a/ext/uri/php_uri_arginfo.h +++ b/ext/uri/php_uri_arginfo.h @@ -2,6 +2,9 @@ * Stub hash: 9e087e3aefdab5662892e7fad9de87857aa63057 * Has decl header: yes */ +#include "zend_attributes.h" +#include "zend_enum.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Uri_WhatWg_url_percent_encode, 0, 2, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, mode, Uri\\WhatWg\\\125rlPercentEncodingMode, 0) diff --git a/ext/xml/xml.c b/ext/xml/xml.c index d1bb4bbda23f..92345c6f0559 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -21,7 +21,6 @@ #include "php.h" #include "zend_variables.h" -#include "zend_attributes.h" #include "ext/standard/info.h" #include "ext/standard/html.h" /* For php_next_utf8_char() */ diff --git a/ext/xml/xml_arginfo.h b/ext/xml/xml_arginfo.h index 96430aef12bd..f8c6638e8ec1 100644 --- a/ext/xml/xml_arginfo.h +++ b/ext/xml/xml_arginfo.h @@ -1,6 +1,9 @@ /* This is a generated file, edit xml.stub.php instead. * Stub hash: c7838fb209d601be280dfdebfd135906afa36e8c */ +#include "zend_attributes.h" +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_xml_parser_create, 0, 0, XMLParser, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") ZEND_END_ARG_INFO() diff --git a/ext/xsl/php_xsl_arginfo.h b/ext/xsl/php_xsl_arginfo.h index a4e192c84eaf..ed639006600b 100644 --- a/ext/xsl/php_xsl_arginfo.h +++ b/ext/xsl/php_xsl_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit php_xsl.stub.php instead. * Stub hash: cb1005b601e72e8d36d0f6aa5d08872f5c7ea2e6 */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XSLTProcessor_importStylesheet, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, stylesheet, IS_OBJECT, 0) ZEND_END_ARG_INFO() diff --git a/ext/zend_test/test_arginfo.h b/ext/zend_test/test_arginfo.h index 93fdadb7f6b2..f3901c9b7330 100644 --- a/ext/zend_test/test_arginfo.h +++ b/ext/zend_test/test_arginfo.h @@ -2,6 +2,12 @@ * Stub hash: 4d728e740122add9d4c91f5c1abb5f5017690636 * Has decl header: yes */ +#include "zend_attributes.h" +#include "zend_constants.h" +#if (PHP_VERSION_ID >= 80100) +#include "zend_enum.h" +#endif + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_trigger_bailout, 0, 0, IS_NEVER, 0) ZEND_END_ARG_INFO() diff --git a/ext/zend_test/test_legacy_arginfo.h b/ext/zend_test/test_legacy_arginfo.h index 479a678df778..d9a7709ab22f 100644 --- a/ext/zend_test/test_legacy_arginfo.h +++ b/ext/zend_test/test_legacy_arginfo.h @@ -2,6 +2,11 @@ * Stub hash: 4d728e740122add9d4c91f5c1abb5f5017690636 * Has decl header: yes */ +#include "zend_constants.h" +#if (PHP_VERSION_ID >= 80100) +#include "zend_enum.h" +#endif + ZEND_BEGIN_ARG_INFO_EX(arginfo_zend_trigger_bailout, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 15994b60cc70..7af8a81e8f61 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -23,7 +23,6 @@ #include "ext/standard/php_string.h" /* For php_basename() */ #include "ext/pcre/php_pcre.h" #include "ext/standard/php_filestat.h" -#include "zend_attributes.h" #include "zend_interfaces.h" #include "zend_exceptions.h" #include "php_zip.h" diff --git a/ext/zip/php_zip_arginfo.h b/ext/zip/php_zip_arginfo.h index 2496670158da..022bce3650b0 100644 --- a/ext/zip/php_zip_arginfo.h +++ b/ext/zip/php_zip_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit php_zip.stub.php instead. * Stub hash: 8f2b42d73dd8ff8729ddeff8396fa6d563eb13cb */ +#include "zend_attributes.h" + ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) ZEND_END_ARG_INFO() diff --git a/ext/zlib/zlib_arginfo.h b/ext/zlib/zlib_arginfo.h index 22605924b8b1..41388789f841 100644 --- a/ext/zlib/zlib_arginfo.h +++ b/ext/zlib/zlib_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit zlib.stub.php instead. * Stub hash: 4c5bea6d9f290c244c7bb27c77fe8007d43a40db */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ob_gzhandler, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) diff --git a/gcovr.cfg b/gcovr.cfg index 7ee4cff356e8..c8c7177e2a18 100644 --- a/gcovr.cfg +++ b/gcovr.cfg @@ -15,6 +15,7 @@ exclude = ext/pcre/pcre2lib/.* exclude = ext/uri/uriparser/.* exclude = Zend/Optimizer/ssa_integrity\.c exclude = Zend/Optimizer/zend_dump\.c +exclude = Zend/zend_gdb\.c # These patterns have implicit ^/$ anchors. exclude-lines-by-pattern = .*\b(ZEND_PARSE_PARAMETERS_(START|END|NONE)|Z_PARAM_).* diff --git a/main/main_arginfo.h b/main/main_arginfo.h index d2bd2725ec41..0da355e87b77 100644 --- a/main/main_arginfo.h +++ b/main/main_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit main.stub.php instead. * Stub hash: 22b4c7412680888c122886bccd21e3d38953ce33 */ +#include "zend_constants.h" + static void register_main_symbols(int module_number) { REGISTER_STRING_CONSTANT("PHP_VERSION", PHP_VERSION, CONST_PERSISTENT); diff --git a/main/streams/stream_errors_arginfo.h b/main/streams/stream_errors_arginfo.h index 4558f64b77f5..8b46210b3579 100644 --- a/main/streams/stream_errors_arginfo.h +++ b/main/streams/stream_errors_arginfo.h @@ -2,6 +2,8 @@ * Stub hash: d3087b608996f81bf0dd19c25792feec9744e768 * Has decl header: yes */ +#include "zend_enum.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_StreamException_getErrors, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() diff --git a/main/streams/userspace_arginfo.h b/main/streams/userspace_arginfo.h index 52e39ab02f87..267eede10741 100644 --- a/main/streams/userspace_arginfo.h +++ b/main/streams/userspace_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit userspace.stub.php instead. * Stub hash: 9198095c858c95fcb31252ddfa24fe04787d0460 */ +#include "zend_constants.h" + static void register_userspace_symbols(int module_number) { REGISTER_LONG_CONSTANT("STREAM_USE_PATH", USE_PATH, CONST_PERSISTENT); diff --git a/sapi/phpdbg/phpdbg_arginfo.h b/sapi/phpdbg/phpdbg_arginfo.h index 08b07b7597da..f12bf1ca2575 100644 --- a/sapi/phpdbg/phpdbg_arginfo.h +++ b/sapi/phpdbg/phpdbg_arginfo.h @@ -1,6 +1,8 @@ /* This is a generated file, edit phpdbg.stub.php instead. * Stub hash: 08e29f02953f23bfce6ce04f435227b4e5e61545 */ +#include "zend_constants.h" + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_break_next, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO()