diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2007-12-09 16:37:02 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2007-12-09 16:37:02 +0000 |
| commit | 2caccf3136dbe33292b16e1b7e7df8d90f5c4dd6 (patch) | |
| tree | 1f1803c208a61a9785a85044f22eb4db4a3c6b04 | |
| parent | e31fd8027f53a7cf3204447c837c1600d5a5a38d (diff) | |
| download | php-git-2caccf3136dbe33292b16e1b7e7df8d90f5c4dd6.tar.gz | |
Fixed bug #43533 (escapeshellarg('') returns null).
# Backport of code from 5.3
| -rw-r--r-- | NEWS | 1 | ||||
| -rw-r--r-- | ext/standard/exec.c | 17 |
2 files changed, 9 insertions, 9 deletions
@@ -3,6 +3,7 @@ PHP NEWS ?? ??? 2008, PHP 5.2.6 - Fixed weired behavior in CGI parameter parsing. (Dmitry, Hannes Magnusson) +- Fixed bug #43533 (escapeshellarg('') returns null). (Ilia) - Fixed bug #43495 (array_merge_recursive() crashes with recursive arrays). (Ilia) - Fixed bug #43493 (pdo_pgsql does not send username on connect when password diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 71cc2ea899..fcab088433 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -392,18 +392,17 @@ PHP_FUNCTION(escapeshellcmd) Quote and escape an argument for use in a shell command */ PHP_FUNCTION(escapeshellarg) { - zval **arg1; + char *argument; + int argument_len; char *cmd = NULL; - if (zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &argument, &argument_len) == FAILURE) { + return; } - - convert_to_string_ex(arg1); - if (Z_STRLEN_PP(arg1)) { - cmd = php_escape_shell_arg(Z_STRVAL_PP(arg1)); - RETVAL_STRING(cmd, 1); - efree(cmd); + + if (argument) { + cmd = php_escape_shell_arg(argument); + RETVAL_STRING(cmd, 0); } } /* }}} */ |
