Commit: 2208fb32564cf13578c4bb77c6792d5e6b767e76 Author: Rasmus Lerdorf <ras...@php.net> Wed, 21 Mar 2012 09:13:42 -0700 Parents: 53e3467ff233af4a40626f86ea8a61880722beb8 8b01a28bad638c3ef5809cdee2127409971f18ff Branches: PHP-5.4
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2208fb32564cf13578c4bb77c6792d5e6b767e76 Log: Merge branch 'PHP-5.3' into PHP-5.4 * PHP-5.3: Add open_basedir checks to readline_write_history and readline_read_history Changed paths: MM ext/readline/readline.c Diff: 2208fb32564cf13578c4bb77c6792d5e6b767e76 diff --combined ext/readline/readline.c index c9389fc,820e4b4..1054b0e --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@@ -26,7 -26,6 +26,7 @@@ #include "php.h" #include "php_readline.h" +#include "readline_cli.h" #if HAVE_LIBREADLINE || HAVE_LIBEDIT @@@ -67,9 -66,7 +67,9 @@@ static zval *_readline_completion = NUL static zval _readline_array; PHP_MINIT_FUNCTION(readline); +PHP_MSHUTDOWN_FUNCTION(readline); PHP_RSHUTDOWN_FUNCTION(readline); +PHP_MINFO_FUNCTION(readline); /* }}} */ @@@ -144,8 -141,6 +144,8 @@@ static const zend_function_entry php_re PHP_FE(readline_callback_read_char, arginfo_readline_callback_read_char) PHP_FE(readline_callback_handler_remove, arginfo_readline_callback_handler_remove) PHP_FE(readline_redisplay, arginfo_readline_redisplay) +#endif +#if HAVE_RL_ON_NEW_LINE PHP_FE(readline_on_new_line, arginfo_readline_on_new_line) #endif PHP_FE_END @@@ -156,11 -151,11 +156,11 @@@ zend_module_entry readline_module_entr "readline", php_readline_functions, PHP_MINIT(readline), - NULL, + PHP_MSHUTDOWN(readline), NULL, PHP_RSHUTDOWN(readline), - NULL, - NO_VERSION_YET, + PHP_MINFO(readline), + PHP_VERSION, STANDARD_MODULE_PROPERTIES }; @@@ -171,12 -166,7 +171,12 @@@ ZEND_GET_MODULE(readline PHP_MINIT_FUNCTION(readline) { using_history(); - return SUCCESS; + return PHP_MINIT(cli_readline)(INIT_FUNC_ARGS_PASSTHRU); +} + +PHP_MSHUTDOWN_FUNCTION(readline) +{ + return PHP_MSHUTDOWN(cli_readline)(SHUTDOWN_FUNC_ARGS_PASSTHRU); } PHP_RSHUTDOWN_FUNCTION(readline) @@@ -196,11 -186,6 +196,11 @@@ return SUCCESS; } +PHP_MINFO_FUNCTION(readline) +{ + return PHP_MINFO(cli_readline)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU); +} + /* }}} */ /* {{{ proto string readline([string prompt]) @@@ -380,10 -365,14 +380,14 @@@ PHP_FUNCTION(readline_read_history char *arg = NULL; int arg_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &arg, &arg_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|p", &arg, &arg_len) == FAILURE) { return; } + if (php_check_open_basedir(arg TSRMLS_CC)) { + RETURN_FALSE; + } + /* XXX from & to NYI */ if (read_history(arg)) { RETURN_FALSE; @@@ -400,10 -389,14 +404,14 @@@ PHP_FUNCTION(readline_write_history char *arg = NULL; int arg_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &arg, &arg_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|p", &arg, &arg_len) == FAILURE) { return; } + if (php_check_open_basedir(arg TSRMLS_CC)) { + RETURN_FALSE; + } + if (write_history(arg)) { RETURN_FALSE; } else { @@@ -618,9 -611,6 +626,9 @@@ PHP_FUNCTION(readline_redisplay } /* }}} */ +#endif + +#if HAVE_RL_ON_NEW_LINE /* {{{ proto void readline_on_new_line(void) Inform readline that the cursor has moved to a new line */ PHP_FUNCTION(readline_on_new_line) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php