Skip to content

Commit 74ac3dd

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
2 parents 4ba8d78 + 46561da commit 74ac3dd

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

ext/phar/phar.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,7 @@ int phar_create_or_parse_filename(char *fname, size_t fname_len, char *alias, si
14041404
mydata = ecalloc(1, sizeof(phar_archive_data));
14051405
mydata->fname = expand_filepath(fname, NULL);
14061406
if (mydata->fname == NULL) {
1407+
efree(mydata);
14071408
return FAILURE;
14081409
}
14091410
fname_len = strlen(mydata->fname);

ext/phar/tests/bug77396.phpt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ Bug #77396 Relative filename exceeding maximum path length causes null pointer d
55
--FILE--
66
<?php
77
$path = '../' . str_repeat("x", PHP_MAXPATHLEN) . '.tar';
8-
$phar = new PharData($path);
8+
try {
9+
$phar = new PharData($path);
10+
} catch (UnexpectedValueException $e) {
11+
echo $e->getMessage(), "\n";
12+
}
913
?>
10-
--EXPECTF--
11-
Fatal error: Uncaught UnexpectedValueException: Phar creation or opening failed in %s%ebug77396.php:%d
12-
Stack trace:
13-
#0 %s%ebug77396.php(%d): PharData->__construct(%s)
14-
#1 {main}
15-
thrown in %s%ebug77396.php on line %d
14+
--EXPECT--
15+
Phar creation or opening failed

0 commit comments

Comments
 (0)