summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2021-02-09 12:55:33 +0100
committerNikita Popov <nikita.ppv@gmail.com>2021-02-09 12:55:33 +0100
commit44192ce80b72c9aaf4aa1af80d14a42ae203d608 (patch)
treefd5091868b6a3eb015d5178c6c0c3a776a930fda
parent3549f48edc914db041d81ae207400971d1c6c43c (diff)
downloadphp-git-44192ce80b72c9aaf4aa1af80d14a42ae203d608.tar.gz
Make Phar $fileNotFoundScript nullable
While "" is already treated the same way as absence, null is the logically correct default here. Making this one argument non-nullable is particularly pecular when considering that the preceding $alias and $index arguments are both nullable.
-rw-r--r--ext/phar/phar_object.c2
-rw-r--r--ext/phar/phar_object.stub.php4
-rw-r--r--ext/phar/phar_object_arginfo.h4
-rw-r--r--ext/phar/tests/cache_list/frontcontroller12.phpt2
-rw-r--r--ext/phar/tests/cache_list/frontcontroller13.phpt2
-rw-r--r--ext/phar/tests/cache_list/frontcontroller31.phpt2
-rw-r--r--ext/phar/tests/frontcontroller12.phpt2
-rw-r--r--ext/phar/tests/frontcontroller13.phpt2
-rw-r--r--ext/phar/tests/frontcontroller31.phpt2
-rw-r--r--ext/phar/tests/tar/frontcontroller12.phar.phpt2
-rw-r--r--ext/phar/tests/tar/frontcontroller13.phar.phpt2
-rw-r--r--ext/phar/tests/zip/frontcontroller12.phar.phpt2
-rw-r--r--ext/phar/tests/zip/frontcontroller13.phar.phpt2
13 files changed, 15 insertions, 15 deletions
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index e45c187efa..5fe9e26af0 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -552,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!saf!", &alias, &alias_len, &index_php, &index_php_len, &f404, &f404_len, &mimeoverride, &rewrite_fci, &rewrite_fcc) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!s!af!", &alias, &alias_len, &index_php, &index_php_len, &f404, &f404_len, &mimeoverride, &rewrite_fci, &rewrite_fcc) == FAILURE) {
RETURN_THROWS();
}
diff --git a/ext/phar/phar_object.stub.php b/ext/phar/phar_object.stub.php
index 31663e4b8c..5a1122c74f 100644
--- a/ext/phar/phar_object.stub.php
+++ b/ext/phar/phar_object.stub.php
@@ -174,7 +174,7 @@ class Phar extends RecursiveDirectoryIterator implements Countable, ArrayAccess
final public static function unlinkArchive(string $filename): bool {}
final public static function webPhar(
- ?string $alias = null, ?string $index = null, string $fileNotFoundScript = "",
+ ?string $alias = null, ?string $index = null, ?string $fileNotFoundScript = null,
array $mimeTypes = [], ?callable $rewrite = null): void {}
}
@@ -470,7 +470,7 @@ class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAcc
/** @implementation-alias Phar::webPhar */
final public static function webPhar(
- ?string $alias = null, ?string $index = null, string $fileNotFoundScript = "",
+ ?string $alias = null, ?string $index = null, ?string $fileNotFoundScript = null,
array $mimeTypes = [], ?callable $rewrite = null): void {}
}
diff --git a/ext/phar/phar_object_arginfo.h b/ext/phar/phar_object_arginfo.h
index dd4b8aba75..ade8f874ab 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: 3575a0330ff6102461655bc84add44e8b08b585f */
+ * Stub hash: a8562e63010e127aadb97134733ac328ced3c7bf */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
@@ -204,7 +204,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Phar_webPhar, 0, 0, IS_VOID, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, alias, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, index, IS_STRING, 1, "null")
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fileNotFoundScript, IS_STRING, 0, "\"\"")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fileNotFoundScript, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mimeTypes, IS_ARRAY, 0, "[]")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, rewrite, IS_CALLABLE, 1, "null")
ZEND_END_ARG_INFO()
diff --git a/ext/phar/tests/cache_list/frontcontroller12.phpt b/ext/phar/tests/cache_list/frontcontroller12.phpt
index 8b78e62c9c..857b7dc875 100644
--- a/ext/phar/tests/cache_list/frontcontroller12.phpt
+++ b/ext/phar/tests/cache_list/frontcontroller12.phpt
@@ -16,6 +16,6 @@ Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught PharException: Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed in %sfrontcontroller12.php:2
Stack trace:
-#0 %sfrontcontroller12.php(2): Phar::webPhar('whatever', 'index.php', '', Array)
+#0 %sfrontcontroller12.php(2): Phar::webPhar('whatever', 'index.php', NULL, Array)
#1 {main}
thrown in %sfrontcontroller12.php on line 2
diff --git a/ext/phar/tests/cache_list/frontcontroller13.phpt b/ext/phar/tests/cache_list/frontcontroller13.phpt
index 9d2f9105da..ddbab34c07 100644
--- a/ext/phar/tests/cache_list/frontcontroller13.phpt
+++ b/ext/phar/tests/cache_list/frontcontroller13.phpt
@@ -16,6 +16,6 @@ Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught PharException: Unknown mime type specifier used (not a string or int), only Phar::PHP, Phar::PHPS and a mime type string are allowed in %sfrontcontroller13.php:2
Stack trace:
-#0 %sfrontcontroller13.php(2): Phar::webPhar('whatever', 'index.php', '', Array)
+#0 %sfrontcontroller13.php(2): Phar::webPhar('whatever', 'index.php', NULL, Array)
#1 {main}
thrown in %sfrontcontroller13.php on line 2
diff --git a/ext/phar/tests/cache_list/frontcontroller31.phpt b/ext/phar/tests/cache_list/frontcontroller31.phpt
index 41e36bf669..3419bb381d 100644
--- a/ext/phar/tests/cache_list/frontcontroller31.phpt
+++ b/ext/phar/tests/cache_list/frontcontroller31.phpt
@@ -15,6 +15,6 @@ files/frontcontroller16.phar
--EXPECTF--
Fatal error: Uncaught TypeError: Phar::webPhar(): Argument #5 ($rewrite) 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)
+#0 %s(%d): Phar::webPhar('test.phar', '/index.php', NULL, Array, Array)
#1 {main}
thrown in %s on line %d
diff --git a/ext/phar/tests/frontcontroller12.phpt b/ext/phar/tests/frontcontroller12.phpt
index a7b1a892d6..40bd8e333f 100644
--- a/ext/phar/tests/frontcontroller12.phpt
+++ b/ext/phar/tests/frontcontroller12.phpt
@@ -15,6 +15,6 @@ Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught PharException: Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed in %sfrontcontroller12.php:2
Stack trace:
-#0 %sfrontcontroller12.php(2): Phar::webPhar('whatever', 'index.php', '', Array)
+#0 %sfrontcontroller12.php(2): Phar::webPhar('whatever', 'index.php', NULL, Array)
#1 {main}
thrown in %sfrontcontroller12.php on line 2
diff --git a/ext/phar/tests/frontcontroller13.phpt b/ext/phar/tests/frontcontroller13.phpt
index 99b769d406..60d5709c6f 100644
--- a/ext/phar/tests/frontcontroller13.phpt
+++ b/ext/phar/tests/frontcontroller13.phpt
@@ -15,6 +15,6 @@ Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught PharException: Unknown mime type specifier used (not a string or int), only Phar::PHP, Phar::PHPS and a mime type string are allowed in %sfrontcontroller13.php:2
Stack trace:
-#0 %sfrontcontroller13.php(2): Phar::webPhar('whatever', 'index.php', '', Array)
+#0 %sfrontcontroller13.php(2): Phar::webPhar('whatever', 'index.php', NULL, Array)
#1 {main}
thrown in %sfrontcontroller13.php on line 2
diff --git a/ext/phar/tests/frontcontroller31.phpt b/ext/phar/tests/frontcontroller31.phpt
index 721df4849c..121a9389ee 100644
--- a/ext/phar/tests/frontcontroller31.phpt
+++ b/ext/phar/tests/frontcontroller31.phpt
@@ -14,6 +14,6 @@ files/frontcontroller16.phar
--EXPECTF--
Fatal error: Uncaught TypeError: Phar::webPhar(): Argument #5 ($rewrite) 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)
+#0 %s(%d): Phar::webPhar('test.phar', '/index.php', NULL, Array, Array)
#1 {main}
thrown in %s on line %d
diff --git a/ext/phar/tests/tar/frontcontroller12.phar.phpt b/ext/phar/tests/tar/frontcontroller12.phar.phpt
index cbb928ff77..cec426b05a 100644
--- a/ext/phar/tests/tar/frontcontroller12.phar.phpt
+++ b/ext/phar/tests/tar/frontcontroller12.phar.phpt
@@ -15,6 +15,6 @@ Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught PharException: Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed in %sfrontcontroller12.phar.php:2
Stack trace:
-#0 %sfrontcontroller12.phar.php(2): Phar::webPhar('whatever', 'index.php', '', Array)
+#0 %sfrontcontroller12.phar.php(2): Phar::webPhar('whatever', 'index.php', NULL, Array)
#1 {main}
thrown in %sfrontcontroller12.phar.php on line 2
diff --git a/ext/phar/tests/tar/frontcontroller13.phar.phpt b/ext/phar/tests/tar/frontcontroller13.phar.phpt
index 107961a70f..7d9992cb9d 100644
--- a/ext/phar/tests/tar/frontcontroller13.phar.phpt
+++ b/ext/phar/tests/tar/frontcontroller13.phar.phpt
@@ -15,6 +15,6 @@ Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught PharException: Unknown mime type specifier used (not a string or int), only Phar::PHP, Phar::PHPS and a mime type string are allowed in %sfrontcontroller13.phar.php:2
Stack trace:
-#0 %sfrontcontroller13.phar.php(2): Phar::webPhar('whatever', 'index.php', '', Array)
+#0 %sfrontcontroller13.phar.php(2): Phar::webPhar('whatever', 'index.php', NULL, Array)
#1 {main}
thrown in %sfrontcontroller13.phar.php on line 2
diff --git a/ext/phar/tests/zip/frontcontroller12.phar.phpt b/ext/phar/tests/zip/frontcontroller12.phar.phpt
index 9f5b0a13aa..2169264b64 100644
--- a/ext/phar/tests/zip/frontcontroller12.phar.phpt
+++ b/ext/phar/tests/zip/frontcontroller12.phar.phpt
@@ -17,6 +17,6 @@ Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught PharException: Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed in %sfrontcontroller12.phar.php:2
Stack trace:
-#0 %sfrontcontroller12.phar.php(2): Phar::webPhar('whatever', 'index.php', '', Array)
+#0 %sfrontcontroller12.phar.php(2): Phar::webPhar('whatever', 'index.php', NULL, Array)
#1 {main}
thrown in %sfrontcontroller12.phar.php on line 2
diff --git a/ext/phar/tests/zip/frontcontroller13.phar.phpt b/ext/phar/tests/zip/frontcontroller13.phar.phpt
index 5d2a77e4ac..c9c72a7a60 100644
--- a/ext/phar/tests/zip/frontcontroller13.phar.phpt
+++ b/ext/phar/tests/zip/frontcontroller13.phar.phpt
@@ -17,6 +17,6 @@ Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught PharException: Unknown mime type specifier used (not a string or int), only Phar::PHP, Phar::PHPS and a mime type string are allowed in %sfrontcontroller13.phar.php:2
Stack trace:
-#0 %sfrontcontroller13.phar.php(2): Phar::webPhar('whatever', 'index.php', '', Array)
+#0 %sfrontcontroller13.phar.php(2): Phar::webPhar('whatever', 'index.php', NULL, Array)
#1 {main}
thrown in %sfrontcontroller13.phar.php on line 2