Skip to content

Commit 347b7c3

Browse files
nielsdosGirgias
authored andcommitted
Fix wrong flags check for compression method in phar_object.c
I found this issue using static analysis tools, it reported that the condition was always false. We can see that flags is assigned in the switch statement above, but a mistake was made in the comparison. Closes phpGH-10328 Signed-off-by: George Peter Banyard <girgias@php.net>
1 parent 11a1feb commit 347b7c3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ PHP NEWS
3838
. Fix zend_jit_find_trace() crashes. (Max Kellermann)
3939
. Added missing lock for EXIT_INVALIDATE in zend_jit_trace_exit. (Max Kellermann)
4040

41+
- Phar:
42+
. Fix wrong flags check for compression method in phar_object.c (nielsdos)
43+
4144
- PHPDBG:
4245
. Fix undefined behaviour in phpdbg_load_module_or_extension(). (nielsdos)
4346
. Fix NULL pointer dereference in phpdbg_create_conditional_breal(). (nielsdos)

ext/phar/phar_object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3312,7 +3312,7 @@ PHP_METHOD(Phar, compressFiles)
33123312
}
33133313

33143314
if (!pharobj_cancompress(&phar_obj->archive->manifest)) {
3315-
if (flags == PHAR_FILE_COMPRESSED_GZ) {
3315+
if (flags == PHAR_ENT_COMPRESSED_GZ) {
33163316
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
33173317
"Cannot compress all files as Gzip, some are compressed as bzip2 and cannot be decompressed");
33183318
} else {

0 commit comments

Comments
 (0)