]> granicus.if.org Git - php/commitdiff
Fix stub for Phar::setStub()
authorDylan K. Taylor <odigiman@gmail.com>
Tue, 12 Jan 2021 01:49:38 +0000 (01:49 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 18 Jan 2021 11:59:18 +0000 (12:59 +0100)
This fixes multiple issues:
 * The first parameter may be resource|string.
 * It's an overloaded signature. The second parameter cannot be
   passed if the first one is a string. Use UNKNOWN default
   value for that reason.
 * Make parameter names in PharData::setStub() match those in
   Phar.

Closes GH-6596.

ext/phar/phar_object.stub.php
ext/phar/phar_object_arginfo.h

index f51b3b0368b3e5d1002a5588b4ba50f90cf0684b..ccf18ecb93085f10207ab9cdd01693f3ae21672f 100644 (file)
@@ -134,10 +134,10 @@ class Phar extends RecursiveDirectoryIterator implements Countable, ArrayAccess
     public function setSignatureAlgorithm(int $algo, ?string $privateKey = null) {}
 
     /**
-     * @param resource $stub
+     * @param resource|string $stub
      * @return bool
      */
-    public function setStub($stub, int $length = -1) {}
+    public function setStub($stub, int $length = UNKNOWN) {}
 
     /** @return void */
     public function startBuffering() {}
@@ -408,11 +408,11 @@ class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAcc
     public function setSignatureAlgorithm(int $algo, ?string $privateKey = null) {}
 
     /**
-     * @param resource $newstub
+     * @param resource|string $stub
      * @return bool
      * @implementation-alias Phar::setStub
      */
-    public function setStub($newstub, int $maxlen = -1) {}
+    public function setStub($stub, int $length = UNKNOWN) {}
 
     /**
      * @return void
index 0998eec27a5ec75e594d0ccce5626ecf75ef4d64..0a06893803ad465b00cca9087406d5f63fdbebfe 100644 (file)
@@ -1,5 +1,5 @@
 /* This is a generated file, edit the .stub.php file instead.
- * Stub hash: e06a2ea3d97778e61aca0f91fda7b72c29ef171d */
+ * Stub hash: 05d4689eb65b244c41c68c13ff39feca6a79a7e1 */
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar___construct, 0, 0, 1)
        ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
@@ -139,7 +139,7 @@ ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_setStub, 0, 0, 1)
        ZEND_ARG_INFO(0, stub)
-       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "-1")
+       ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
 ZEND_END_ARG_INFO()
 
 #define arginfo_class_Phar_startBuffering arginfo_class_Phar___destruct
@@ -292,10 +292,7 @@ ZEND_END_ARG_INFO()
 
 #define arginfo_class_PharData_setSignatureAlgorithm arginfo_class_Phar_setSignatureAlgorithm
 
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PharData_setStub, 0, 0, 1)
-       ZEND_ARG_INFO(0, newstub)
-       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxlen, IS_LONG, 0, "-1")
-ZEND_END_ARG_INFO()
+#define arginfo_class_PharData_setStub arginfo_class_Phar_setStub
 
 #define arginfo_class_PharData_startBuffering arginfo_class_Phar___destruct