com php-src: include registered functions in help for register command: phpdbg.c phpdbg_cmd.c phpdbg_help.c phpdbg_prompt .c
| From: | Bob Weinand | Date: | Tue, 19 Nov 2013 14:28:57 +0000 |
| Subject: | com php-src: include registered functions in help for register command: phpdbg.c phpdbg_cmd.c phpdbg_help.c phpdbg_prompt .c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74802@lists.php.net to get a copy of this message | ||
Commit: 71811f1f7f68d1e7331b06c95cec1f86da5cdfc2
Author: krakjoe <joe.watkins@live.co.uk> Tue, 19 Nov 2013 14:28:57 +0000
Parents: b237401167459dd9219fd1a6865b9a12f872c31f
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=71811f1f7f68d1e7331b06c95cec1f86da5cdfc2
Log:
include registered functions in help for register command
Changed paths:
M phpdbg.c
M phpdbg_cmd.c
M phpdbg_help.c
M phpdbg_prompt.c
Diff:
diff --git a/phpdbg.c b/phpdbg.c
index e7f3403..c8a3995 100644
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -60,15 +60,11 @@ static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */
REGISTER_LONG_CONSTANT("PHPDBG_LINENO", NUMERIC_PARAM, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PHPDBG_FUNC", STR_PARAM, CONST_CS|CONST_PERSISTENT);
- php_output_startup();
-
return SUCCESS;
} /* }}} */
static PHP_MSHUTDOWN_FUNCTION(phpdbg)
{
- php_output_shutdown();
-
return SUCCESS;
}
diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c
index ca026cf..e192c2b 100644
--- a/phpdbg_cmd.c
+++ b/phpdbg_cmd.c
@@ -198,9 +198,7 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_le
while (command && command->name && command->handler) {
if ((command->name_len == expr_len && memcmp(cmd, command->name, expr_len) == 0)
|| (expr_len == 1 && command->alias && command->alias == cmd_line[0])) {
-
phpdbg_param_t param;
-
phpdbg_parse_param(
expr,
(cmd_len - expr_len) ? (((cmd_len - expr_len) - sizeof(" "))+1) : 0,
diff --git a/phpdbg_help.c b/phpdbg_help.c
index 1f2246a..9aa3731 100644
--- a/phpdbg_help.c
+++ b/phpdbg_help.c
@@ -420,6 +420,20 @@ PHPDBG_HELP(register) /* {{{ */
phpdbg_writeln("\tWill register the scandir function for use in phpdbg");
phpdbg_writeln(EMPTY);
phpdbg_writeln("Note: argument will be passed as a string to the function and the return
printed to the console");
+ if (zend_hash_num_elements(&PHPDBG_G(registered))) {
+ HashPosition position;
+ char *name = NULL;
+ zend_uint name_len = 0;
+
+ phpdbg_notice("Registered Functions (%d)",
zend_hash_num_elements(&PHPDBG_G(registered)));
+ for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(registered), &position);
+ zend_hash_get_current_key_ex(&PHPDBG_G(registered), &name, &name_len, NULL, 1,
&position) == HASH_KEY_IS_STRING;
+ zend_hash_move_forward_ex(&PHPDBG_G(registered), &position)) {
+ phpdbg_writeln("|-------> %s", name);
+ efree(name);
+ }
+ }
+
phpdbg_help_footer();
return SUCCESS;
} /* }}} */
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index 1cbc7db..9a12454 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -681,10 +681,10 @@ static PHPDBG_COMMAND(register) /* {{{ */
char *lcname = zend_str_tolower_dup(param->str, param->len);
size_t lcname_len = strlen(lcname);
- if (!zend_hash_exists(&PHPDBG_G(registered), lcname, lcname_len)) {
+ if (!zend_hash_exists(&PHPDBG_G(registered), lcname, lcname_len+1)) {
if (zend_hash_find(EG(function_table), lcname, lcname_len+1, (void**) &function) ==
SUCCESS) {
zend_hash_update(
- &PHPDBG_G(registered), lcname, lcname_len, (void*)&function, sizeof(zend_function),
NULL);
+ &PHPDBG_G(registered), lcname, lcname_len+1, (void*)&function, sizeof(zend_function),
NULL);
function_add_ref(function);
phpdbg_notice(
@@ -696,6 +696,8 @@ static PHPDBG_COMMAND(register) /* {{{ */
phpdbg_error(
"The requested name (%s) is already in use", lcname);
}
+
+ efree(lcname);
} break;
phpdbg_default_switch_case();
@@ -917,8 +919,8 @@ static inline int phpdbg_call_register(phpdbg_input_t *input TSRMLS_DC) /* {{{ *
size_t cmd_len = input->length;
const char *start = (const char*) input->start;
size_t offset = strlen(cmd)+(sizeof(" ")-1);
-
- if (zend_hash_exists(&PHPDBG_G(registered), cmd, strlen(cmd))) {
+
+ if (zend_hash_exists(&PHPDBG_G(registered), cmd, strlen(cmd)+1)) {
zval fname, *fretval, *farg = NULL;
zend_fcall_info fci;
zend_fcall_info_cache fcic;