Skip to content

Commit ad7e231

Browse files
committed
Make compression_type nullable in a few more places
Missed that this was also used elsewhere...
1 parent c4a25da commit ad7e231

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

ext/phar/phar_object.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4519,17 +4519,21 @@ PHP_METHOD(PharFileInfo, getCompressedSize)
45194519
/* {{{ Returns whether the entry is compressed, and whether it is compressed with Phar::GZ or Phar::BZ2 if specified */
45204520
PHP_METHOD(PharFileInfo, isCompressed)
45214521
{
4522-
/* a number that is not Phar::GZ or Phar::BZ2 */
4523-
zend_long method = 9021976;
4522+
zend_long method;
4523+
zend_bool method_is_null = 1;
45244524

4525-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &method) == FAILURE) {
4525+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &method, &method_is_null) == FAILURE) {
45264526
RETURN_THROWS();
45274527
}
45284528

45294529
PHAR_ENTRY_OBJECT();
45304530

4531+
if (method_is_null) {
4532+
RETURN_BOOL(entry_obj->entry->flags & PHAR_ENT_COMPRESSION_MASK);
4533+
}
4534+
45314535
switch (method) {
4532-
case 9021976:
4536+
case 9021976: /* Retained for BC */
45334537
RETURN_BOOL(entry_obj->entry->flags & PHAR_ENT_COMPRESSION_MASK);
45344538
case PHAR_ENT_COMPRESSED_GZ:
45354539
RETURN_BOOL(entry_obj->entry->flags & PHAR_ENT_COMPRESSED_GZ);

ext/phar/phar_object.stub.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,13 @@ public function decompress(?string $file_ext = null) {}
245245
* @return Phar|null
246246
* @implementation-alias Phar::convertToExecutable
247247
*/
248-
public function convertToExecutable(int $format = 9021976, int $compression_type = 9021976, ?string $file_ext = null) {}
248+
public function convertToExecutable(?int $format = null, ?int $compression_type = null, ?string $file_ext = null) {}
249249

250250
/**
251251
* @return Phar|null
252252
* @implementation-alias Phar::convertToData
253253
*/
254-
public function convertToData(int $format = 9021976, int $compression_type = 9021976, ?string $file_ext = null) {}
254+
public function convertToData(?int $format = null, ?int $compression_type = null, ?string $file_ext = null) {}
255255

256256
/**
257257
* @return bool
@@ -513,7 +513,7 @@ public function getPharFlags() {}
513513
public function hasMetadata() {}
514514

515515
/** @return bool */
516-
public function isCompressed(int $compression_type = 9021976) {}
516+
public function isCompressed(?int $compression_type = null) {}
517517

518518
/** @return bool */
519519
public function isCRCChecked() {}

ext/phar/phar_object_arginfo.h

Lines changed: 4 additions & 8 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: 7c9fbbc6da2c4d7196583d82102fa857ce8eda6b */
2+
* Stub hash: 8dff2050ad65f94a41176cfb280d02c4fb61dcf7 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar___construct, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
@@ -236,13 +236,9 @@ ZEND_END_ARG_INFO()
236236

237237
#define arginfo_class_PharData_decompress arginfo_class_Phar_decompress
238238

239-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PharData_convertToExecutable, 0, 0, 0)
240-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, format, IS_LONG, 0, "9021976")
241-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, compression_type, IS_LONG, 0, "9021976")
242-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, file_ext, IS_STRING, 1, "null")
243-
ZEND_END_ARG_INFO()
239+
#define arginfo_class_PharData_convertToExecutable arginfo_class_Phar_convertToExecutable
244240

245-
#define arginfo_class_PharData_convertToData arginfo_class_PharData_convertToExecutable
241+
#define arginfo_class_PharData_convertToData arginfo_class_Phar_convertToExecutable
246242

247243
#define arginfo_class_PharData_copy arginfo_class_Phar_copy
248244

@@ -359,7 +355,7 @@ ZEND_END_ARG_INFO()
359355
#define arginfo_class_PharFileInfo_hasMetadata arginfo_class_Phar___destruct
360356

361357
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PharFileInfo_isCompressed, 0, 0, 0)
362-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, compression_type, IS_LONG, 0, "9021976")
358+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, compression_type, IS_LONG, 1, "null")
363359
ZEND_END_ARG_INFO()
364360

365361
#define arginfo_class_PharFileInfo_isCRCChecked arginfo_class_Phar___destruct

0 commit comments

Comments
 (0)