From 046cc5e4c213b836546689d5bdc8925f057c24b5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Fri, 7 Aug 2020 16:48:39 +0200 Subject: [PATCH] Add another round of missing parameter types to stubs Closes GH-5950 --- ext/com_dotnet/com_extension.stub.php | 1 + ext/com_dotnet/com_extension_arginfo.h | 2 +- ext/date/php_date.stub.php | 7 +- ext/date/php_date_arginfo.h | 2 +- ext/exif/exif.stub.php | 7 +- ext/exif/exif_arginfo.h | 2 +- ext/intl/calendar/calendar.stub.php | 10 +- ext/intl/calendar/calendar_arginfo.h | 4 +- ext/intl/collator/collator.stub.php | 2 +- ext/intl/collator/collator_arginfo.h | 9 +- ext/intl/converter/converter.stub.php | 10 +- ext/intl/converter/converter_arginfo.h | 2 +- ext/intl/dateformat/dateformat.stub.php | 2 + ext/intl/dateformat/dateformat_arginfo.h | 2 +- ext/intl/formatter/formatter.stub.php | 3 + ext/intl/formatter/formatter_arginfo.h | 2 +- ext/intl/php_intl.stub.php | 13 +- ext/intl/php_intl_arginfo.h | 2 +- ext/intl/spoofchecker/spoofchecker.stub.php | 10 +- ext/intl/spoofchecker/spoofchecker_arginfo.h | 2 +- ext/intl/timezone/timezone.stub.php | 3 + ext/intl/timezone/timezone_arginfo.h | 2 +- ext/intl/uchar/uchar.stub.php | 2 +- ext/intl/uchar/uchar_arginfo.h | 4 +- ext/ldap/ldap.stub.php | 5 + ext/ldap/ldap_arginfo.h | 2 +- ext/mysqli/mysqli.stub.php | 2 +- ext/mysqli/mysqli_arginfo.h | 4 +- ext/pcntl/pcntl.stub.php | 10 +- ext/pcntl/pcntl_arginfo.h | 2 +- ext/pdo/pdo_dbh.stub.php | 2 +- ext/pdo/pdo_dbh_arginfo.h | 4 +- ext/pdo/pdo_stmt.stub.php | 16 +- ext/pdo/pdo_stmt_arginfo.h | 8 +- ext/phar/phar_object.c | 225 ++++++++---------- ext/phar/phar_object.stub.php | 18 +- ext/phar/phar_object_arginfo.h | 16 +- .../files/frontcontroller16.phar.inc | 2 +- .../tests/cache_list/frontcontroller31.phpt | 8 +- .../tests/files/frontcontroller16.phar.inc | 2 +- ext/phar/tests/frontcontroller31.phpt | 8 +- ext/phar/tests/phar_buildfromiterator1.phpt | 3 +- ext/phar/tests/phar_extract.phpt | 6 +- ext/spl/spl_directory.stub.php | 14 +- ext/spl/spl_directory_arginfo.h | 6 +- 45 files changed, 255 insertions(+), 213 deletions(-) diff --git a/ext/com_dotnet/com_extension.stub.php b/ext/com_dotnet/com_extension.stub.php index 90c14df5bc..8323b0796b 100644 --- a/ext/com_dotnet/com_extension.stub.php +++ b/ext/com_dotnet/com_extension.stub.php @@ -61,6 +61,7 @@ function com_create_guid(): string|false {} /** @param array|string|null $sinkinterface */ function com_event_sink(variant $comobject, object $sinkobject, $sinkinterface = UNKNOWN): bool {} +/** @param com|dotnet|variant|string $comobject */ function com_print_typeinfo($comobject, ?string $dispinterface = null, bool $wantsink = false): bool {} function com_message_pump(int $timeoutms = 0): bool {} diff --git a/ext/com_dotnet/com_extension_arginfo.h b/ext/com_dotnet/com_extension_arginfo.h index afe2f1b6ad..aec8108d88 100644 --- a/ext/com_dotnet/com_extension_arginfo.h +++ b/ext/com_dotnet/com_extension_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: caec4bba1103a07a86803ac0192782fef7d6680f */ + * Stub hash: 48167f9ee38966beaf550cd0a7b07d873575b48e */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_set, 0, 2, IS_VOID, 0) ZEND_ARG_OBJ_INFO(0, variant, variant, 0) diff --git a/ext/date/php_date.stub.php b/ext/date/php_date.stub.php index c86b51d7ca..bb97cf5b86 100644 --- a/ext/date/php_date.stub.php +++ b/ext/date/php_date.stub.php @@ -393,7 +393,12 @@ class DateInterval class DatePeriod implements IteratorAggregate { - /* Has an overloaded signature */ + /** + * @param DateTimeInterface|string $start + * @param DateInterval|int $interval + * @param DateTimeInterface|int $end + * @param int $options + */ public function __construct($start, $interval = UNKNOWN, $end = UNKNOWN, $options = UNKNOWN) {} /** @return DateTimeInterface */ diff --git a/ext/date/php_date_arginfo.h b/ext/date/php_date_arginfo.h index b15ff5008c..bc12d852bb 100644 --- a/ext/date/php_date_arginfo.h +++ b/ext/date/php_date_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: aa0e2c059662d4015658b85c932126b34934b5a4 */ + * Stub hash: fee95924adec03c89fdd677ec26bb6eea34d4b3c */ 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) diff --git a/ext/exif/exif.stub.php b/ext/exif/exif.stub.php index 86e4cc5258..9cc099ba2a 100644 --- a/ext/exif/exif.stub.php +++ b/ext/exif/exif.stub.php @@ -7,7 +7,12 @@ function exif_tagname(int $index): string|false {} /** @param resource|string $filename */ function exif_read_data($filename, ?string $sections_needed = null, bool $sub_arrays = false, bool $read_thumbnail = false): array|false {} -/** @param resource|string $filename */ +/** + * @param resource|string $filename + * @param int $width + * @param int $height + * @param int $imagetype + */ function exif_thumbnail($filename, &$width = null, &$height = null, &$imagetype = null): string|false {} function exif_imagetype(string $filename): int|false {} diff --git a/ext/exif/exif_arginfo.h b/ext/exif/exif_arginfo.h index 5edef59fc6..b16f457c56 100644 --- a/ext/exif/exif_arginfo.h +++ b/ext/exif/exif_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 62f6ca1a43c69d917711eae9118caf5a658722d9 */ + * Stub hash: d8cb3719a7de74b27b306c30b6be0af0647b6af4 */ 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) diff --git a/ext/intl/calendar/calendar.stub.php b/ext/intl/calendar/calendar.stub.php index d3a7958ee9..bc09ae70a3 100644 --- a/ext/intl/calendar/calendar.stub.php +++ b/ext/intl/calendar/calendar.stub.php @@ -235,7 +235,7 @@ class IntlCalendar * @return bool * @alias intlcal_set */ - public function set(int $year, int $month, int $dayOfMonth = UNKNOWN, $hour = UNKNOWN, int $minute = UNKNOWN, int $second = UNKNOWN) {} + public function set(int $year, int $month, int $dayOfMonth = UNKNOWN, int $hour = UNKNOWN, int $minute = UNKNOWN, int $second = UNKNOWN) {} /** * @return bool @@ -283,6 +283,14 @@ class IntlCalendar class IntlGregorianCalendar extends IntlCalendar { + /** + * @param DateTimeZone|IntlTimeZone|string|int|null $timeZoneOrYear + * @param string|int|null $localeOrMonth + * @param int $dayOfMonth + * @param int $hour + * @param int $minute + * @param int $second + */ public function __construct($timeZoneOrYear = UNKNOWN, $localeOrMonth = UNKNOWN, $dayOfMonth = UNKNOWN, $hour = UNKNOWN, $minute = UNKNOWN, $second = UNKNOWN) {} /** diff --git a/ext/intl/calendar/calendar_arginfo.h b/ext/intl/calendar/calendar_arginfo.h index 47ea9200fe..99626bd19e 100644 --- a/ext/intl/calendar/calendar_arginfo.h +++ b/ext/intl/calendar/calendar_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 8b8a98d5035880031ac42fda5e58bde54c1d85fc */ + * Stub hash: 3facb6bdce18efae3d6b9594d1fcddfb220dd54d */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -115,7 +115,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_set, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, dayOfMonth, IS_LONG, 0) - ZEND_ARG_INFO(0, hour) + ZEND_ARG_TYPE_INFO(0, hour, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, minute, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, second, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/ext/intl/collator/collator.stub.php b/ext/intl/collator/collator.stub.php index 6e8c61c21a..68a7da192f 100644 --- a/ext/intl/collator/collator.stub.php +++ b/ext/intl/collator/collator.stub.php @@ -22,7 +22,7 @@ class Collator * @return bool * @alias collator_sort */ - public function sort(array &$arr, $sort_flag = Collator::SORT_REGULAR) {} + public function sort(array &$arr, int $sort_flag = Collator::SORT_REGULAR) {} /** * @return bool diff --git a/ext/intl/collator/collator_arginfo.h b/ext/intl/collator/collator_arginfo.h index 7d045b35a8..f0fd448077 100644 --- a/ext/intl/collator/collator_arginfo.h +++ b/ext/intl/collator/collator_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 95fee5001472494653e6a83467c3c0079ea70728 */ + * Stub hash: 4cb1470cf2566c9d947be638c7d14a14a10290dd */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0) @@ -14,17 +14,14 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator_sort, 0, 0, 1) ZEND_ARG_TYPE_INFO(1, arr, IS_ARRAY, 0) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, sort_flag, "Collator::SORT_REGULAR") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, sort_flag, IS_LONG, 0, "Collator::SORT_REGULAR") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator_sortWithSortKeys, 0, 0, 1) ZEND_ARG_TYPE_INFO(1, arr, IS_ARRAY, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator_asort, 0, 0, 1) - ZEND_ARG_TYPE_INFO(1, arr, IS_ARRAY, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, sort_flag, IS_LONG, 0, "Collator::SORT_REGULAR") -ZEND_END_ARG_INFO() +#define arginfo_class_Collator_asort arginfo_class_Collator_sort ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator_getAttribute, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0) diff --git a/ext/intl/converter/converter.stub.php b/ext/intl/converter/converter.stub.php index fd6aa175b0..f888a78b03 100644 --- a/ext/intl/converter/converter.stub.php +++ b/ext/intl/converter/converter.stub.php @@ -9,7 +9,10 @@ class UConverter /** @return string|false */ public function convert(string $str, bool $reverse = false) {} - /** @return string|null */ + /** + * @param int $error + * @return string|null + */ public function fromUCallback(int $reason, array $source, int $codePoint, &$error) {} /** @return array|false|null */ @@ -54,7 +57,10 @@ class UConverter /** @return bool */ public function setSubstChars(string $chars) {} - /** @return string|null */ + /** + * @param int $error + * @return string|null + */ public function toUCallback(int $reason, string $source, string $codeUnits, &$error) {} /** @return string|false */ diff --git a/ext/intl/converter/converter_arginfo.h b/ext/intl/converter/converter_arginfo.h index 5a72ad68ee..513d8e4525 100644 --- a/ext/intl/converter/converter_arginfo.h +++ b/ext/intl/converter/converter_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 3c63c9077f864e122292eef8655489549de9277a */ + * Stub hash: 9eef3fe293c07ab77f4c8b6d8d53a3798f8a9865 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, destination_encoding, IS_STRING, 1, "null") diff --git a/ext/intl/dateformat/dateformat.stub.php b/ext/intl/dateformat/dateformat.stub.php index e86c8c93ad..cdb5aedb03 100644 --- a/ext/intl/dateformat/dateformat.stub.php +++ b/ext/intl/dateformat/dateformat.stub.php @@ -114,12 +114,14 @@ class IntlDateFormatter public static function formatObject($object, $format = null, ?string $locale = null) {} /** + * @param int $position * @return int|float|false * @alias datefmt_parse */ public function parse(string $value, &$position = null) {} /** + * @param int $position * @return array|false * @alias datefmt_localtime */ diff --git a/ext/intl/dateformat/dateformat_arginfo.h b/ext/intl/dateformat/dateformat_arginfo.h index 0dadfd9dd0..ae128d8bf9 100644 --- a/ext/intl/dateformat/dateformat_arginfo.h +++ b/ext/intl/dateformat/dateformat_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 86faf2e51b67db2801ce691d4d24bfdae5feb6fc */ + * Stub hash: e98080c0b9107da6a2bf3ce99929554eb9a3c70e */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter___construct, 0, 0, 3) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1) diff --git a/ext/intl/formatter/formatter.stub.php b/ext/intl/formatter/formatter.stub.php index 2d5dc11966..4608c1917d 100644 --- a/ext/intl/formatter/formatter.stub.php +++ b/ext/intl/formatter/formatter.stub.php @@ -19,6 +19,7 @@ class NumberFormatter public function format(int|float $value, int $type = NumberFormatter::TYPE_DEFAULT) {} /** + * @param int $position * @return int|float|false * @alias numfmt_parse */ @@ -31,6 +32,8 @@ class NumberFormatter public function formatCurrency(float $value, string $currency) {} /** + * @param string $currency + * @param int $position * @return float|false * @alias numfmt_parse_currency */ diff --git a/ext/intl/formatter/formatter_arginfo.h b/ext/intl/formatter/formatter_arginfo.h index 051a98f941..ffc4eb5018 100644 --- a/ext/intl/formatter/formatter_arginfo.h +++ b/ext/intl/formatter/formatter_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 3ff6f141d025bccb37ff597089f00bcc72462627 */ + * Stub hash: 041569278b83b65f67fb4848d00d5423e6728165 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter___construct, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0) diff --git a/ext/intl/php_intl.stub.php b/ext/intl/php_intl.stub.php index bbb09d03c8..8cb198e7d6 100644 --- a/ext/intl/php_intl.stub.php +++ b/ext/intl/php_intl.stub.php @@ -98,7 +98,14 @@ function intlcal_get_error_code(IntlCalendar $calendar): int|false {} function intlcal_get_error_message(IntlCalendar $calendar): string|false {} -/** @param IntlTimeZone|DateTimeZone|string|null $timeZone */ +/** + * @param DateTimeZone|IntlTimeZone|string|int|null $timeZoneOrYear + * @param string|int|null $localeOrMonth + * @param int $dayOfMonth + * @param int $hour + * @param int $minute + * @param int $second + */ function intlgregcal_create_instance($timeZoneOrYear = UNKNOWN, $localeOrMonth = UNKNOWN, $dayOfMonth = UNKNOWN, $hour = UNKNOWN, $minute = UNKNOWN, $second = UNKNOWN): ?IntlGregorianCalendar {} function intlgregcal_set_gregorian_change(IntlGregorianCalendar $calendar, float $change): bool {} @@ -393,6 +400,10 @@ function intltz_get_gmt(): IntlTimeZone {} function intltz_get_id(IntlTimeZone $tz): string|false {} +/** + * @param int $rawOffset + * @param int $dstOffset + */ function intltz_get_offset(IntlTimeZone $tz, float $date, bool $local, &$rawOffset, &$dstOffset): bool {} function intltz_get_raw_offset(IntlTimeZone $tz): int {} diff --git a/ext/intl/php_intl_arginfo.h b/ext/intl/php_intl_arginfo.h index 93dcec79e3..d66163c1b5 100644 --- a/ext/intl/php_intl_arginfo.h +++ b/ext/intl/php_intl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ef46b927a82d0bdecea9438ff6ba0000b73b3b56 */ + * Stub hash: 57c63e06f2c6cf6c58a63081f19fe3e6d6901e88 */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_create_instance, 0, 0, IntlCalendar, 1) ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timeZone, "null") diff --git a/ext/intl/spoofchecker/spoofchecker.stub.php b/ext/intl/spoofchecker/spoofchecker.stub.php index 82b749b1eb..b3f7159979 100644 --- a/ext/intl/spoofchecker/spoofchecker.stub.php +++ b/ext/intl/spoofchecker/spoofchecker.stub.php @@ -6,10 +6,16 @@ class Spoofchecker { public function __construct() {} - /** @return bool */ + /** + * @param int $error + * @return bool + */ public function isSuspicious(string $text, &$error = null) {} - /** @return bool */ + /** + * @param int $error + * @return bool + */ public function areConfusable(string $s1, string $s2, &$error = null) {} /** @return void */ diff --git a/ext/intl/spoofchecker/spoofchecker_arginfo.h b/ext/intl/spoofchecker/spoofchecker_arginfo.h index 26ca66080a..925195fcda 100644 --- a/ext/intl/spoofchecker/spoofchecker_arginfo.h +++ b/ext/intl/spoofchecker/spoofchecker_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: dbcdb94753d19921594c48a735d6bd9194b02996 */ + * Stub hash: 5f4ea7ab66c1748a8de076fca4b62a7d0a235598 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Spoofchecker___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/ext/intl/timezone/timezone.stub.php b/ext/intl/timezone/timezone.stub.php index e470ee8440..5e6208bb73 100644 --- a/ext/intl/timezone/timezone.stub.php +++ b/ext/intl/timezone/timezone.stub.php @@ -44,6 +44,7 @@ class IntlTimeZone public static function fromDateTimeZone(DateTimeZone $zone) {} /** + * @param bool $isSystemID * @return string|false * @alias intltz_get_canonical_id */ @@ -92,6 +93,8 @@ class IntlTimeZone public function getID() {} /** + * @param int $rawOffset + * @param int $dstOffset * @return bool * @alias intltz_get_offset */ diff --git a/ext/intl/timezone/timezone_arginfo.h b/ext/intl/timezone/timezone_arginfo.h index 494c46391b..b21975eed4 100644 --- a/ext/intl/timezone/timezone_arginfo.h +++ b/ext/intl/timezone/timezone_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: df98b2edbdf806c52a9c165b52124b6b0de7acb2 */ + * Stub hash: 94e3c8228a0625a2c5825b0747fb1e5e08808b50 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/ext/intl/uchar/uchar.stub.php b/ext/intl/uchar/uchar.stub.php index a01552f8c9..6f793a6147 100644 --- a/ext/intl/uchar/uchar.stub.php +++ b/ext/intl/uchar/uchar.stub.php @@ -47,7 +47,7 @@ class IntlChar public static function foldCase(int|string $codepoint, int $options = IntlChar::FOLD_CASE_DEFAULT) {} /** @return int */ - public static function forDigit(int $digit, $radix = 10) {} + public static function forDigit(int $digit, int $radix = 10) {} #if U_ICU_VERSION_MAJOR_NUM >= 52 /** @return int|string|null */ diff --git a/ext/intl/uchar/uchar_arginfo.h b/ext/intl/uchar/uchar_arginfo.h index 6f0175b803..3ea897c189 100644 --- a/ext/intl/uchar/uchar_arginfo.h +++ b/ext/intl/uchar/uchar_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 2f9658fe9c23180244786ed48a5ca542b7ed95ea */ + * Stub hash: 61f9c0a6c5048d25e070379f2f98fa10f8ce25ee */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlChar_hasBinaryProperty, 0, 0, 2) ZEND_ARG_TYPE_MASK(0, codepoint, MAY_BE_LONG|MAY_BE_STRING, NULL) @@ -53,7 +53,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlChar_forDigit, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, digit, IS_LONG, 0) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, radix, "10") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, radix, IS_LONG, 0, "10") ZEND_END_ARG_INFO() #if U_ICU_VERSION_MAJOR_NUM >= 52 diff --git a/ext/ldap/ldap.stub.php b/ext/ldap/ldap.stub.php index 9739ce59c2..d8851b3314 100644 --- a/ext/ldap/ldap.stub.php +++ b/ext/ldap/ldap.stub.php @@ -267,6 +267,11 @@ function ldap_parse_reference($link, $entry, &$referrals): bool {} /** * @param resource $link * @param resource $result + * @param int $errcode + * @param string $matcheddn + * @param string $errmsg + * @param array $referrals + * @param array $serverctrls */ function ldap_parse_result($link, $result, &$errcode, &$matcheddn = null, &$errmsg = null, &$referrals = null, &$serverctrls = null): bool {} #endif diff --git a/ext/ldap/ldap_arginfo.h b/ext/ldap/ldap_arginfo.h index 94a64918c7..078fe220cd 100644 --- a/ext/ldap/ldap_arginfo.h +++ b/ext/ldap/ldap_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: fb889b72e823f3033a54209059f8c6803961cef3 */ + * Stub hash: 6b5e8ddfbdc436fab3a263d6922146ca7c2f3845 */ #if defined(HAVE_ORALDAP) ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0) diff --git a/ext/mysqli/mysqli.stub.php b/ext/mysqli/mysqli.stub.php index 84d95b24d7..7f6bdf880b 100644 --- a/ext/mysqli/mysqli.stub.php +++ b/ext/mysqli/mysqli.stub.php @@ -415,7 +415,7 @@ class mysqli_stmt * @return bool * @alias mysqli_stmt_bind_result */ - public function bind_result(&...$vars) {} + public function bind_result(mixed &...$vars) {} /** * @return bool diff --git a/ext/mysqli/mysqli_arginfo.h b/ext/mysqli/mysqli_arginfo.h index 28145d1460..8f82ead3ed 100644 --- a/ext/mysqli/mysqli_arginfo.h +++ b/ext/mysqli/mysqli_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 0fb73727b9ca9f4fa9827fecd948b60948ddc423 */ + * Stub hash: 9f7063a0495441cb184f15b895771a32e8ef3195 */ 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_link, mysqli, 0) @@ -641,7 +641,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_stmt_bind_param, 0, 0, 1) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_stmt_bind_result, 0, 0, 0) - ZEND_ARG_VARIADIC_INFO(1, vars) + ZEND_ARG_VARIADIC_TYPE_INFO(1, vars, IS_MIXED, 0) ZEND_END_ARG_INFO() #define arginfo_class_mysqli_stmt_close arginfo_class_mysqli_character_set_name diff --git a/ext/pcntl/pcntl.stub.php b/ext/pcntl/pcntl.stub.php index 3c1fd97968..0c56b04966 100644 --- a/ext/pcntl/pcntl.stub.php +++ b/ext/pcntl/pcntl.stub.php @@ -4,10 +4,16 @@ function pcntl_fork(): int {} -/** @param int $status */ +/** + * @param int $status + * @param array $rusage + */ function pcntl_waitpid(int $pid, &$status, int $options = 0, &$rusage = []): int {} -/** @param int $status */ +/** + * @param int $status + * @param array $rusage + */ function pcntl_wait(&$status, int $options = 0, &$rusage = []): int {} /** @param callable|int $handler */ diff --git a/ext/pcntl/pcntl_arginfo.h b/ext/pcntl/pcntl_arginfo.h index 6e67d4613d..4c34a762c8 100644 --- a/ext/pcntl/pcntl_arginfo.h +++ b/ext/pcntl/pcntl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 243017c5440bff0b3ee3296705d8455d0fac5b7e */ + * Stub hash: df744f88533ce9b84864fa2aa4dd7a5b7373231d */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_fork, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/ext/pdo/pdo_dbh.stub.php b/ext/pdo/pdo_dbh.stub.php index bde46dd712..a35e34e098 100644 --- a/ext/pdo/pdo_dbh.stub.php +++ b/ext/pdo/pdo_dbh.stub.php @@ -37,7 +37,7 @@ class PDO public function prepare(string $statement, array $driver_options = []) {} /** @return PDOStatement|false */ - public function query(string $statement, ?int $fetch_mode = null, ...$fetch_mode_args) {} + public function query(string $statement, ?int $fetch_mode = null, mixed ...$fetch_mode_args) {} /** @return string|false */ public function quote(string $string, int $parameter_type = PDO::PARAM_STR) {} diff --git a/ext/pdo/pdo_dbh_arginfo.h b/ext/pdo/pdo_dbh_arginfo.h index 1057c54665..b5cf1d81d0 100644 --- a/ext/pdo/pdo_dbh_arginfo.h +++ b/ext/pdo/pdo_dbh_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 36270d1418fc4ddd8f79018372b0ef00fb6f5889 */ + * Stub hash: 623f0a96bc1ae5eadcac5ba92eb73189cd3230cd */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, dsn, IS_STRING, 0) @@ -41,7 +41,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_query, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, statement, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fetch_mode, IS_LONG, 1, "null") - ZEND_ARG_VARIADIC_INFO(0, fetch_mode_args) + ZEND_ARG_VARIADIC_TYPE_INFO(0, fetch_mode_args, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_quote, 0, 0, 1) diff --git a/ext/pdo/pdo_stmt.stub.php b/ext/pdo/pdo_stmt.stub.php index bab620d627..d34607de8c 100644 --- a/ext/pdo/pdo_stmt.stub.php +++ b/ext/pdo/pdo_stmt.stub.php @@ -4,17 +4,11 @@ class PDOStatement implements IteratorAggregate { - /** - * @param mixed $driverdata - * @return bool - */ - public function bindColumn(int|string $column, &$param, int $type = 0, int $maxlen = 0, $driverdata = null) {} + /** @return bool */ + public function bindColumn(int|string $column, &$param, int $type = 0, int $maxlen = 0, mixed $driverdata = null) {} - /** - * @param mixed $driver_options - * @return bool - */ - public function bindParam(int|string $parameter, &$param, int $type = PDO::PARAM_STR, int $maxlen = 0, $driverdata = null) {} + /** @return bool */ + public function bindParam(int|string $parameter, &$param, int $type = PDO::PARAM_STR, int $maxlen = 0, mixed $driverdata = null) {} /** * @param int|string $parameter @@ -75,7 +69,7 @@ class PDOStatement implements IteratorAggregate public function setAttribute(int $attribute, $value) {} /** @return bool */ - public function setFetchMode(int $mode, ...$params) {} + public function setFetchMode(int $mode, mixed ...$params) {} public function getIterator(): Iterator {} } diff --git a/ext/pdo/pdo_stmt_arginfo.h b/ext/pdo/pdo_stmt_arginfo.h index aa9227d83b..517c15b614 100644 --- a/ext/pdo/pdo_stmt_arginfo.h +++ b/ext/pdo/pdo_stmt_arginfo.h @@ -1,12 +1,12 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 590a642abbc8d54be143a1c595e9e704888e9b5f */ + * Stub hash: 1802a0ceaa7be9a7644d1b943d2b7d70be23ec75 */ 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_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_INFO_WITH_DEFAULT_VALUE(0, driverdata, "null") + 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) @@ -14,7 +14,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindParam, 0, 0, 2) ZEND_ARG_INFO(1, param) 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_INFO_WITH_DEFAULT_VALUE(0, driverdata, "null") + 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) @@ -78,7 +78,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_setFetchMode, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0) - ZEND_ARG_VARIADIC_INFO(0, params) + ZEND_ARG_VARIADIC_TYPE_INFO(0, params, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_PDOStatement_getIterator, 0, 0, Iterator, 0) diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index c72fecc6e3..97be3e900c 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -537,7 +537,9 @@ finish: ; */ PHP_METHOD(Phar, webPhar) { - zval *mimeoverride = NULL, *rewrite = NULL; + zval *mimeoverride = NULL; + zend_fcall_info rewrite_fci = {0}; + zend_fcall_info_cache rewrite_fcc; char *alias = NULL, *error, *index_php = NULL, *f404 = NULL, *ru = NULL; size_t alias_len = 0, f404_len = 0, free_pathinfo = 0; size_t ru_len = 0; @@ -550,7 +552,7 @@ PHP_METHOD(Phar, webPhar) phar_entry_info *info = NULL; size_t sapi_mod_name_len = strlen(sapi_module.name); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!saz", &alias, &alias_len, &index_php, &index_php_len, &f404, &f404_len, &mimeoverride, &rewrite) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!saf!", &alias, &alias_len, &index_php, &index_php_len, &f404, &f404_len, &mimeoverride, &rewrite_fci, &rewrite_fcc) == FAILURE) { RETURN_THROWS(); } @@ -668,38 +670,23 @@ PHP_METHOD(Phar, webPhar) not_cgi = 1; } - if (rewrite) { - zend_fcall_info fci; - zend_fcall_info_cache fcc; + if (ZEND_FCI_INITIALIZED(rewrite_fci)) { zval params, retval; ZVAL_STRINGL(¶ms, entry, entry_len); - if (FAILURE == zend_fcall_info_init(rewrite, 0, &fci, &fcc, NULL, NULL)) { - zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: invalid rewrite callback"); + rewrite_fci.param_count = 1; + rewrite_fci.params = ¶ms; + rewrite_fci.retval = &retval; -cleanup_fail: - zval_ptr_dtor(¶ms); - if (free_pathinfo) { - efree(path_info); - } - efree(entry); - efree(pt); - RETURN_THROWS(); - } - - fci.param_count = 1; - fci.params = ¶ms; - fci.retval = &retval; - - if (FAILURE == zend_call_function(&fci, &fcc)) { + if (FAILURE == zend_call_function(&rewrite_fci, &rewrite_fcc)) { if (!EG(exception)) { zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: failed to call rewrite callback"); } goto cleanup_fail; } - if (Z_TYPE_P(fci.retval) == IS_UNDEF || Z_TYPE(retval) == IS_UNDEF) { + if (Z_TYPE_P(rewrite_fci.retval) == IS_UNDEF || Z_TYPE(retval) == IS_UNDEF) { zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: rewrite callback must return a string or false"); goto cleanup_fail; } @@ -707,8 +694,8 @@ cleanup_fail: switch (Z_TYPE(retval)) { case IS_STRING: efree(entry); - entry = estrndup(Z_STRVAL_P(fci.retval), Z_STRLEN_P(fci.retval)); - entry_len = Z_STRLEN_P(fci.retval); + entry = estrndup(Z_STRVAL_P(rewrite_fci.retval), Z_STRLEN_P(rewrite_fci.retval)); + entry_len = Z_STRLEN_P(rewrite_fci.retval); break; case IS_TRUE: case IS_FALSE: @@ -723,7 +710,15 @@ cleanup_fail: return; default: zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: rewrite callback must return a string or false"); - goto cleanup_fail; + +cleanup_fail: + zval_ptr_dtor(¶ms); + if (free_pathinfo) { + efree(path_info); + } + efree(entry); + efree(pt); + RETURN_THROWS(); } } @@ -2703,71 +2698,67 @@ PHP_METHOD(Phar, setAlias) RETURN_THROWS(); } - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &alias, &alias_len) == SUCCESS) { - if (alias_len == phar_obj->archive->alias_len && memcmp(phar_obj->archive->alias, alias, alias_len) == 0) { - RETURN_TRUE; - } - if (alias_len && NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_G(phar_alias_map)), alias, alias_len))) { - spprintf(&error, 0, "alias \"%s\" is already used for archive \"%s\" and cannot be used for other archives", alias, fd_ptr->fname); - if (SUCCESS == phar_free_alias(fd_ptr, alias, alias_len)) { - efree(error); - goto valid_alias; - } - zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error); + if (alias_len == phar_obj->archive->alias_len && memcmp(phar_obj->archive->alias, alias, alias_len) == 0) { + RETURN_TRUE; + } + if (alias_len && NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_G(phar_alias_map)), alias, alias_len))) { + spprintf(&error, 0, "alias \"%s\" is already used for archive \"%s\" and cannot be used for other archives", alias, fd_ptr->fname); + if (SUCCESS == phar_free_alias(fd_ptr, alias, alias_len)) { efree(error); - RETURN_THROWS(); - } - if (!phar_validate_alias(alias, alias_len)) { - zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, - "Invalid alias \"%s\" specified for phar \"%s\"", alias, phar_obj->archive->fname); - RETURN_THROWS(); + goto valid_alias; } + zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error); + efree(error); + RETURN_THROWS(); + } + if (!phar_validate_alias(alias, alias_len)) { + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, + "Invalid alias \"%s\" specified for phar \"%s\"", alias, phar_obj->archive->fname); + RETURN_THROWS(); + } valid_alias: - if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) { - zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname); - RETURN_THROWS(); - } - if (phar_obj->archive->alias_len && NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_G(phar_alias_map)), phar_obj->archive->alias, phar_obj->archive->alias_len))) { - zend_hash_str_del(&(PHAR_G(phar_alias_map)), phar_obj->archive->alias, phar_obj->archive->alias_len); - readd = 1; - } + if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) { + zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname); + RETURN_THROWS(); + } + if (phar_obj->archive->alias_len && NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_G(phar_alias_map)), phar_obj->archive->alias, phar_obj->archive->alias_len))) { + zend_hash_str_del(&(PHAR_G(phar_alias_map)), phar_obj->archive->alias, phar_obj->archive->alias_len); + readd = 1; + } - oldalias = phar_obj->archive->alias; - oldalias_len = phar_obj->archive->alias_len; - old_temp = phar_obj->archive->is_temporary_alias; + oldalias = phar_obj->archive->alias; + oldalias_len = phar_obj->archive->alias_len; + old_temp = phar_obj->archive->is_temporary_alias; - if (alias_len) { - phar_obj->archive->alias = estrndup(alias, alias_len); - } else { - phar_obj->archive->alias = NULL; - } + if (alias_len) { + phar_obj->archive->alias = estrndup(alias, alias_len); + } else { + phar_obj->archive->alias = NULL; + } - phar_obj->archive->alias_len = alias_len; - phar_obj->archive->is_temporary_alias = 0; - phar_flush(phar_obj->archive, NULL, 0, 0, &error); + phar_obj->archive->alias_len = alias_len; + phar_obj->archive->is_temporary_alias = 0; + phar_flush(phar_obj->archive, NULL, 0, 0, &error); - if (error) { - phar_obj->archive->alias = oldalias; - phar_obj->archive->alias_len = oldalias_len; - phar_obj->archive->is_temporary_alias = old_temp; - zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error); - if (readd) { - zend_hash_str_add_ptr(&(PHAR_G(phar_alias_map)), oldalias, oldalias_len, phar_obj->archive); - } - efree(error); - RETURN_THROWS(); + if (error) { + phar_obj->archive->alias = oldalias; + phar_obj->archive->alias_len = oldalias_len; + phar_obj->archive->is_temporary_alias = old_temp; + zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error); + if (readd) { + zend_hash_str_add_ptr(&(PHAR_G(phar_alias_map)), oldalias, oldalias_len, phar_obj->archive); } + efree(error); + RETURN_THROWS(); + } - zend_hash_str_add_ptr(&(PHAR_G(phar_alias_map)), alias, alias_len, phar_obj->archive); - - if (oldalias) { - efree(oldalias); - } + zend_hash_str_add_ptr(&(PHAR_G(phar_alias_map)), alias, alias_len, phar_obj->archive); - RETURN_TRUE; + if (oldalias) { + efree(oldalias); } - RETURN_FALSE; + RETURN_TRUE; } /* }}} */ @@ -4305,19 +4296,22 @@ PHP_METHOD(Phar, extractTo) php_stream *fp; php_stream_statbuf ssb; char *pathto; - zend_string *filename; + zend_string *filename = NULL; size_t pathto_len; int ret; zval *zval_file; - zval *zval_files = NULL; + HashTable *files_ht = NULL; zend_bool overwrite = 0; char *error = NULL; - PHAR_ARCHIVE_OBJECT(); + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_PATH(pathto, pathto_len) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(filename, files_ht) + Z_PARAM_BOOL(overwrite) + ZEND_PARSE_PARAMETERS_END(); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|z!b", &pathto, &pathto_len, &zval_files, &overwrite) == FAILURE) { - RETURN_THROWS(); - } + PHAR_ARCHIVE_OBJECT(); fp = php_stream_open_wrapper(phar_obj->archive->fname, "rb", IGNORE_URL|STREAM_MUST_SEEK, NULL); @@ -4356,47 +4350,32 @@ PHP_METHOD(Phar, extractTo) RETURN_THROWS(); } - if (zval_files) { - switch (Z_TYPE_P(zval_files)) { - case IS_NULL: - filename = NULL; - break; - case IS_STRING: - filename = Z_STR_P(zval_files); - break; - case IS_ARRAY: - if (zend_hash_num_elements(Z_ARRVAL_P(zval_files)) == 0) { - RETURN_FALSE; - } + if (files_ht) { + if (zend_hash_num_elements(files_ht) == 0) { + RETURN_FALSE; + } - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(zval_files), zval_file) { - ZVAL_DEREF(zval_file); - if (IS_STRING != Z_TYPE_P(zval_file)) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, - "Invalid argument, array of filenames to extract contains non-string value"); - RETURN_THROWS(); - } - switch (extract_helper(phar_obj->archive, Z_STR_P(zval_file), pathto, pathto_len, overwrite, &error)) { - case -1: - zend_throw_exception_ex(phar_ce_PharException, 0, "Extraction from phar \"%s\" failed: %s", - phar_obj->archive->fname, error); - efree(error); - RETURN_THROWS(); - case 0: - zend_throw_exception_ex(phar_ce_PharException, 0, - "phar error: attempted to extract non-existent file or directory \"%s\" from phar \"%s\"", - ZSTR_VAL(Z_STR_P(zval_file)), phar_obj->archive->fname); - RETURN_THROWS(); - } - } ZEND_HASH_FOREACH_END(); - RETURN_TRUE; - default: + ZEND_HASH_FOREACH_VAL(files_ht, zval_file) { + ZVAL_DEREF(zval_file); + if (IS_STRING != Z_TYPE_P(zval_file)) { zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, - "Invalid argument, expected a filename (string) or array of filenames"); + "Invalid argument, array of filenames to extract contains non-string value"); RETURN_THROWS(); - } - } else { - filename = NULL; + } + switch (extract_helper(phar_obj->archive, Z_STR_P(zval_file), pathto, pathto_len, overwrite, &error)) { + case -1: + zend_throw_exception_ex(phar_ce_PharException, 0, "Extraction from phar \"%s\" failed: %s", + phar_obj->archive->fname, error); + efree(error); + RETURN_THROWS(); + case 0: + zend_throw_exception_ex(phar_ce_PharException, 0, + "phar error: attempted to extract non-existent file or directory \"%s\" from phar \"%s\"", + ZSTR_VAL(Z_STR_P(zval_file)), phar_obj->archive->fname); + RETURN_THROWS(); + } + } ZEND_HASH_FOREACH_END(); + RETURN_TRUE; } ret = extract_helper(phar_obj->archive, filename, pathto, pathto_len, overwrite, &error); diff --git a/ext/phar/phar_object.stub.php b/ext/phar/phar_object.stub.php index fe5fed1406..7f0eca1034 100644 --- a/ext/phar/phar_object.stub.php +++ b/ext/phar/phar_object.stub.php @@ -58,7 +58,7 @@ class Phar extends RecursiveDirectoryIterator implements Countable, ArrayAccess public function delMetadata() {} /** @return bool */ - public function extractTo(string $pathto, $files = null, bool $overwrite = false) {} + public function extractTo(string $pathto, array|string|null $files = null, bool $overwrite = false) {} /** @return string|null */ public function getAlias() {} @@ -140,7 +140,7 @@ class Phar extends RecursiveDirectoryIterator implements Countable, ArrayAccess * @param resource $newstub * @return bool */ - public function setStub($newstub, $maxlen = -1) {} + public function setStub($newstub, int $maxlen = -1) {} /** @return void */ public function startBuffering() {} @@ -180,13 +180,13 @@ class Phar extends RecursiveDirectoryIterator implements Countable, ArrayAccess final public static function webPhar( ?string $alias = null, ?string $index = null, string $f404 = UNKNOWN, - array $mimetypes = [], $rewrites = UNKNOWN): void {} + array $mimetypes = [], ?callable $rewrites = null): void {} } class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAccess { /** @alias Phar::__construct */ - public function __construct(string $filename, int $flags = FilesystemIterator::SKIP_DOTS|FilesystemIterator::UNIX_PATHS, ?string $alias = null, $fileformat = 0) {} + public function __construct(string $filename, int $flags = FilesystemIterator::SKIP_DOTS|FilesystemIterator::UNIX_PATHS, ?string $alias = null, int $fileformat = 0) {} /** @alias Phar::__destruct */ public function __destruct() {} @@ -285,7 +285,7 @@ class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAcc * @return bool * @alias Phar::extractTo */ - public function extractTo(string $pathto, $files = null, bool $overwrite = false) {} + public function extractTo(string $pathto, array|string|null $files = null, bool $overwrite = false) {} /** * @return string|null @@ -418,7 +418,7 @@ class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAcc * @return bool * @alias Phar::setStub */ - public function setStub($newstub, $maxlen = -1) {} + public function setStub($newstub, int $maxlen = -1) {} /** * @return void @@ -479,7 +479,7 @@ class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAcc /** @alias Phar::webPhar */ final public static function webPhar( ?string $alias = null, ?string $index = null, string $f404 = UNKNOWN, - array $mimetypes = [], $rewrites = UNKNOWN): void {} + array $mimetypes = [], ?callable $rewrites = null): void {} } class PharFileInfo extends SplFileInfo @@ -519,11 +519,11 @@ class PharFileInfo extends SplFileInfo public function hasMetadata() {} /** @return bool */ - public function isCompressed($compression_type = 9021976) {} + public function isCompressed(int $compression_type = 9021976) {} /** @return bool */ public function isCRCChecked() {} /** @return void */ - public function setMetadata($metadata) {} + public function setMetadata(mixed $metadata) {} } diff --git a/ext/phar/phar_object_arginfo.h b/ext/phar/phar_object_arginfo.h index a4b446d7c5..67b5ba5580 100644 --- a/ext/phar/phar_object_arginfo.h +++ b/ext/phar/phar_object_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 586c79f097e9153b70f6c6e208daa08acc0ce1d4 */ + * Stub hash: f25efd47b496a7d06a30c77911a565a49e383bce */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) @@ -74,7 +74,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_extractTo, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, pathto, IS_STRING, 0) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, files, "null") + ZEND_ARG_TYPE_MASK(0, files, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, overwrite, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() @@ -139,7 +139,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_setStub, 0, 0, 1) ZEND_ARG_INFO(0, newstub) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, maxlen, "-1") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxlen, IS_LONG, 0, "-1") ZEND_END_ARG_INFO() #define arginfo_class_Phar_startBuffering arginfo_class_Phar___destruct @@ -206,14 +206,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Phar_webPhar, 0, 0, IS_VOI ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, index, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO(0, f404, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mimetypes, IS_ARRAY, 0, "[]") - ZEND_ARG_INFO(0, rewrites) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, rewrites, IS_CALLABLE, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PharData___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, "FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, alias, IS_STRING, 1, "null") - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, fileformat, "0") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fileformat, IS_LONG, 0, "0") ZEND_END_ARG_INFO() #define arginfo_class_PharData___destruct arginfo_class_Phar___destruct @@ -355,12 +355,14 @@ ZEND_END_ARG_INFO() #define arginfo_class_PharFileInfo_hasMetadata arginfo_class_Phar___destruct ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PharFileInfo_isCompressed, 0, 0, 0) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, compression_type, "9021976") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, compression_type, IS_LONG, 0, "9021976") ZEND_END_ARG_INFO() #define arginfo_class_PharFileInfo_isCRCChecked arginfo_class_Phar___destruct -#define arginfo_class_PharFileInfo_setMetadata arginfo_class_Phar_setMetadata +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PharFileInfo_setMetadata, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, metadata, IS_MIXED, 0) +ZEND_END_ARG_INFO() ZEND_METHOD(Phar, __construct); diff --git a/ext/phar/tests/cache_list/files/frontcontroller16.phar.inc b/ext/phar/tests/cache_list/files/frontcontroller16.phar.inc index 3c9986da00..442f1fb18f 100644 --- a/ext/phar/tests/cache_list/files/frontcontroller16.phar.inc +++ b/ext/phar/tests/cache_list/files/frontcontroller16.phar.inc @@ -7,7 +7,7 @@ echo "hi"; $a->setStub('getMessage() . "\n"); } echo "oops did not run\n"; diff --git a/ext/phar/tests/cache_list/frontcontroller31.phpt b/ext/phar/tests/cache_list/frontcontroller31.phpt index 54128759f0..897272999c 100644 --- a/ext/phar/tests/cache_list/frontcontroller31.phpt +++ b/ext/phar/tests/cache_list/frontcontroller31.phpt @@ -12,5 +12,9 @@ REQUEST_URI=/frontcontroller31.php Content-type: text/html; charset=UTF-8 --FILE_EXTERNAL-- files/frontcontroller16.phar ---EXPECT-- -phar error: invalid rewrite callback +--EXPECTF-- +Fatal error: Uncaught TypeError: Phar::webPhar(): Argument #5 ($rewrites) must be a valid callback or null, class "fail" not found in %s:%d +Stack trace: +#0 %s(%d): Phar::webPhar('test.phar', '/index.php', '', Array, Array) +#1 {main} + thrown in %s on line %d diff --git a/ext/phar/tests/files/frontcontroller16.phar.inc b/ext/phar/tests/files/frontcontroller16.phar.inc index 3c9986da00..442f1fb18f 100644 --- a/ext/phar/tests/files/frontcontroller16.phar.inc +++ b/ext/phar/tests/files/frontcontroller16.phar.inc @@ -7,7 +7,7 @@ echo "hi"; $a->setStub('getMessage() . "\n"); } echo "oops did not run\n"; diff --git a/ext/phar/tests/frontcontroller31.phpt b/ext/phar/tests/frontcontroller31.phpt index a02c937b58..0554180b86 100644 --- a/ext/phar/tests/frontcontroller31.phpt +++ b/ext/phar/tests/frontcontroller31.phpt @@ -11,5 +11,9 @@ REQUEST_URI=/frontcontroller31.php Content-type: text/html; charset=UTF-8 --FILE_EXTERNAL-- files/frontcontroller16.phar ---EXPECT-- -phar error: invalid rewrite callback +--EXPECTF-- +Fatal error: Uncaught TypeError: Phar::webPhar(): Argument #5 ($rewrites) must be a valid callback or null, class "fail" not found in %s:%d +Stack trace: +#0 %s(%d): Phar::webPhar('test.phar', '/index.php', '', Array, Array) +#1 {main} + thrown in %s on line %d diff --git a/ext/phar/tests/phar_buildfromiterator1.phpt b/ext/phar/tests/phar_buildfromiterator1.phpt index aac85ff33e..c403e8c939 100644 --- a/ext/phar/tests/phar_buildfromiterator1.phpt +++ b/ext/phar/tests/phar_buildfromiterator1.phpt @@ -10,7 +10,8 @@ phar.readonly=0 $phar = new Phar(__DIR__ . '/buildfromiterator1.phar'); try { ini_set('phar.readonly', 1); - $phar->buildFromIterator(1); + + $phar->buildFromIterator(new ArrayIterator([])); } catch (Exception $e) { var_dump(get_class($e)); echo $e->getMessage() . "\n"; diff --git a/ext/phar/tests/phar_extract.phpt b/ext/phar/tests/phar_extract.phpt index bbe95dec0d..0ccd9d50d5 100644 --- a/ext/phar/tests/phar_extract.phpt +++ b/ext/phar/tests/phar_extract.phpt @@ -45,8 +45,8 @@ var_dump(file_get_contents(__DIR__ . '/extract1-2/file2.txt')); var_dump(is_dir(__DIR__ . '/extract1-2/one/level')); try { - $a->extractTo(__DIR__ . '/whatever', 134); -} catch (Exception $e) { + $a->extractTo(__DIR__ . '/whatever', new stdClass()); +} catch (TypeError $e) { echo $e->getMessage(), "\n"; } @@ -141,7 +141,7 @@ string(2) "hi" string(3) "hi3" string(3) "hi2" bool(false) -Invalid argument, expected a filename (string) or array of filenames +Phar::extractTo(): Argument #2 ($files) must be of type string|array|null, stdClass given Phar::extractTo(): Argument #1 ($pathto) must be a valid path, array given Invalid argument, extraction path must be non-zero length Unable to use path "%soops" for extraction, it is a file, must be a directory diff --git a/ext/spl/spl_directory.stub.php b/ext/spl/spl_directory.stub.php index 513dfef8aa..ce56654eb6 100755 --- a/ext/spl/spl_directory.stub.php +++ b/ext/spl/spl_directory.stub.php @@ -206,7 +206,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt public function fread(int $length) {} /** @return array|false */ - public function fgetcsv(string $delimiter = ",", string $enclosure = '"', $escape = "\\") {} + public function fgetcsv(string $delimiter = ",", string $enclosure = '"', string $escape = "\\") {} /** @return int|false */ public function fputcsv(array $fields, string $delimiter = ',', string $enclosure = '"', string $escape = "\\") {} @@ -217,7 +217,10 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt /** @return array */ public function getCsvControl() {} - /** @return bool */ + /** + * @param int $wouldblock + * @return bool + */ public function flock(int $operation, &$wouldblock = null) {} /** @return bool */ @@ -235,11 +238,8 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt /** @return int */ public function fpassthru() {} - /** - * @param string $format - * @return array|int - */ - public function fscanf(string $format, &...$params) {} + /** @return array|int|false|null */ + public function fscanf(string $format, mixed &...$params) {} /** @return int|false */ public function fwrite(string $str, int $length = 0) {} diff --git a/ext/spl/spl_directory_arginfo.h b/ext/spl/spl_directory_arginfo.h index 0f167f7f19..57b096caf7 100644 --- a/ext/spl/spl_directory_arginfo.h +++ b/ext/spl/spl_directory_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: d6b772ea08c57acdea65e983098f5bc4168daaa6 */ + * Stub hash: 55701f921c7df2f344dd6b110558fd97efec9891 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileInfo___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, file_name, IS_STRING, 0) @@ -173,7 +173,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileObject_fgetcsv, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, delimiter, IS_STRING, 0, "\",\"") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, enclosure, IS_STRING, 0, "\'\"\'") - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, escape, "\"\\\\\"") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, escape, IS_STRING, 0, "\"\\\\\"") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileObject_fputcsv, 0, 0, 1) @@ -211,7 +211,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileObject_fscanf, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) - ZEND_ARG_VARIADIC_INFO(1, params) + ZEND_ARG_VARIADIC_TYPE_INFO(1, params, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileObject_fwrite, 0, 0, 1) -- 2.40.0