1
0
mirror of https://github.com/php/php-src.git synced 2026-04-11 18:13:00 +02:00

Don't access opt, if opt was not set.

This commit is contained in:
Sascha Schumann
2000-11-22 04:15:27 +00:00
parent 5347ef1728
commit 886fbabb0b

View File

@@ -788,7 +788,7 @@ PHP_FUNCTION(pathinfo)
MAKE_STD_ZVAL(tmp);
array_init(tmp);
if (opt == PHP_PATHINFO_DIRNAME || argc < 2) {
if (argc < 2 || opt == PHP_PATHINFO_DIRNAME) {
ret = estrndup(Z_STRVAL_PP(path), len);
php_dirname(ret, len);
if (*ret)
@@ -796,12 +796,12 @@ PHP_FUNCTION(pathinfo)
efree(ret);
}
if (opt == PHP_PATHINFO_BASENAME || argc < 2) {
if (argc < 2 || opt == PHP_PATHINFO_BASENAME)
ret = php_basename(Z_STRVAL_PP(path), len);
add_assoc_string(tmp, "basename", ret, 0);
}
if (opt == PHP_PATHINFO_EXTENSION || argc < 2) {
if (argc < 2 || opt == PHP_PATHINFO_EXTENSION) {
char *p;
int idx;