]> granicus.if.org Git - php/commitdiff
Fix stub for dba_key_split()
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 22 Oct 2020 12:49:48 +0000 (14:49 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 22 Oct 2020 12:50:52 +0000 (14:50 +0200)
This is an extremely weird function, but the behavior seems to be
intentional, and is quite clearly documented.

So we adjust the stub to also accept false|null as arguments. I
believe the implementation already correctly matches union type
semantics.

ext/dba/dba.stub.php
ext/dba/dba_arginfo.h
ext/dba/tests/dba_split.phpt

index 745a88d4f82f35a7a16852b861ca916ebaa875ca..12cccbe506c880649d8b9d9a71b3a7a063812ea3 100644 (file)
@@ -36,7 +36,7 @@ function dba_exists($key, $dba): bool {}
  */
 function dba_fetch($key, $skip, $dba = UNKNOWN): string|false {}
 
-function dba_key_split(string $key): array|false {}
+function dba_key_split(string|false|null $key): array|false {}
 
 /** @param resource $dba */
 function dba_firstkey($dba): string|false {}
index be8d0d6862fe4fd10cf8f5f0d41be49101d71ca4..d92eae0448cc38e29efc9442450fbb3428cd033a 100644 (file)
@@ -1,5 +1,5 @@
 /* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 15c236854ed1d2e775486de5c8018adbd00506f9 */
+ * Stub hash: 63980c2a7227d1b5dbd566efb3efbf8c45c55c0d */
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_popen, 0, 0, 2)
        ZEND_ARG_INFO(0, path)
@@ -26,7 +26,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_dba_fetch, 0, 2, MAY_BE_STRING|M
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_dba_key_split, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
-       ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+       ZEND_ARG_TYPE_MASK(0, key, MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL, NULL)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_dba_firstkey, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
index 246018715033b42d6ccd99a4cf71f9daca32e301..7aafd938d8fd4ff00f4a5064bb4c12f79be12f0a 100644 (file)
@@ -7,8 +7,9 @@ DBA Split Test
 ?>
 --FILE--
 <?php
-var_dump(dba_key_split(1));
 var_dump(dba_key_split(null));
+var_dump(dba_key_split(false));
+var_dump(dba_key_split(1));
 var_dump(dba_key_split(""));
 var_dump(dba_key_split("name1"));
 var_dump(dba_key_split("[key1"));
@@ -20,13 +21,14 @@ var_dump(dba_key_split("[key1]name1"));
 
 ?>
 --EXPECT--
+bool(false)
+bool(false)
 array(2) {
   [0]=>
   string(0) ""
   [1]=>
   string(1) "1"
 }
-bool(false)
 array(2) {
   [0]=>
   string(0) ""