# Backport of code from 5.3
?? ??? 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
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);
}
}
/* }}} */