From: Nikita Popov Date: Thu, 22 Oct 2020 12:49:48 +0000 (+0200) Subject: Fix stub for dba_key_split() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=97dd0eb98d6727f8f7e5dbbf9b7d96b08d8cccbd;p=php 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. --- 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-- --EXPECT-- +bool(false) +bool(false) array(2) { [0]=> string(0) "" [1]=> string(1) "1" } -bool(false) array(2) { [0]=> string(0) ""