]> granicus.if.org Git - php/commitdiff
Return empty string instead of NULL in serialize().
authorGeorge Peter Banyard <girgias@php.net>
Wed, 11 Dec 2019 22:59:13 +0000 (23:59 +0100)
committerGeorge Peter Banyard <girgias@php.net>
Wed, 11 Dec 2019 23:01:28 +0000 (00:01 +0100)
Modifiy its return type accordingly and arginfo.

ext/standard/basic_functions.stub.php
ext/standard/basic_functions_arginfo.h
ext/standard/var.c

index 88ff210d72d83059c63f6548419c8d55fca186a2..75eeaffedfcd337d89e30a1d16e4b4c7c2c41fca 100755 (executable)
@@ -1295,7 +1295,7 @@ function var_export($value, bool $return = false): ?string {}
 function debug_zval_dump($value, ...$value): void {}
 
 /** @param mixed $value */
-function serialize($value): ?string {}
+function serialize($value): string {}
 
 /** @return mixed */
 function unserialize(string $value, array $options = []) {}
index 74f3ee3998fb012232d44d0d0f1744d1d348c86a..0ffd3e7ee65ab189e8895c5a381056c5dca11240 100755 (executable)
@@ -1940,7 +1940,7 @@ ZEND_END_ARG_INFO()
 
 #define arginfo_debug_zval_dump arginfo_var_dump
 
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_serialize, 0, 1, IS_STRING, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_serialize, 0, 1, IS_STRING, 0)
        ZEND_ARG_INFO(0, value)
 ZEND_END_ARG_INFO()
 
index bbaf6cde223071d952fb1562837a09d7e0801cdb..cd5ceda889327705cb8297ca982796b4a3018105 100644 (file)
@@ -1138,7 +1138,7 @@ PHPAPI void php_var_serialize_destroy(php_serialize_data_t d) {
        }
 }
 
-/* {{{ proto string|null serialize(mixed variable)
+/* {{{ proto string serialize(mixed variable)
    Returns a string representation of variable (which can later be unserialized) */
 PHP_FUNCTION(serialize)
 {
@@ -1162,7 +1162,7 @@ PHP_FUNCTION(serialize)
        if (buf.s) {
                RETURN_NEW_STR(buf.s);
        } else {
-               RETURN_NULL();
+               RETURN_EMPTY_STRING();
        }
 }
 /* }}} */