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;
+}
+
static void php_phpdbg_destroy_bp_file(void *brake) /* {{{ */
{
zend_llist_destroy((zend_llist*)brake);
}
static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */
-{
+{
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], 8, NULL, php_phpdbg_destroy_bp_file, 0);
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], 8, NULL, php_phpdbg_destroy_bp_symbol, 0);
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], 8, NULL, NULL, 0);
"html_errors=Off\n"
"register_argc_argv=On\n"
"implicit_flush=On\n"
- "output_buffering=Off\n"
"display_errors=Off\n"
"max_execution_time=0\n"
"max_input_time=-1\n\0";
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 = {0};
-
+
+ phpdbg_param_t param;
+
phpdbg_parse_param(
expr,
(cmd_len - expr_len) ? (((cmd_len - expr_len) - sizeof(" "))+1) : 0,
¶m TSRMLS_CC);
-
+
if (command->subs && param.type == STR_PARAM) {
if (phpdbg_do_cmd(command->subs, param.str, param.len TSRMLS_CC) == SUCCESS) {
rc = SUCCESS;
phpdbg_error("This command does not expect argument!");
rc = FAILURE;
} else {
- rc = command->handler(
- ¶m TSRMLS_CC);
-
PHPDBG_G(lcmd) = (phpdbg_command_t*) command;
+ phpdbg_clear_param(
+ &PHPDBG_G(lparam) TSRMLS_CC);
PHPDBG_G(lparam) = param;
+ rc = command->handler(¶m TSRMLS_CC);
}
break;
}
phpdbg_input_t* input = phpdbg_read_input(TSRMLS_C);
- if (input) {
+ if (input && input->length > 0L) {
do {
switch (ret = phpdbg_do_cmd(phpdbg_prompt_commands, input->string, input->length TSRMLS_CC)) {
case FAILURE:
efree(input->string);
}
efree(input);
-
- } while ((input = phpdbg_read_input(TSRMLS_C)));
+
+ } while ((input = phpdbg_read_input(TSRMLS_C)) && (input->length > 0L));
+
+ if (!input->length)
+ goto last;
+
} else {
+last:
if (PHPDBG_G(lcmd)) {
ret = PHPDBG_G(lcmd)->handler(
&PHPDBG_G(lparam) TSRMLS_CC);