summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-10-22 14:49:48 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-10-22 14:50:52 +0200
commit97dd0eb98d6727f8f7e5dbbf9b7d96b08d8cccbd (patch)
treeb8fe272c6a41768b935ea82089b6fdfea684032c
parentdb5979dfe25e0ce51ea8c2c241ff45251ffd2751 (diff)
downloadphp-git-97dd0eb98d6727f8f7e5dbbf9b7d96b08d8cccbd.tar.gz
Fix stub for dba_key_split()
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.
-rw-r--r--ext/dba/dba.stub.php2
-rw-r--r--ext/dba/dba_arginfo.h4
-rw-r--r--ext/dba/tests/dba_split.phpt6
3 files changed, 7 insertions, 5 deletions
diff --git a/ext/dba/dba.stub.php b/ext/dba/dba.stub.php
index 745a88d4f8..12cccbe506 100644
--- a/ext/dba/dba.stub.php
+++ b/ext/dba/dba.stub.php
@@ -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 {}
diff --git a/ext/dba/dba_arginfo.h b/ext/dba/dba_arginfo.h
index be8d0d6862..d92eae0448 100644
--- a/ext/dba/dba_arginfo.h
+++ b/ext/dba/dba_arginfo.h
@@ -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)
diff --git a/ext/dba/tests/dba_split.phpt b/ext/dba/tests/dba_split.phpt
index 2460187150..7aafd938d8 100644
--- a/ext/dba/tests/dba_split.phpt
+++ b/ext/dba/tests/dba_split.phpt
@@ -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) ""