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;
}
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,
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;
} /* }}} */
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(
phpdbg_error(
"The requested name (%s) is already in use", lcname);
}
+
+ efree(lcname);
} break;
phpdbg_default_switch_case();
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;