Skip to content

Commit 0aad774

Browse files
dktappsnikic
authored andcommitted
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 phpGH-6596.
1 parent c321896 commit 0aad774

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

ext/phar/phar_object.stub.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ public function setMetadata(mixed $metadata) {}
134134
public function setSignatureAlgorithm(int $algo, ?string $privateKey = null) {}
135135

136136
/**
137-
* @param resource $stub
137+
* @param resource|string $stub
138138
* @return bool
139139
*/
140-
public function setStub($stub, int $length = -1) {}
140+
public function setStub($stub, int $length = UNKNOWN) {}
141141

142142
/** @return void */
143143
public function startBuffering() {}
@@ -408,11 +408,11 @@ public function setMetadata(mixed $metadata) {}
408408
public function setSignatureAlgorithm(int $algo, ?string $privateKey = null) {}
409409

410410
/**
411-
* @param resource $newstub
411+
* @param resource|string $stub
412412
* @return bool
413413
* @implementation-alias Phar::setStub
414414
*/
415-
public function setStub($newstub, int $maxlen = -1) {}
415+
public function setStub($stub, int $length = UNKNOWN) {}
416416

417417
/**
418418
* @return void

ext/phar/phar_object_arginfo.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: e06a2ea3d97778e61aca0f91fda7b72c29ef171d */
2+
* Stub hash: 05d4689eb65b244c41c68c13ff39feca6a79a7e1 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar___construct, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
@@ -139,7 +139,7 @@ ZEND_END_ARG_INFO()
139139

140140
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_setStub, 0, 0, 1)
141141
ZEND_ARG_INFO(0, stub)
142-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "-1")
142+
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
143143
ZEND_END_ARG_INFO()
144144

145145
#define arginfo_class_Phar_startBuffering arginfo_class_Phar___destruct
@@ -292,10 +292,7 @@ ZEND_END_ARG_INFO()
292292

293293
#define arginfo_class_PharData_setSignatureAlgorithm arginfo_class_Phar_setSignatureAlgorithm
294294

295-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PharData_setStub, 0, 0, 1)
296-
ZEND_ARG_INFO(0, newstub)
297-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxlen, IS_LONG, 0, "-1")
298-
ZEND_END_ARG_INFO()
295+
#define arginfo_class_PharData_setStub arginfo_class_Phar_setStub
299296

300297
#define arginfo_class_PharData_startBuffering arginfo_class_Phar___destruct
301298

0 commit comments

Comments
 (0)