From cdb3265081e03ef79ae0e0f6c97ee07597cbcb3e Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 24 Feb 2022 10:54:52 +0100 Subject: [PATCH 1/4] Fix substr return type on php<8 --- resources/functionMap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/functionMap.php b/resources/functionMap.php index 2774105217..31b6f82abd 100644 --- a/resources/functionMap.php +++ b/resources/functionMap.php @@ -11798,7 +11798,7 @@ 'strtr' => ['string', 'str'=>'string', 'from'=>'string', 'to'=>'string'], 'strtr\'1' => ['string', 'str'=>'string', 'replace_pairs'=>'array'], 'strval' => ['string', 'var'=>'mixed'], -'substr' => ['string', 'string'=>'string', 'start'=>'int', 'length='=>'int'], +'substr' => ['string|false', 'string'=>'string', 'start'=>'int', 'length='=>'int'], 'substr_compare' => ['int|false', 'main_str'=>'string', 'str'=>'string', 'offset'=>'int', 'length='=>'int', 'case_sensitivity='=>'bool'], 'substr_count' => ['0|positive-int', 'haystack'=>'string', 'needle'=>'string', 'offset='=>'int', 'length='=>'int'], 'substr_replace' => ['string|array', 'str'=>'string|array', 'repl'=>'mixed', 'start'=>'mixed', 'length='=>'mixed'], From 05f9e65af4f49de329cec4ba1bacdefc0ed9fb68 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 24 Feb 2022 10:56:06 +0100 Subject: [PATCH 2/4] Add new return type to php80delta --- resources/functionMap_php80delta.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/functionMap_php80delta.php b/resources/functionMap_php80delta.php index 74e26d108e..3e0c783141 100644 --- a/resources/functionMap_php80delta.php +++ b/resources/functionMap_php80delta.php @@ -102,6 +102,7 @@ 'strripos' => ['int|false', 'haystack'=>'string', 'needle'=>'string', 'offset='=>'int'], 'strrpos' => ['int|false', 'haystack'=>'string', 'needle'=>'string', 'offset='=>'int'], 'strstr' => ['string|false', 'haystack'=>'string', 'needle'=>'string', 'before_needle='=>'bool'], + 'substr' => ['string', 'string'=>'string', 'start'=>'int', 'length='=>'int'], 'version_compare' => ['int|bool', 'version1'=>'string', 'version2'=>'string', 'operator='=>'string'], 'xml_parser_create' => ['XMLParser', 'encoding='=>'string'], 'xml_parser_create_ns' => ['XMLParser', 'encoding='=>'string', 'sep='=>'string'], @@ -227,6 +228,7 @@ 'strripos' => ['int|false', 'haystack'=>'string', 'needle'=>'string|int', 'offset='=>'int'], 'strrpos' => ['int|false', 'haystack'=>'string', 'needle'=>'string|int', 'offset='=>'int'], 'strstr' => ['string|false', 'haystack'=>'string', 'needle'=>'string|int', 'before_needle='=>'bool'], + 'substr' => ['string|false', 'string'=>'string', 'start'=>'int', 'length='=>'int'], 'version_compare' => ['int|bool', 'version1'=>'string', 'version2'=>'string', 'operator='=>'string'], 'xml_parser_create' => ['resource', 'encoding='=>'string'], 'xml_parser_create_ns' => ['resource', 'encoding='=>'string', 'sep='=>'string'], From 6985e29e77f11fd51c9f3ca6487d5b89888ed363 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 24 Feb 2022 11:10:25 +0100 Subject: [PATCH 3/4] Use benevolent union instead --- resources/functionMap_php80delta.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/functionMap_php80delta.php b/resources/functionMap_php80delta.php index 3e0c783141..dd7212a314 100644 --- a/resources/functionMap_php80delta.php +++ b/resources/functionMap_php80delta.php @@ -228,7 +228,7 @@ 'strripos' => ['int|false', 'haystack'=>'string', 'needle'=>'string|int', 'offset='=>'int'], 'strrpos' => ['int|false', 'haystack'=>'string', 'needle'=>'string|int', 'offset='=>'int'], 'strstr' => ['string|false', 'haystack'=>'string', 'needle'=>'string|int', 'before_needle='=>'bool'], - 'substr' => ['string|false', 'string'=>'string', 'start'=>'int', 'length='=>'int'], + 'substr' => ['__benevolent', 'string'=>'string', 'start'=>'int', 'length='=>'int'], 'version_compare' => ['int|bool', 'version1'=>'string', 'version2'=>'string', 'operator='=>'string'], 'xml_parser_create' => ['resource', 'encoding='=>'string'], 'xml_parser_create_ns' => ['resource', 'encoding='=>'string', 'sep='=>'string'], From 8c318684f4e15aca8df56af22e3ec10bd082ca1f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 24 Feb 2022 11:10:42 +0100 Subject: [PATCH 4/4] Use benevolent union instead --- resources/functionMap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/functionMap.php b/resources/functionMap.php index 31b6f82abd..5b31aa5b92 100644 --- a/resources/functionMap.php +++ b/resources/functionMap.php @@ -11798,7 +11798,7 @@ 'strtr' => ['string', 'str'=>'string', 'from'=>'string', 'to'=>'string'], 'strtr\'1' => ['string', 'str'=>'string', 'replace_pairs'=>'array'], 'strval' => ['string', 'var'=>'mixed'], -'substr' => ['string|false', 'string'=>'string', 'start'=>'int', 'length='=>'int'], +'substr' => ['__benevolent', 'string'=>'string', 'start'=>'int', 'length='=>'int'], 'substr_compare' => ['int|false', 'main_str'=>'string', 'str'=>'string', 'offset'=>'int', 'length='=>'int', 'case_sensitivity='=>'bool'], 'substr_count' => ['0|positive-int', 'haystack'=>'string', 'needle'=>'string', 'offset='=>'int', 'length='=>'int'], 'substr_replace' => ['string|array', 'str'=>'string|array', 'repl'=>'mixed', 'start'=>'mixed', 'length='=>'mixed'],