summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-10-08 17:04:48 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-10-08 17:05:38 +0200
commitad7e231e81a9ee27217bae977e5c847254df5b60 (patch)
tree394705fabcaa497a47c6e06c63a2c3a022a8e137
parentc4a25da096611360a862791ea1c323bad3270ec1 (diff)
downloadphp-git-ad7e231e81a9ee27217bae977e5c847254df5b60.tar.gz
Make compression_type nullable in a few more places
Missed that this was also used elsewhere...
-rw-r--r--ext/phar/phar_object.c12
-rw-r--r--ext/phar/phar_object.stub.php6
-rw-r--r--ext/phar/phar_object_arginfo.h12
3 files changed, 15 insertions, 15 deletions
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index 089dec02fa..0cb94de993 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -4519,17 +4519,21 @@ PHP_METHOD(PharFileInfo, getCompressedSize)
/* {{{ Returns whether the entry is compressed, and whether it is compressed with Phar::GZ or Phar::BZ2 if specified */
PHP_METHOD(PharFileInfo, isCompressed)
{
- /* a number that is not Phar::GZ or Phar::BZ2 */
- zend_long method = 9021976;
+ zend_long method;
+ zend_bool method_is_null = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &method) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &method, &method_is_null) == FAILURE) {
RETURN_THROWS();
}
PHAR_ENTRY_OBJECT();
+ if (method_is_null) {
+ RETURN_BOOL(entry_obj->entry->flags & PHAR_ENT_COMPRESSION_MASK);
+ }
+
switch (method) {
- case 9021976:
+ case 9021976: /* Retained for BC */
RETURN_BOOL(entry_obj->entry->flags & PHAR_ENT_COMPRESSION_MASK);
case PHAR_ENT_COMPRESSED_GZ:
RETURN_BOOL(entry_obj->entry->flags & PHAR_ENT_COMPRESSED_GZ);
diff --git a/ext/phar/phar_object.stub.php b/ext/phar/phar_object.stub.php
index a79cc14a64..7eee345b63 100644
--- a/ext/phar/phar_object.stub.php
+++ b/ext/phar/phar_object.stub.php
@@ -245,13 +245,13 @@ class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAcc
* @return Phar|null
* @implementation-alias Phar::convertToExecutable
*/
- public function convertToExecutable(int $format = 9021976, int $compression_type = 9021976, ?string $file_ext = null) {}
+ public function convertToExecutable(?int $format = null, ?int $compression_type = null, ?string $file_ext = null) {}
/**
* @return Phar|null
* @implementation-alias Phar::convertToData
*/
- public function convertToData(int $format = 9021976, int $compression_type = 9021976, ?string $file_ext = null) {}
+ public function convertToData(?int $format = null, ?int $compression_type = null, ?string $file_ext = null) {}
/**
* @return bool
@@ -513,7 +513,7 @@ class PharFileInfo extends SplFileInfo
public function hasMetadata() {}
/** @return bool */
- public function isCompressed(int $compression_type = 9021976) {}
+ public function isCompressed(?int $compression_type = null) {}
/** @return bool */
public function isCRCChecked() {}
diff --git a/ext/phar/phar_object_arginfo.h b/ext/phar/phar_object_arginfo.h
index b08597a2b3..cf6de9641a 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: 7c9fbbc6da2c4d7196583d82102fa857ce8eda6b */
+ * Stub hash: 8dff2050ad65f94a41176cfb280d02c4fb61dcf7 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
@@ -236,13 +236,9 @@ ZEND_END_ARG_INFO()
#define arginfo_class_PharData_decompress arginfo_class_Phar_decompress
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PharData_convertToExecutable, 0, 0, 0)
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, format, IS_LONG, 0, "9021976")
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, compression_type, IS_LONG, 0, "9021976")
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, file_ext, IS_STRING, 1, "null")
-ZEND_END_ARG_INFO()
+#define arginfo_class_PharData_convertToExecutable arginfo_class_Phar_convertToExecutable
-#define arginfo_class_PharData_convertToData arginfo_class_PharData_convertToExecutable
+#define arginfo_class_PharData_convertToData arginfo_class_Phar_convertToExecutable
#define arginfo_class_PharData_copy arginfo_class_Phar_copy
@@ -359,7 +355,7 @@ ZEND_END_ARG_INFO()
#define arginfo_class_PharFileInfo_hasMetadata arginfo_class_Phar___destruct
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PharFileInfo_isCompressed, 0, 0, 0)
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, compression_type, IS_LONG, 0, "9021976")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, compression_type, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
#define arginfo_class_PharFileInfo_isCRCChecked arginfo_class_Phar___destruct