]> granicus.if.org Git - php/commitdiff
Fixed bug #43533 (escapeshellarg('') returns null).
authorIlia Alshanetsky <iliaa@php.net>
Sun, 9 Dec 2007 16:37:02 +0000 (16:37 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 9 Dec 2007 16:37:02 +0000 (16:37 +0000)
# Backport of code from 5.3

NEWS
ext/standard/exec.c

diff --git a/NEWS b/NEWS
index a9b9530cf0900cef0bd29b47b56c6a3188f98056..6381f0b2a0c0342c40e0d9774b18f084f6b88f28 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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
index 71cc2ea899dbedda0ac9b0ac8a8d70a4b26e84ea..fcab0884332f84899c8bd2bdb300604aa4f41863 100644 (file)
@@ -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);
        }
 }
 /* }}} */