summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan K. Taylor <odigiman@gmail.com>2021-01-12 01:49:38 +0000
committerNikita Popov <nikita.ppv@gmail.com>2021-01-18 12:59:18 +0100
commit0aad77418da25a4b3af63c453e3313aa7358902e (patch)
tree956b9aac873dd553b634f0525791f27e27251ce9
parentc321896a372c3358663f2f1e8721c61c46634a0c (diff)
downloadphp-git-0aad77418da25a4b3af63c453e3313aa7358902e.tar.gz
Fix stub for Phar::setStub()
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.
-rw-r--r--ext/phar/phar_object.stub.php8
-rw-r--r--ext/phar/phar_object_arginfo.h9
2 files changed, 7 insertions, 10 deletions
diff --git a/ext/phar/phar_object.stub.php b/ext/phar/phar_object.stub.php
index f51b3b0368..ccf18ecb93 100644
--- a/ext/phar/phar_object.stub.php
+++ b/ext/phar/phar_object.stub.php
@@ -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
diff --git a/ext/phar/phar_object_arginfo.h b/ext/phar/phar_object_arginfo.h
index 0998eec27a..0a06893803 100644
--- a/ext/phar/phar_object_arginfo.h
+++ b/ext/phar/phar_object_arginfo.h
@@ -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