1
0
mirror of https://github.com/php/php-src.git synced 2026-03-27 01:32:22 +01:00

- Fixed bug #60261 (phar dos null pointer)

This commit is contained in:
Felipe Pena
2011-11-11 21:39:11 +00:00
parent 2a600a3b75
commit 28d1bc37e2
2 changed files with 23 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
--TEST--
Bug #60261 (phar dos null pointer)
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--FILE--
<?php
$nx = new Phar();
try {
$nx->getLinkTarget();
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: Phar::__construct() expects at least 1 parameter, 0 given in %s on line %d
SplFileInfo::getLinkTarget(): Empty filename

View File

@@ -1230,7 +1230,10 @@ SPL_METHOD(SplFileInfo, getLinkTarget)
zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC);
#if defined(PHP_WIN32) || HAVE_SYMLINK
if (!IS_ABSOLUTE_PATH(intern->file_name, intern->file_name_len)) {
if (intern->file_name == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty filename");
RETURN_FALSE;
} else if (!IS_ABSOLUTE_PATH(intern->file_name, intern->file_name_len)) {
char expanded_path[MAXPATHLEN];
if (!expand_filepath_with_mode(intern->file_name, expanded_path, NULL, 0, CWD_EXPAND TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such file or directory");