From 7b1c32eb3c0c36c600bf2036519a3505798a0807 Mon Sep 17 00:00:00 2001 From: Takuya Aramaki Date: Sun, 7 Jun 2026 23:15:14 +0900 Subject: [PATCH] More precise `unserialize()` parameter types - Values of `allowed_classes` must be `class-string` - `max_depth` was added in PHP 7.4 https://www.php.net/unserialize --- resources/functionMap.php | 2 +- resources/functionMap_php74delta.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/functionMap.php b/resources/functionMap.php index 4927b02284a..db14ea0b673 100644 --- a/resources/functionMap.php +++ b/resources/functionMap.php @@ -11287,7 +11287,7 @@ 'unlink' => ['bool', 'filename'=>'string', 'context='=>'resource'], 'unpack' => ['array|false', 'format'=>'string', 'data'=>'string', 'offset='=>'int'], 'unregister_tick_function' => ['void', 'function_name'=>'callable'], -'unserialize' => ['mixed', 'variable_representation'=>'string', 'allowed_classes='=>'array{allowed_classes?:string[]|bool}'], +'unserialize' => ['mixed', 'data'=>'string', 'options='=>'array{allowed_classes?:class-string[]|bool}'], 'untaint' => ['bool', '&rw_string'=>'string', '&...rw_strings='=>'string'], 'uopz_add_function' => ['bool', 'class'=>'string', 'function'=>'string', 'handler'=>'Closure', '$flags'=>'int', '$all'=>'bool'], 'uopz_add_function\'1' => ['bool', 'function'=>'string', 'handler'=>'Closure', '$flags'=>'int'], diff --git a/resources/functionMap_php74delta.php b/resources/functionMap_php74delta.php index ac48bed6ff5..f14f669e989 100644 --- a/resources/functionMap_php74delta.php +++ b/resources/functionMap_php74delta.php @@ -58,6 +58,7 @@ 'WeakReference::create' => ['WeakReference', 'referent'=>'object'], 'WeakReference::get' => ['?object'], 'proc_open' => ['resource|false', 'command'=>'string|list', 'descriptorspec'=>'array', '&w_pipes'=>'resource[]', 'cwd='=>'?string', 'env='=>'?array', 'other_options='=>'array'], + 'unserialize' => ['mixed', 'data'=>'string', 'options='=>'array{allowed_classes?:class-string[]|bool,max_depth?:int<0,max>}'], ], 'old' => [ 'implode\'2' => ['string', 'pieces'=>'array', 'glue'=>'string'],