summaryrefslogtreecommitdiff
path: root/sapi/phpdbg
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/phpdbg')
-rw-r--r--sapi/phpdbg/Makefile.frag2
-rw-r--r--sapi/phpdbg/README.md78
-rw-r--r--sapi/phpdbg/config.m46
-rwxr-xr-xsapi/phpdbg/create-test.php2
-rw-r--r--sapi/phpdbg/phpdbg.c238
-rw-r--r--sapi/phpdbg/phpdbg.h8
-rw-r--r--sapi/phpdbg/phpdbg.stub.php25
-rw-r--r--sapi/phpdbg/phpdbg_arginfo.h73
-rw-r--r--sapi/phpdbg/phpdbg_bp.c22
-rw-r--r--sapi/phpdbg/phpdbg_bp.h2
-rw-r--r--sapi/phpdbg/phpdbg_break.c2
-rw-r--r--sapi/phpdbg/phpdbg_break.h2
-rw-r--r--sapi/phpdbg/phpdbg_btree.c2
-rw-r--r--sapi/phpdbg/phpdbg_btree.h2
-rw-r--r--sapi/phpdbg/phpdbg_cmd.c36
-rw-r--r--sapi/phpdbg/phpdbg_cmd.h10
-rw-r--r--sapi/phpdbg/phpdbg_eol.c2
-rw-r--r--sapi/phpdbg/phpdbg_eol.h2
-rw-r--r--sapi/phpdbg/phpdbg_frame.c4
-rw-r--r--sapi/phpdbg/phpdbg_frame.h2
-rw-r--r--sapi/phpdbg/phpdbg_help.c6
-rw-r--r--sapi/phpdbg/phpdbg_help.h2
-rw-r--r--sapi/phpdbg/phpdbg_info.c6
-rw-r--r--sapi/phpdbg/phpdbg_info.h2
-rw-r--r--sapi/phpdbg/phpdbg_io.c2
-rw-r--r--sapi/phpdbg/phpdbg_io.h2
-rw-r--r--sapi/phpdbg/phpdbg_lexer.h2
-rw-r--r--sapi/phpdbg/phpdbg_list.c11
-rw-r--r--sapi/phpdbg/phpdbg_list.h2
-rw-r--r--sapi/phpdbg/phpdbg_opcode.c2
-rw-r--r--sapi/phpdbg/phpdbg_opcode.h2
-rw-r--r--sapi/phpdbg/phpdbg_out.c2
-rw-r--r--sapi/phpdbg/phpdbg_out.h2
-rw-r--r--sapi/phpdbg/phpdbg_parser.y30
-rw-r--r--sapi/phpdbg/phpdbg_print.c14
-rw-r--r--sapi/phpdbg/phpdbg_print.h4
-rw-r--r--sapi/phpdbg/phpdbg_prompt.c48
-rw-r--r--sapi/phpdbg/phpdbg_prompt.h2
-rw-r--r--sapi/phpdbg/phpdbg_rinit_hook.c4
-rw-r--r--sapi/phpdbg/phpdbg_rinit_hook.h2
-rw-r--r--sapi/phpdbg/phpdbg_set.c2
-rw-r--r--sapi/phpdbg/phpdbg_set.h2
-rw-r--r--sapi/phpdbg/phpdbg_sigio_win32.c2
-rw-r--r--sapi/phpdbg/phpdbg_sigio_win32.h2
-rw-r--r--sapi/phpdbg/phpdbg_utils.c7
-rw-r--r--sapi/phpdbg/phpdbg_utils.h2
-rw-r--r--sapi/phpdbg/phpdbg_wait.c14
-rw-r--r--sapi/phpdbg/phpdbg_wait.h2
-rw-r--r--sapi/phpdbg/phpdbg_watch.c22
-rw-r--r--sapi/phpdbg/phpdbg_watch.h2
-rw-r--r--sapi/phpdbg/phpdbg_webdata_transfer.c4
-rw-r--r--sapi/phpdbg/phpdbg_webdata_transfer.h2
-rw-r--r--sapi/phpdbg/phpdbg_win.c2
-rw-r--r--sapi/phpdbg/phpdbg_win.h2
-rw-r--r--sapi/phpdbg/tests/bug78297.phpt4
-rw-r--r--sapi/phpdbg/tests/exceptions_003.phpt2
-rw-r--r--sapi/phpdbg/tests/info_001.phpt2
-rw-r--r--sapi/phpdbg/tests/match_breakpoints_001.phpt30
-rw-r--r--sapi/phpdbg/tests/match_breakpoints_002.phpt32
-rw-r--r--sapi/phpdbg/tests/match_breakpoints_003.phpt32
-rw-r--r--sapi/phpdbg/tests/match_breakpoints_004.phpt34
61 files changed, 418 insertions, 452 deletions
diff --git a/sapi/phpdbg/Makefile.frag b/sapi/phpdbg/Makefile.frag
index 65377e608a..1572bfd9f0 100644
--- a/sapi/phpdbg/Makefile.frag
+++ b/sapi/phpdbg/Makefile.frag
@@ -18,7 +18,7 @@ $(srcdir)/phpdbg_lexer.c: $(srcdir)/phpdbg_lexer.l
$(srcdir)/phpdbg_parser.h: $(srcdir)/phpdbg_parser.c
$(srcdir)/phpdbg_parser.c: $(srcdir)/phpdbg_parser.y
- @$(YACC) -p phpdbg_ -v -d $(srcdir)/phpdbg_parser.y -o $@
+ @$(YACC) $(YFLAGS) -v -d $(srcdir)/phpdbg_parser.y -o $@
install-phpdbg: $(BUILD_BINARY)
@echo "Installing phpdbg binary: $(INSTALL_ROOT)$(bindir)/"
diff --git a/sapi/phpdbg/README.md b/sapi/phpdbg/README.md
deleted file mode 100644
index 68d9766f0a..0000000000
--- a/sapi/phpdbg/README.md
+++ /dev/null
@@ -1,78 +0,0 @@
-# The interactive PHP debugger
-
-Implemented as a SAPI module, phpdbg can exert complete control over the
-environment without impacting the functionality or performance of your code.
-
-phpdbg aims to be a lightweight, powerful, easy to use debugging platform for
-PHP 5.4+.
-
-## Features
-
-* Stepthrough Debugging
-* Flexible Breakpoints (Class Method, Function, File:Line, Address, Opcode)
-* Easy Access to PHP with built-in eval()
-* Easy Access to Currently Executing Code
-* Userland API
-* SAPI Agnostic - Easily Integrated
-* PHP Configuration File Support
-* JIT Super Globals - Set Your Own!!
-* Optional readline Support - Comfortable Terminal Operation
-* Remote Debugging Support - Bundled Java GUI
-* Easy Operation - See Help
-
-## Planned
-
-* Improve Everything :)
-
-## Installation
-
-To install **phpdbg**, you must compile the source against your PHP installation
-sources, and enable the SAPI with the configure command. It is enabled by
-default:
-
-```bash
-cd /path/to/php-src
-./buildconf --force
-./configure
-make -j8
-./sapi/phpdbg/phpdbg --version
-```
-
-Where the source directory has been used previously to build PHP, there exists a
-file named `config.nice` which can be used to invoke configure with the same
-parameters as were used by the last execution of `configure`.
-
-**Note:** PHP must be configured with the switch `--with-readline` for phpdbg to
-support history, autocompletion, tab-listing etc.
-
-## Command line options
-
-The following switches are implemented (just like cli SAPI):
-
-* `-n` ignore php ini
-* `-c` search for php ini in path
-* `-z` load zend extension
-* `-d` define php ini entry
-
-The following switches change the default behaviour of phpdbg:
-
-* `-v` disables quietness
-* `-s` enabled stepping
-* `-e` sets execution context
-* `-b` boring - disables use of colour on the console
-* `-I` ignore .phpdbginit (default init file)
-* `-i` override .phpgdbinit location (implies -I)
-* `-O` set oplog output file
-* `-q` do not print banner on startup
-* `-r` jump straight to run
-* `-E` enable step through eval()
-* `-l` listen ports for remote mode
-* `-a` listen address for remote mode
-* `-S` override SAPI name
-
-**Note:** Passing `-rr` will cause phpdbg to quit after execution, rather than
-returning to the console.
-
-## Getting started
-
-See the [website](https://phpdbg.room11.org) for tutorials/documentation.
diff --git a/sapi/phpdbg/config.m4 b/sapi/phpdbg/config.m4
index d4bceed4f7..e78c012e88 100644
--- a/sapi/phpdbg/config.m4
+++ b/sapi/phpdbg/config.m4
@@ -63,9 +63,9 @@ if test "$BUILD_PHPDBG" = "" && test "$PHP_PHPDBG" != "no"; then
BUILD_PHPDBG="\$(LIBTOOL) --mode=link \
\$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \
- \$(PHP_GLOBAL_OBJS) \
- \$(PHP_BINARY_OBJS) \
- \$(PHP_PHPDBG_OBJS) \
+ \$(PHP_GLOBAL_OBJS:.lo=.o) \
+ \$(PHP_BINARY_OBJS:.lo=.o) \
+ \$(PHP_PHPDBG_OBJS:.lo=.o) \
\$(EXTRA_LIBS) \
\$(PHPDBG_EXTRA_LIBS) \
\$(ZEND_EXTRA_LIBS) \
diff --git a/sapi/phpdbg/create-test.php b/sapi/phpdbg/create-test.php
index 3e2c8f0437..06fb7e1632 100755
--- a/sapi/phpdbg/create-test.php
+++ b/sapi/phpdbg/create-test.php
@@ -3,8 +3,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index 0f1f03625c..efd2270601 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -30,6 +28,8 @@
#include "phpdbg_eol.h"
#include "phpdbg_print.h"
#include "phpdbg_help.h"
+#include "phpdbg_arginfo.h"
+#include "zend_vm.h"
#include "ext/standard/basic_functions.h"
@@ -57,7 +57,7 @@
ZEND_TSRMLS_CACHE_DEFINE()
#endif
-ZEND_DECLARE_MODULE_GLOBALS(phpdbg);
+ZEND_DECLARE_MODULE_GLOBALS(phpdbg)
int phpdbg_startup_run = 0;
static PHP_INI_MH(OnUpdateEol)
@@ -274,6 +274,17 @@ static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */
/* deactivate symbol table caching to have these properly destroyed upon stack leaving (especially important for watchpoints) */
EG(symtable_cache_limit) = EG(symtable_cache);
+ if (zend_vm_kind() != ZEND_VM_KIND_HYBRID) {
+ /* phpdbg cannot work JIT-ed code */
+ zend_string *key = zend_string_init(ZEND_STRL("opcache.jit"), 1);
+ zend_string *value = zend_string_init(ZEND_STRL("off"), 1);
+
+ zend_alter_ini_entry(key, value, ZEND_INI_SYSTEM, ZEND_INI_STAGE_STARTUP);
+
+ zend_string_release(key);
+ zend_string_release(value);
+ }
+
return SUCCESS;
} /* }}} */
@@ -287,17 +298,16 @@ static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */
return SUCCESS;
} /* }}} */
-/* {{{ proto mixed phpdbg_exec(string context)
- Attempt to set the execution context for phpdbg
+/* {{{ Attempt to set the execution context for phpdbg
If the execution context was set previously it is returned
If the execution context was not set previously boolean true is returned
If the request to set the context fails, boolean false is returned, and an E_WARNING raised */
-static PHP_FUNCTION(phpdbg_exec)
+PHP_FUNCTION(phpdbg_exec)
{
zend_string *exec;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &exec) == FAILURE) {
- return;
+ RETURN_THROWS();
}
{
@@ -330,67 +340,74 @@ static PHP_FUNCTION(phpdbg_exec)
}
} /* }}} */
-/* {{{ proto void phpdbg_break()
- instructs phpdbg to insert a breakpoint at the next opcode */
-static PHP_FUNCTION(phpdbg_break_next)
+/* {{{ instructs phpdbg to insert a breakpoint at the next opcode */
+PHP_FUNCTION(phpdbg_break_next)
{
- zend_execute_data *ex = EG(current_execute_data);
+ zend_execute_data *ex;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+ ex = EG(current_execute_data);
while (ex && ex->func && !ZEND_USER_CODE(ex->func->type)) {
ex = ex->prev_execute_data;
}
- if (zend_parse_parameters_none() == FAILURE || !ex) {
+ if (!ex) {
return;
}
phpdbg_set_breakpoint_opline_ex((phpdbg_opline_ptr_t) ex->opline + 1);
} /* }}} */
-/* {{{ proto void phpdbg_break_file(string file, int line) */
-static PHP_FUNCTION(phpdbg_break_file)
+/* {{{ */
+PHP_FUNCTION(phpdbg_break_file)
{
char *file;
size_t flen;
zend_long line;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl", &file, &flen, &line) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phpdbg_set_breakpoint_file(file, 0, line);
} /* }}} */
-/* {{{ proto void phpdbg_break_method(string class, string method) */
-static PHP_FUNCTION(phpdbg_break_method)
+/* {{{ */
+PHP_FUNCTION(phpdbg_break_method)
{
- char *class = NULL, *method = NULL;
- size_t clen = 0, mlen = 0;
+ char *class, *method;
+ size_t clen, mlen;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &class, &clen, &method, &mlen) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phpdbg_set_breakpoint_method(class, method);
} /* }}} */
-/* {{{ proto void phpdbg_break_function(string function) */
-static PHP_FUNCTION(phpdbg_break_function)
+/* {{{ */
+PHP_FUNCTION(phpdbg_break_function)
{
- char *function = NULL;
+ char *function;
size_t function_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &function, &function_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phpdbg_set_breakpoint_symbol(function, function_len);
} /* }}} */
-/* {{{ proto void phpdbg_clear(void)
- instructs phpdbg to clear breakpoints */
-static PHP_FUNCTION(phpdbg_clear)
+/* {{{ instructs phpdbg to clear breakpoints */
+PHP_FUNCTION(phpdbg_clear)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM]);
@@ -402,15 +419,15 @@ static PHP_FUNCTION(phpdbg_clear)
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_COND]);
} /* }}} */
-/* {{{ proto void phpdbg_color(int element, string color) */
-static PHP_FUNCTION(phpdbg_color)
+/* {{{ */
+PHP_FUNCTION(phpdbg_color)
{
zend_long element;
char *color;
size_t color_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &element, &color, &color_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (element) {
@@ -420,30 +437,31 @@ static PHP_FUNCTION(phpdbg_color)
phpdbg_set_color_ex(element, color, color_len);
break;
- default: zend_error(E_ERROR, "phpdbg detected an incorrect color constant");
+ default:
+ zend_argument_value_error(1, "must be one of PHPDBG_COLOR_PROMPT, PHPDBG_COLOR_NOTICE, or PHPDBG_COLOR_ERROR");
}
} /* }}} */
-/* {{{ proto void phpdbg_prompt(string prompt) */
-static PHP_FUNCTION(phpdbg_prompt)
+/* {{{ */
+PHP_FUNCTION(phpdbg_prompt)
{
char *prompt = NULL;
size_t prompt_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &prompt, &prompt_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phpdbg_set_prompt(prompt);
} /* }}} */
-/* {{{ proto void phpdbg_start_oplog() */
-static PHP_FUNCTION(phpdbg_start_oplog)
+/* {{{ */
+PHP_FUNCTION(phpdbg_start_oplog)
{
phpdbg_oplog_list *prev;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
prev = PHPDBG_G(oplog_list);
@@ -464,7 +482,8 @@ static zend_always_inline zend_bool phpdbg_is_ignored_opcode(zend_uchar opcode)
|| opcode == ZEND_DECLARE_CONST || opcode == ZEND_DECLARE_CLASS || opcode == ZEND_DECLARE_FUNCTION
|| opcode == ZEND_DECLARE_CLASS_DELAYED
|| opcode == ZEND_DECLARE_ANON_CLASS || opcode == ZEND_FAST_RET || opcode == ZEND_TICKS
- || opcode == ZEND_EXT_STMT || opcode == ZEND_EXT_FCALL_BEGIN || opcode == ZEND_EXT_FCALL_END || opcode == ZEND_EXT_NOP || opcode == ZEND_BIND_GLOBAL
+ || opcode == ZEND_EXT_STMT || opcode == ZEND_EXT_FCALL_BEGIN || opcode == ZEND_EXT_FCALL_END
+ || opcode == ZEND_BIND_GLOBAL
;
}
@@ -514,8 +533,8 @@ static inline HashTable* phpdbg_add_empty_array(HashTable *ht, zend_string *name
return Z_ARR_P(ht_zv);
}
-/* {{{ proto void phpdbg_get_executable() */
-static PHP_FUNCTION(phpdbg_get_executable)
+/* {{{ */
+PHP_FUNCTION(phpdbg_get_executable)
{
HashTable *options = NULL;
zval *option_buffer;
@@ -530,7 +549,7 @@ static PHP_FUNCTION(phpdbg_get_executable)
HashTable files_tmp;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|H", &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (options && (option_buffer = zend_hash_str_find(options, ZEND_STRL("functions")))) {
@@ -612,8 +631,8 @@ static PHP_FUNCTION(phpdbg_get_executable)
}
}
-/* {{{ proto void phpdbg_end_oplog() */
-static PHP_FUNCTION(phpdbg_end_oplog)
+/* {{{ */
+PHP_FUNCTION(phpdbg_end_oplog)
{
phpdbg_oplog_entry *cur;
phpdbg_oplog_list *prev;
@@ -624,7 +643,7 @@ static PHP_FUNCTION(phpdbg_end_oplog)
zend_bool by_opcode = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|H", &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!PHPDBG_G(oplog_list)) {
@@ -715,73 +734,10 @@ static PHP_FUNCTION(phpdbg_end_oplog)
}
}
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_next_arginfo, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_file_arginfo, 0, 0, 2)
- ZEND_ARG_INFO(0, file)
- ZEND_ARG_INFO(0, line)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_method_arginfo, 0, 0, 2)
- ZEND_ARG_INFO(0, class)
- ZEND_ARG_INFO(0, method)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_function_arginfo, 0, 0, 1)
- ZEND_ARG_INFO(0, function)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_color_arginfo, 0, 0, 2)
- ZEND_ARG_INFO(0, element)
- ZEND_ARG_INFO(0, color)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_prompt_arginfo, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_exec_arginfo, 0, 0, 1)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_clear_arginfo, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_start_oplog_arginfo, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_end_oplog_arginfo, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_get_executable_arginfo, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry phpdbg_user_functions[] = {
- PHP_FE(phpdbg_clear, phpdbg_clear_arginfo)
- PHP_FE(phpdbg_break_next, phpdbg_break_next_arginfo)
- PHP_FE(phpdbg_break_file, phpdbg_break_file_arginfo)
- PHP_FE(phpdbg_break_method, phpdbg_break_method_arginfo)
- PHP_FE(phpdbg_break_function, phpdbg_break_function_arginfo)
- PHP_FE(phpdbg_exec, phpdbg_exec_arginfo)
- PHP_FE(phpdbg_color, phpdbg_color_arginfo)
- PHP_FE(phpdbg_prompt, phpdbg_prompt_arginfo)
- PHP_FE(phpdbg_start_oplog, phpdbg_start_oplog_arginfo)
- PHP_FE(phpdbg_end_oplog, phpdbg_end_oplog_arginfo)
- PHP_FE(phpdbg_get_executable, phpdbg_get_executable_arginfo)
-#ifdef PHP_FE_END
- PHP_FE_END
-#else
- {NULL,NULL,NULL}
-#endif
-};
-
static zend_module_entry sapi_phpdbg_module_entry = {
STANDARD_MODULE_HEADER,
PHPDBG_NAME,
- phpdbg_user_functions,
+ ext_functions,
PHP_MINIT(phpdbg),
PHP_MSHUTDOWN(phpdbg),
PHP_RINIT(phpdbg),
@@ -826,7 +782,7 @@ static void php_sapi_phpdbg_send_header(sapi_header_struct *sapi_header, void *s
}
/* }}} */
-static void php_sapi_phpdbg_log_message(char *message, int syslog_type_int) /* {{{ */
+static void php_sapi_phpdbg_log_message(const char *message, int syslog_type_int) /* {{{ */
{
/*
* We must not request TSRM before being booted
@@ -843,32 +799,25 @@ static void php_sapi_phpdbg_log_message(char *message, int syslog_type_int) /* {
return;
}
- switch (PG(last_error_type)) {
- case E_ERROR:
- case E_CORE_ERROR:
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- case E_PARSE:
- case E_RECOVERABLE_ERROR: {
- const char *file_char = zend_get_executed_filename();
- zend_string *file = zend_string_init(file_char, strlen(file_char), 0);
- phpdbg_list_file(file, 3, zend_get_executed_lineno() - 1, zend_get_executed_lineno());
- zend_string_release(file);
-
- if (!phpdbg_fully_started) {
- return;
- }
+ if (PG(last_error_type) & E_FATAL_ERRORS) {
+ const char *file_char = zend_get_executed_filename();
+ zend_string *file = zend_string_init(file_char, strlen(file_char), 0);
+ phpdbg_list_file(file, 3, zend_get_executed_lineno() - 1, zend_get_executed_lineno());
+ zend_string_release(file);
- do {
- switch (phpdbg_interactive(1, NULL)) {
- case PHPDBG_LEAVE:
- case PHPDBG_FINISH:
- case PHPDBG_UNTIL:
- case PHPDBG_NEXT:
- return;
- }
- } while (!(PHPDBG_G(flags) & PHPDBG_IS_STOPPING));
+ if (!phpdbg_fully_started) {
+ return;
}
+
+ do {
+ switch (phpdbg_interactive(1, NULL)) {
+ case PHPDBG_LEAVE:
+ case PHPDBG_FINISH:
+ case PHPDBG_UNTIL:
+ case PHPDBG_NEXT:
+ return;
+ }
+ } while (!(PHPDBG_G(flags) & PHPDBG_IS_STOPPING));
}
} else {
fprintf(stdout, "%s\n", message);
@@ -1035,8 +984,7 @@ void phpdbg_register_file_handles(void) /* {{{ */
}
/* }}} */
-/* {{{ sapi_module_struct phpdbg_sapi_module
-*/
+/* {{{ sapi_module_struct phpdbg_sapi_module */
static sapi_module_struct phpdbg_sapi_module = {
"phpdbg", /* name */
"phpdbg", /* pretty name */
@@ -1108,17 +1056,6 @@ const char phpdbg_ini_hardcoded[] =
"error_log=\n"
"output_buffering=off\n\0";
-/* overwriteable ini defaults must be set in phpdbg_ini_defaults() */
-#define INI_DEFAULT(name, value) \
- ZVAL_NEW_STR(&tmp, zend_string_init(value, sizeof(value) - 1, 1)); \
- zend_hash_str_update(configuration_hash, name, sizeof(name) - 1, &tmp);
-
-void phpdbg_ini_defaults(HashTable *configuration_hash) /* {{{ */
-{
- zval tmp;
- INI_DEFAULT("report_zend_debug", "0");
-} /* }}} */
-
static void phpdbg_welcome(zend_bool cleaning) /* {{{ */
{
/* print blurb */
@@ -1613,7 +1550,7 @@ phpdbg_main:
phpdbg->name = sapi_name;
}
- phpdbg->ini_defaults = phpdbg_ini_defaults;
+ phpdbg->ini_defaults = NULL;
phpdbg->phpinfo_as_text = 1;
phpdbg->php_ini_ignore_cwd = 1;
@@ -1737,6 +1674,9 @@ phpdbg_main:
}
#ifndef _WIN32
+# ifndef SIGIO
+# define SIGIO SIGPOLL
+# endif
zend_sigaction(SIGIO, &sigio_struct, NULL);
#endif
@@ -2025,7 +1965,7 @@ phpdbg_interact:
if ((PHPDBG_G(flags) & PHPDBG_IS_DISCONNECTED)) {
if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE) {
- /* renegociate connections */
+ /* renegotiate connections */
phpdbg_remote_init(address, listen, server, &socket, &stream);
/* set streams */
@@ -2125,7 +2065,7 @@ phpdbg_out:
settings->oplog = PHPDBG_G(oplog);
settings->prompt[0] = PHPDBG_G(prompt)[0];
settings->prompt[1] = PHPDBG_G(prompt)[1];
- memcpy(settings->colors, PHPDBG_G(colors), sizeof(settings->colors));
+ memcpy(ZEND_VOIDP(settings->colors), PHPDBG_G(colors), sizeof(settings->colors));
settings->eol = PHPDBG_G(eol);
settings->input_buflen = PHPDBG_G(input_buflen);
memcpy(settings->input_buffer, PHPDBG_G(input_buffer), settings->input_buflen);
diff --git a/sapi/phpdbg/phpdbg.h b/sapi/phpdbg/phpdbg.h
index d0e316c78b..e5db725336 100644
--- a/sapi/phpdbg/phpdbg.h
+++ b/sapi/phpdbg/phpdbg.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -111,7 +109,7 @@
#define PHPDBG_DEFAULT_PROMPT "prompt>"
/* }}} */
-/* Hey, apple. One shouldn't define *functions* from the standard C library as marcos. */
+/* Hey, apple. One shouldn't define *functions* from the standard C library as macros. */
#ifdef memcpy
#define memcpy_tmp(...) memcpy(__VA_ARGS__)
#undef memcpy
@@ -277,7 +275,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
zend_op_array *(*compile_file)(zend_file_handle *file_handle, int type);
zend_op_array *(*init_compile_file)(zend_file_handle *file_handle, int type);
- zend_op_array *(*compile_string)(zval *source_string, char *filename);
+ zend_op_array *(*compile_string)(zend_string *source_string, const char *filename);
HashTable file_sources;
FILE *oplog; /* opline log */
@@ -316,7 +314,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
int input_buflen; /* length of stdin input buffer */
phpdbg_signal_safe_mem sigsafe_mem; /* memory to use in async safe environment (only once!) */
- JMP_BUF *sigsegv_bailout; /* bailout address for accesibility probing */
+ JMP_BUF *sigsegv_bailout; /* bailout address for accessibility probing */
uint64_t flags; /* phpdbg flags */
diff --git a/sapi/phpdbg/phpdbg.stub.php b/sapi/phpdbg/phpdbg.stub.php
new file mode 100644
index 0000000000..4d733ccaf6
--- /dev/null
+++ b/sapi/phpdbg/phpdbg.stub.php
@@ -0,0 +1,25 @@
+<?php
+
+/** @generate-function-entries */
+
+function phpdbg_break_next(): void {}
+
+function phpdbg_break_file(string $file, int $line): void {}
+
+function phpdbg_break_method(string $class, string $method): void {}
+
+function phpdbg_break_function(string $function): void {}
+
+function phpdbg_color(int $element, string $color): void {}
+
+function phpdbg_prompt(string $string): void {}
+
+function phpdbg_exec(string $context): string|bool {}
+
+function phpdbg_clear(): void {}
+
+function phpdbg_start_oplog(): void {}
+
+function phpdbg_end_oplog(array $options = []): ?array {}
+
+function phpdbg_get_executable(array $options = []): array {}
diff --git a/sapi/phpdbg/phpdbg_arginfo.h b/sapi/phpdbg/phpdbg_arginfo.h
new file mode 100644
index 0000000000..a4ee52d814
--- /dev/null
+++ b/sapi/phpdbg/phpdbg_arginfo.h
@@ -0,0 +1,73 @@
+/* This is a generated file, edit the .stub.php file instead.
+ * Stub hash: 3fd1a8c30695df2089655b1785905381734ac1c1 */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_break_next, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_break_file, 0, 2, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, line, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_break_method, 0, 2, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, class, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_break_function, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, function, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_color, 0, 2, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, element, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, color, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_prompt, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_phpdbg_exec, 0, 1, MAY_BE_STRING|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, context, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_phpdbg_clear arginfo_phpdbg_break_next
+
+#define arginfo_phpdbg_start_oplog arginfo_phpdbg_break_next
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_end_oplog, 0, 0, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_get_executable, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]")
+ZEND_END_ARG_INFO()
+
+
+ZEND_FUNCTION(phpdbg_break_next);
+ZEND_FUNCTION(phpdbg_break_file);
+ZEND_FUNCTION(phpdbg_break_method);
+ZEND_FUNCTION(phpdbg_break_function);
+ZEND_FUNCTION(phpdbg_color);
+ZEND_FUNCTION(phpdbg_prompt);
+ZEND_FUNCTION(phpdbg_exec);
+ZEND_FUNCTION(phpdbg_clear);
+ZEND_FUNCTION(phpdbg_start_oplog);
+ZEND_FUNCTION(phpdbg_end_oplog);
+ZEND_FUNCTION(phpdbg_get_executable);
+
+
+static const zend_function_entry ext_functions[] = {
+ ZEND_FE(phpdbg_break_next, arginfo_phpdbg_break_next)
+ ZEND_FE(phpdbg_break_file, arginfo_phpdbg_break_file)
+ ZEND_FE(phpdbg_break_method, arginfo_phpdbg_break_method)
+ ZEND_FE(phpdbg_break_function, arginfo_phpdbg_break_function)
+ ZEND_FE(phpdbg_color, arginfo_phpdbg_color)
+ ZEND_FE(phpdbg_prompt, arginfo_phpdbg_prompt)
+ ZEND_FE(phpdbg_exec, arginfo_phpdbg_exec)
+ ZEND_FE(phpdbg_clear, arginfo_phpdbg_clear)
+ ZEND_FE(phpdbg_start_oplog, arginfo_phpdbg_start_oplog)
+ ZEND_FE(phpdbg_end_oplog, arginfo_phpdbg_end_oplog)
+ ZEND_FE(phpdbg_get_executable, arginfo_phpdbg_get_executable)
+ ZEND_FE_END
+};
diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c
index 738967f907..db3d1cf0c4 100644
--- a/sapi/phpdbg/phpdbg_bp.c
+++ b/sapi/phpdbg/phpdbg_bp.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -830,7 +828,7 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co
{
phpdbg_breakcond_t new_break;
uint32_t cops = CG(compiler_options);
- zval pv;
+ zend_string *bp_code;
switch (param->type) {
case STR_PARAM:
@@ -879,16 +877,10 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co
new_break.code = estrndup(expr, expr_len);
new_break.code_len = expr_len;
- Z_STR(pv) = zend_string_alloc(expr_len + sizeof("return ;") - 1, 0);
- memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1);
- memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, expr, expr_len);
- Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';';
- Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0';
- Z_TYPE_INFO(pv) = IS_STRING;
-
- new_break.ops = zend_compile_string(&pv, "Conditional Breakpoint Code");
-
- zval_ptr_dtor_str(&pv);
+ bp_code = zend_string_concat3(
+ "return ", sizeof("return ")-1, expr, expr_len, ";", sizeof(";")-1);
+ new_break.ops = zend_compile_string(bp_code, "Conditional Breakpoint Code");
+ zend_string_release(bp_code);
if (new_break.ops) {
brake = zend_hash_index_update_mem(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], hash, &new_break, sizeof(phpdbg_breakcond_t));
@@ -908,7 +900,7 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co
PHPDBG_API void phpdbg_set_breakpoint_expression(const char *expr, size_t expr_len) /* {{{ */
{
- zend_ulong expr_hash = zend_inline_hash_func(expr, expr_len);
+ zend_ulong expr_hash = zend_hash_func(expr, expr_len);
phpdbg_breakcond_t new_break;
if (!zend_hash_index_exists(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], expr_hash)) {
@@ -927,7 +919,7 @@ PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param) /* {{{ */
if (param->next) {
condition = param->next;
- hash = zend_inline_hash_func(condition->str, condition->len);
+ hash = zend_hash_func(condition->str, condition->len);
if (!zend_hash_index_exists(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], hash)) {
phpdbg_create_conditional_break(&new_break, param, condition->str, condition->len, hash);
diff --git a/sapi/phpdbg/phpdbg_bp.h b/sapi/phpdbg/phpdbg_bp.h
index 7e038bb10e..87c5388c94 100644
--- a/sapi/phpdbg/phpdbg_bp.h
+++ b/sapi/phpdbg/phpdbg_bp.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_break.c b/sapi/phpdbg/phpdbg_break.c
index 719d93d166..dd24a7994d 100644
--- a/sapi/phpdbg/phpdbg_break.c
+++ b/sapi/phpdbg/phpdbg_break.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_break.h b/sapi/phpdbg/phpdbg_break.h
index 0aafa592e9..de367a17c8 100644
--- a/sapi/phpdbg/phpdbg_break.h
+++ b/sapi/phpdbg/phpdbg_break.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_btree.c b/sapi/phpdbg/phpdbg_btree.c
index c174920836..4bd9787556 100644
--- a/sapi/phpdbg/phpdbg_btree.c
+++ b/sapi/phpdbg/phpdbg_btree.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_btree.h b/sapi/phpdbg/phpdbg_btree.h
index 4ffb72697a..bb0a4ef3fb 100644
--- a/sapi/phpdbg/phpdbg_btree.h
+++ b/sapi/phpdbg/phpdbg_btree.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_cmd.c b/sapi/phpdbg/phpdbg_cmd.c
index 4845acca9a..757d48e739 100644
--- a/sapi/phpdbg/phpdbg_cmd.c
+++ b/sapi/phpdbg/phpdbg_cmd.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -201,16 +199,16 @@ PHPDBG_API zend_ulong phpdbg_hash_param(const phpdbg_param_t *param) /* {{{ */
break;
case STR_PARAM:
- hash += zend_inline_hash_func(param->str, param->len);
+ hash += zend_hash_func(param->str, param->len);
break;
case METHOD_PARAM:
- hash += zend_inline_hash_func(param->method.class, strlen(param->method.class));
- hash += zend_inline_hash_func(param->method.name, strlen(param->method.name));
+ hash += zend_hash_func(param->method.class, strlen(param->method.class));
+ hash += zend_hash_func(param->method.name, strlen(param->method.name));
break;
case FILE_PARAM:
- hash += zend_inline_hash_func(param->file.name, strlen(param->file.name));
+ hash += zend_hash_func(param->file.name, strlen(param->file.name));
hash += param->file.line;
if (param->num)
hash += param->num;
@@ -225,13 +223,13 @@ PHPDBG_API zend_ulong phpdbg_hash_param(const phpdbg_param_t *param) /* {{{ */
break;
case NUMERIC_FUNCTION_PARAM:
- hash += zend_inline_hash_func(param->str, param->len);
+ hash += zend_hash_func(param->str, param->len);
hash += param->num;
break;
case NUMERIC_METHOD_PARAM:
- hash += zend_inline_hash_func(param->method.class, strlen(param->method.class));
- hash += zend_inline_hash_func(param->method.name, strlen(param->method.name));
+ hash += zend_hash_func(param->method.class, strlen(param->method.class));
+ hash += zend_hash_func(param->method.name, strlen(param->method.name));
if (param->num)
hash+= param->num;
break;
@@ -739,10 +737,9 @@ PHPDBG_API int phpdbg_stack_execute(phpdbg_param_t *stack, zend_bool allow_async
return SUCCESS;
} /* }}} */
-PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */
+PHPDBG_API char *phpdbg_read_input(const char *buffered) /* {{{ */
{
char buf[PHPDBG_MAX_CMD];
- char *cmd = NULL;
char *buffer = NULL;
if ((PHPDBG_G(flags) & (PHPDBG_IS_STOPPING | PHPDBG_IS_RUNNING)) != PHPDBG_IS_STOPPING) {
@@ -757,11 +754,12 @@ PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */
#endif
{
phpdbg_write("prompt", "", "%s", phpdbg_get_prompt());
- phpdbg_consume_stdin_line(cmd = buf);
+ phpdbg_consume_stdin_line(buf);
+ buffer = estrdup(buf);
}
#ifdef HAVE_PHPDBG_READLINE
else {
- cmd = readline(phpdbg_get_prompt());
+ char *cmd = readline(phpdbg_get_prompt());
PHPDBG_G(last_was_newline) = 1;
if (!cmd) {
@@ -770,19 +768,13 @@ PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */
}
add_history(cmd);
+ buffer = estrdup(cmd);
+ free(cmd);
}
#endif
} else {
- cmd = buffered;
- }
-
- buffer = estrdup(cmd);
-
-#ifdef HAVE_PHPDBG_READLINE
- if (!buffered && cmd && !(PHPDBG_G(flags) & PHPDBG_IS_REMOTE) && isatty(PHPDBG_G(io)[PHPDBG_STDIN].fd)) {
- free(cmd);
+ buffer = estrdup(buffered);
}
-#endif
}
if (buffer && isspace(*buffer)) {
diff --git a/sapi/phpdbg/phpdbg_cmd.h b/sapi/phpdbg/phpdbg_cmd.h
index b82ed9aceb..3cc07d1a70 100644
--- a/sapi/phpdbg/phpdbg_cmd.h
+++ b/sapi/phpdbg/phpdbg_cmd.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -83,10 +81,6 @@ struct _phpdbg_param {
(v)->top = NULL; \
} while(0)
-#ifndef YYSTYPE
-#define YYSTYPE phpdbg_param_t
-#endif
-
#define PHPDBG_ASYNC_SAFE 1
typedef int (*phpdbg_command_handler_t)(const phpdbg_param_t*);
@@ -131,8 +125,8 @@ typedef struct {
/*
* Input Management
*/
-PHPDBG_API char* phpdbg_read_input(char *buffered);
-PHPDBG_API void phpdbg_destroy_input(char**);
+PHPDBG_API char *phpdbg_read_input(const char *buffered);
+PHPDBG_API void phpdbg_destroy_input(char **input);
PHPDBG_API int phpdbg_ask_user_permission(const char *question);
/**
diff --git a/sapi/phpdbg/phpdbg_eol.c b/sapi/phpdbg/phpdbg_eol.c
index 4115ea449b..51c58b0ad1 100644
--- a/sapi/phpdbg/phpdbg_eol.c
+++ b/sapi/phpdbg/phpdbg_eol.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_eol.h b/sapi/phpdbg/phpdbg_eol.h
index 46141c62cd..b59f0cd74e 100644
--- a/sapi/phpdbg/phpdbg_eol.h
+++ b/sapi/phpdbg/phpdbg_eol.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_frame.c b/sapi/phpdbg/phpdbg_frame.c
index 912089ea23..453a0d74ba 100644
--- a/sapi/phpdbg/phpdbg_frame.c
+++ b/sapi/phpdbg/phpdbg_frame.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -231,7 +229,7 @@ static void phpdbg_dump_prototype(zval *tmp) /* {{{ */
}
if (!is_variadic) {
- is_variadic = arginfo ? arginfo[j].is_variadic : 0;
+ is_variadic = arginfo ? ZEND_ARG_IS_VARIADIC(&arginfo[j]) : 0;
}
phpdbg_xml(" variadic=\"%s\" name=\"%s\">", is_variadic ? "variadic" : "", arg_name ? arg_name : "");
diff --git a/sapi/phpdbg/phpdbg_frame.h b/sapi/phpdbg/phpdbg_frame.h
index d7d9534b1f..6a5c25b53e 100644
--- a/sapi/phpdbg/phpdbg_frame.h
+++ b/sapi/phpdbg/phpdbg_frame.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_help.c b/sapi/phpdbg/phpdbg_help.c
index 32d2485ff9..e8a02de444 100644
--- a/sapi/phpdbg/phpdbg_help.c
+++ b/sapi/phpdbg/phpdbg_help.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -29,7 +27,7 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg)
/* {{{ Commands Table */
#define PHPDBG_COMMAND_HELP_D(name, tip, alias, action) \
- {PHPDBG_STRL(#name), tip, sizeof(tip)-1, alias, action, &phpdbg_prompt_commands[16], 0}
+ {PHPDBG_STRL(#name), tip, sizeof(tip)-1, alias, action, &phpdbg_prompt_commands[16], 0, NULL, (zend_bool) 0}
const phpdbg_command_t phpdbg_help_commands[] = {
PHPDBG_COMMAND_HELP_D(aliases, "show alias list", 'a', phpdbg_do_help_aliases),
@@ -430,7 +428,7 @@ phpdbg_help_text_t phpdbg_help_text[] = {
"This mode is enabled by specifying the **-a** option. Phpdbg will bind only to the loopback "
"interface by default, and this can only be overridden by explicitly setting the remote console "
-"bind address using the **-a** option. If **-a** is specied without an argument, then phpdbg "
+"bind address using the **-a** option. If **-a** is specified without an argument, then phpdbg "
"will bind to all available interfaces. You should be aware of the security implications of "
"doing this, so measures should be taken to secure this service if bound to a publicly accessible "
"interface/port." CR CR
diff --git a/sapi/phpdbg/phpdbg_help.h b/sapi/phpdbg/phpdbg_help.h
index 420e6fb014..1e531cc91c 100644
--- a/sapi/phpdbg/phpdbg_help.h
+++ b/sapi/phpdbg/phpdbg_help.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_info.c b/sapi/phpdbg/phpdbg_info.c
index bcec3361fc..783681009e 100644
--- a/sapi/phpdbg/phpdbg_info.c
+++ b/sapi/phpdbg/phpdbg_info.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -125,7 +123,7 @@ PHPDBG_INFO(constants) /* {{{ */
"address=\"%p\" refcount=\"%d\" type=\"%s\" name=\"%.*s\" " attrs, \
"%-18p %-7d %-9s %.*s" msg, &data->value, \
Z_REFCOUNTED(data->value) ? Z_REFCOUNT(data->value) : 1, \
- zend_zval_type_name(&data->value), \
+ zend_get_type_by_const(Z_TYPE(data->value)), \
(int) ZSTR_LEN(data->name), ZSTR_VAL(data->name), ##__VA_ARGS__)
switch (Z_TYPE(data->value)) {
@@ -233,7 +231,7 @@ static int phpdbg_print_symbols(zend_bool show_globals) {
#define VARIABLEINFO(attrs, msg, ...) \
phpdbg_writeln("variable", \
"address=\"%p\" refcount=\"%d\" type=\"%s\" refstatus=\"%s\" name=\"%.*s\" " attrs, \
- "%-18p %-7d %-9s %s$%.*s" msg, data, Z_REFCOUNTED_P(data) ? Z_REFCOUNT_P(data) : 1, zend_zval_type_name(data), isref, (int) ZSTR_LEN(var), ZSTR_VAL(var), ##__VA_ARGS__)
+ "%-18p %-7d %-9s %s$%.*s" msg, data, Z_REFCOUNTED_P(data) ? Z_REFCOUNT_P(data) : 1, zend_get_type_by_const(Z_TYPE_P(data)), isref, (int) ZSTR_LEN(var), ZSTR_VAL(var), ##__VA_ARGS__)
retry_switch:
switch (Z_TYPE_P(data)) {
case IS_RESOURCE:
diff --git a/sapi/phpdbg/phpdbg_info.h b/sapi/phpdbg/phpdbg_info.h
index faf0090bd3..16a814d097 100644
--- a/sapi/phpdbg/phpdbg_info.h
+++ b/sapi/phpdbg/phpdbg_info.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_io.c b/sapi/phpdbg/phpdbg_io.c
index 6917daa9d9..30857ac945 100644
--- a/sapi/phpdbg/phpdbg_io.c
+++ b/sapi/phpdbg/phpdbg_io.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_io.h b/sapi/phpdbg/phpdbg_io.h
index d875d276cb..4ae98dc289 100644
--- a/sapi/phpdbg/phpdbg_io.h
+++ b/sapi/phpdbg/phpdbg_io.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_lexer.h b/sapi/phpdbg/phpdbg_lexer.h
index e1cc55ccf3..5e87157cd7 100644
--- a/sapi/phpdbg/phpdbg_lexer.h
+++ b/sapi/phpdbg/phpdbg_lexer.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c
index 03b4c3526e..0967e22f65 100644
--- a/sapi/phpdbg/phpdbg_list.c
+++ b/sapi/phpdbg/phpdbg_list.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -244,7 +242,6 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) {
if (zend_stream_fixup(file, &bufptr, &len) == FAILURE) {
if (type == ZEND_REQUIRE) {
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file->filename);
- zend_bailout();
} else {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file->filename);
}
@@ -319,7 +316,7 @@ zend_op_array *phpdbg_init_compile_file(zend_file_handle *file, int type) {
return op_array;
}
-zend_op_array *phpdbg_compile_string(zval *source_string, char *filename) {
+zend_op_array *phpdbg_compile_string(zend_string *source_string, const char *filename) {
zend_string *fake_name;
zend_op_array *op_array;
phpdbg_file_source *dataptr;
@@ -330,9 +327,9 @@ zend_op_array *phpdbg_compile_string(zval *source_string, char *filename) {
return PHPDBG_G(compile_string)(source_string, filename);
}
- dataptr = emalloc(sizeof(phpdbg_file_source) + sizeof(uint32_t) * Z_STRLEN_P(source_string));
- dataptr->buf = estrndup(Z_STRVAL_P(source_string), Z_STRLEN_P(source_string));
- dataptr->len = Z_STRLEN_P(source_string);
+ dataptr = emalloc(sizeof(phpdbg_file_source) + sizeof(uint32_t) * ZSTR_LEN(source_string));
+ dataptr->buf = estrndup(ZSTR_VAL(source_string), ZSTR_LEN(source_string));
+ dataptr->len = ZSTR_LEN(source_string);
dataptr->line[0] = 0;
for (line = 0, bufptr = dataptr->buf - 1, endptr = dataptr->buf + dataptr->len; ++bufptr < endptr;) {
if (*bufptr == '\n') {
diff --git a/sapi/phpdbg/phpdbg_list.h b/sapi/phpdbg/phpdbg_list.h
index 68cbee8c16..38b4f6bbb6 100644
--- a/sapi/phpdbg/phpdbg_list.h
+++ b/sapi/phpdbg/phpdbg_list.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c
index 2d6bcd4f78..4c0c2fbf7a 100644
--- a/sapi/phpdbg/phpdbg_opcode.c
+++ b/sapi/phpdbg/phpdbg_opcode.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_opcode.h b/sapi/phpdbg/phpdbg_opcode.h
index b9e2fa506c..68bdddf0b1 100644
--- a/sapi/phpdbg/phpdbg_opcode.h
+++ b/sapi/phpdbg/phpdbg_opcode.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_out.c b/sapi/phpdbg/phpdbg_out.c
index 665df6d08b..30dadfc11c 100644
--- a/sapi/phpdbg/phpdbg_out.c
+++ b/sapi/phpdbg/phpdbg_out.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_out.h b/sapi/phpdbg/phpdbg_out.h
index 09f4815d85..19e2b3766d 100644
--- a/sapi/phpdbg/phpdbg_out.h
+++ b/sapi/phpdbg/phpdbg_out.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_parser.y b/sapi/phpdbg/phpdbg_parser.y
index 3031ce5a80..f776586810 100644
--- a/sapi/phpdbg/phpdbg_parser.y
+++ b/sapi/phpdbg/phpdbg_parser.y
@@ -1,18 +1,24 @@
-%{
-
+%require "3.0"
/*
* phpdbg_parser.y
* (from php-src root)
*/
+%code requires {
#include "phpdbg.h"
+#ifndef YY_TYPEDEF_YY_SCANNER_T
+#define YY_TYPEDEF_YY_SCANNER_T
+typedef void* yyscan_t;
+#endif
+}
+
+%code {
+
#include "phpdbg_cmd.h"
#include "phpdbg_utils.h"
#include "phpdbg_cmd.h"
#include "phpdbg_prompt.h"
-#define YYSTYPE phpdbg_param_t
-
#include "phpdbg_parser.h"
#include "phpdbg_lexer.h"
@@ -26,19 +32,13 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg)
#define YYFREE free
#endif
-%}
+}
+%define api.prefix {phpdbg_}
%define api.pure full
+%define api.value.type {phpdbg_param_t}
%define parse.error verbose
-%code requires {
-#include "phpdbg.h"
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
-typedef void* yyscan_t;
-#endif
-}
-
%token T_EVAL "eval"
%token T_RUN "run"
%token T_SHELL "shell"
@@ -65,7 +65,7 @@ typedef void* yyscan_t;
input
: command { $$ = $1; }
| input T_SEPARATOR command { phpdbg_stack_separate($1.top); $$ = $3; }
- | /* empty */
+ | %empty
;
command
@@ -143,7 +143,7 @@ parameter
req_id
: T_REQ_ID { PHPDBG_G(req_id) = $1.num; }
- | /* empty */
+ | %empty
;
full_expression
diff --git a/sapi/phpdbg/phpdbg_print.c b/sapi/phpdbg/phpdbg_print.c
index 5f48bd6a59..df925b6402 100644
--- a/sapi/phpdbg/phpdbg_print.c
+++ b/sapi/phpdbg/phpdbg_print.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -377,7 +375,7 @@ void phpdbg_print_opcodes_class(const char *class) {
phpdbg_print_opcodes_ce(ce);
}
-PHPDBG_API void phpdbg_print_opcodes(char *function)
+PHPDBG_API void phpdbg_print_opcodes(const char *function)
{
if (function == NULL) {
phpdbg_print_opcodes_main();
@@ -403,12 +401,12 @@ PHPDBG_API void phpdbg_print_opcodes(char *function)
}
} ZEND_HASH_FOREACH_END();
} else {
- function = zend_str_tolower_dup(function, strlen(function));
+ char *function_lowercase = zend_str_tolower_dup(function, strlen(function));
- if (strstr(function, "::") == NULL) {
- phpdbg_print_opcodes_function(function, strlen(function));
+ if (strstr(function_lowercase, "::") == NULL) {
+ phpdbg_print_opcodes_function(function_lowercase, strlen(function_lowercase));
} else {
- char *method_name, *class_name = strtok(function, "::");
+ char *method_name, *class_name = strtok(function_lowercase, "::");
if ((method_name = strtok(NULL, "::")) == NULL) {
phpdbg_print_opcodes_class(class_name);
} else {
@@ -416,6 +414,6 @@ PHPDBG_API void phpdbg_print_opcodes(char *function)
}
}
- efree(function);
+ efree(function_lowercase);
}
}
diff --git a/sapi/phpdbg/phpdbg_print.h b/sapi/phpdbg/phpdbg_print.h
index 66eae7bceb..14f5bf6939 100644
--- a/sapi/phpdbg/phpdbg_print.h
+++ b/sapi/phpdbg/phpdbg_print.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -35,7 +33,7 @@ PHPDBG_PRINT(method);
PHPDBG_PRINT(func);
PHPDBG_PRINT(stack);
-PHPDBG_API void phpdbg_print_opcodes(char *function);
+PHPDBG_API void phpdbg_print_opcodes(const char *function);
extern const phpdbg_command_t phpdbg_print_commands[];
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index 6b0de5c021..adb31d1e3c 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -124,7 +122,6 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack) /* {{{ */
//???fci.symbol_table = zend_rebuild_symbol_table();
fci.object = NULL;
fci.retval = &fretval;
- fci.no_separation = 1;
if (name->next) {
zval params;
@@ -522,12 +519,7 @@ exec_code:
} /* }}} */
int phpdbg_compile_stdin(zend_string *code) {
- zval zv;
-
- ZVAL_STR(&zv, code);
-
- PHPDBG_G(ops) = zend_compile_string(&zv, "Standard input code");
-
+ PHPDBG_G(ops) = zend_compile_string(code, "Standard input code");
zend_string_release(code);
if (EG(exception)) {
@@ -723,22 +715,21 @@ static inline void phpdbg_handle_exception(void) /* {{{ */
zend_object *ex = EG(exception);
zend_string *msg, *file;
zend_long line;
- zval zv, rv, tmp;
+ zval rv, tmp;
EG(exception) = NULL;
- ZVAL_OBJ(&zv, ex);
- zend_call_method_with_0_params(&zv, ex->ce, &ex->ce->__tostring, "__tostring", &tmp);
- file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("file"), 1, &rv));
- line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv));
+ zend_call_known_instance_method_with_0_params(ex->ce->__tostring, ex, &tmp);
+ file = zval_get_string(zend_read_property(zend_get_exception_base(ex), ex, ZEND_STRL("file"), 1, &rv));
+ line = zval_get_long(zend_read_property(zend_get_exception_base(ex), ex, ZEND_STRL("line"), 1, &rv));
if (EG(exception)) {
EG(exception) = NULL;
msg = ZSTR_EMPTY_ALLOC();
} else {
- zend_update_property_string(zend_get_exception_base(&zv), &zv, ZEND_STRL("string"), Z_STRVAL(tmp));
+ zend_update_property_string(zend_get_exception_base(ex), ex, ZEND_STRL("string"), Z_STRVAL(tmp));
zval_ptr_dtor(&tmp);
- msg = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("string"), 1, &rv));
+ msg = zval_get_string(zend_read_property(zend_get_exception_base(ex), ex, ZEND_STRL("string"), 1, &rv));
}
phpdbg_error("exception", "name=\"%s\" file=\"%s\" line=\"" ZEND_LONG_FMT "\"", "Uncaught %s in %s on line " ZEND_LONG_FMT, ZSTR_VAL(ex->ce->name), ZSTR_VAL(file), line);
@@ -1231,9 +1222,8 @@ static int add_module_info(zend_module_entry *module) /* {{{ */ {
}
/* }}} */
-static int add_zendext_info(zend_extension *ext) /* {{{ */ {
+static void add_zendext_info(zend_extension *ext) /* {{{ */ {
phpdbg_write("extension", "name=\"%s\"", "%s\n", ext->name);
- return 0;
}
/* }}} */
@@ -1669,7 +1659,6 @@ static inline void list_code() {
zend_clear_exception(); \
list_code(); \
switch (phpdbg_interactive(allow_async_unsafe, NULL)) { \
- zval zv; \
case PHPDBG_LEAVE: \
case PHPDBG_FINISH: \
case PHPDBG_UNTIL: \
@@ -1679,8 +1668,7 @@ static inline void list_code() {
EG(current_execute_data)->opline = backup_opline; \
EG(exception) = exception; \
} else { \
- Z_OBJ(zv) = exception; \
- zend_throw_exception_internal(&zv); \
+ zend_throw_exception_internal(exception); \
} \
EG(opline_before_exception) = before_ex; \
} \
@@ -1711,10 +1699,15 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
#ifdef ZEND_WIN32
if (EG(timed_out)) {
- zend_timeout(0);
+ zend_timeout();
}
#endif
+ if (exception && zend_is_unwind_exit(exception)) {
+ /* Restore bailout based exit. */
+ zend_bailout();
+ }
+
if (PHPDBG_G(flags) & PHPDBG_PREVENT_INTERACTIVE) {
phpdbg_print_opline_ex(execute_data, 0);
goto next;
@@ -1723,9 +1716,6 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
/* check for uncaught exceptions */
if (exception && PHPDBG_G(handled_exception) != exception && !(PHPDBG_G(flags) & PHPDBG_IN_EVAL)) {
zend_execute_data *prev_ex = execute_data;
- zval zv, rv;
- zend_string *file, *msg;
- zend_long line;
do {
prev_ex = zend_generator_check_placeholder_frame(prev_ex);
@@ -1741,10 +1731,10 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
PHPDBG_G(handled_exception) = exception;
- ZVAL_OBJ(&zv, exception);
- file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("file"), 1, &rv));
- line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv));
- msg = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("message"), 1, &rv));
+ zval rv;
+ zend_string *file = zval_get_string(zend_read_property(zend_get_exception_base(exception), exception, ZEND_STRL("file"), 1, &rv));
+ zend_long line = zval_get_long(zend_read_property(zend_get_exception_base(exception), exception, ZEND_STRL("line"), 1, &rv));
+ zend_string *msg = zval_get_string(zend_read_property(zend_get_exception_base(exception), exception, ZEND_STRL("message"), 1, &rv));
phpdbg_error("exception",
"name=\"%s\" file=\"%s\" line=\"" ZEND_LONG_FMT "\"",
diff --git a/sapi/phpdbg/phpdbg_prompt.h b/sapi/phpdbg/phpdbg_prompt.h
index 142581783a..2c2c3d2047 100644
--- a/sapi/phpdbg/phpdbg_prompt.h
+++ b/sapi/phpdbg/phpdbg_prompt.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_rinit_hook.c b/sapi/phpdbg/phpdbg_rinit_hook.c
index 2bc1c59b90..ddbc433669 100644
--- a/sapi/phpdbg/phpdbg_rinit_hook.c
+++ b/sapi/phpdbg/phpdbg_rinit_hook.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -20,7 +18,7 @@
#include "php_ini.h"
#include <errno.h>
-ZEND_DECLARE_MODULE_GLOBALS(phpdbg_webhelper);
+ZEND_DECLARE_MODULE_GLOBALS(phpdbg_webhelper)
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("phpdbg.auth", "", PHP_INI_SYSTEM | PHP_INI_PERDIR, OnUpdateString, auth, zend_phpdbg_webhelper_globals, phpdbg_webhelper_globals)
diff --git a/sapi/phpdbg/phpdbg_rinit_hook.h b/sapi/phpdbg/phpdbg_rinit_hook.h
index a350ddec54..58b59d1947 100644
--- a/sapi/phpdbg/phpdbg_rinit_hook.h
+++ b/sapi/phpdbg/phpdbg_rinit_hook.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_set.c b/sapi/phpdbg/phpdbg_set.c
index da3ec4cf19..e994ee3fa4 100644
--- a/sapi/phpdbg/phpdbg_set.c
+++ b/sapi/phpdbg/phpdbg_set.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_set.h b/sapi/phpdbg/phpdbg_set.h
index 7f89d9182d..ffc55142ed 100644
--- a/sapi/phpdbg/phpdbg_set.h
+++ b/sapi/phpdbg/phpdbg_set.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_sigio_win32.c b/sapi/phpdbg/phpdbg_sigio_win32.c
index f3221d09cb..fb3254ac4b 100644
--- a/sapi/phpdbg/phpdbg_sigio_win32.c
+++ b/sapi/phpdbg/phpdbg_sigio_win32.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_sigio_win32.h b/sapi/phpdbg/phpdbg_sigio_win32.h
index af7b9f10cb..62c7dd606e 100644
--- a/sapi/phpdbg/phpdbg_sigio_win32.h
+++ b/sapi/phpdbg/phpdbg_sigio_win32.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c
index d32f2fb7f8..56fb654909 100644
--- a/sapi/phpdbg/phpdbg_utils.c
+++ b/sapi/phpdbg/phpdbg_utils.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -41,7 +39,7 @@
ZEND_EXTERN_MODULE_GLOBALS(phpdbg)
/* {{{ color structures */
-const static phpdbg_color_t colors[] = {
+static const phpdbg_color_t colors[] = {
PHPDBG_COLOR_D("none", "0;0"),
PHPDBG_COLOR_D("white", "0;64"),
@@ -72,7 +70,7 @@ const static phpdbg_color_t colors[] = {
}; /* }}} */
/* {{{ */
-const static phpdbg_element_t elements[] = {
+static const phpdbg_element_t elements[] = {
PHPDBG_ELEMENT_D("prompt", PHPDBG_COLOR_PROMPT),
PHPDBG_ELEMENT_D("error", PHPDBG_COLOR_ERROR),
PHPDBG_ELEMENT_D("notice", PHPDBG_COLOR_NOTICE),
@@ -711,7 +709,6 @@ head_done:
ZEND_HASH_FOREACH_KEY_VAL_IND(myht, num, key, val) {
element_dump_func(val, key, num);
} ZEND_HASH_FOREACH_END();
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) element_dump_func, 0);
GC_UNPROTECT_RECURSION(myht);
if (Z_TYPE_P(zv) == IS_OBJECT) {
zend_release_properties(myht);
diff --git a/sapi/phpdbg/phpdbg_utils.h b/sapi/phpdbg/phpdbg_utils.h
index c212056670..508bb89c80 100644
--- a/sapi/phpdbg/phpdbg_utils.h
+++ b/sapi/phpdbg/phpdbg_utils.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_wait.c b/sapi/phpdbg/phpdbg_wait.c
index 69be24a953..ec78f18db7 100644
--- a/sapi/phpdbg/phpdbg_wait.c
+++ b/sapi/phpdbg/phpdbg_wait.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -36,7 +34,7 @@ static void phpdbg_rebuild_http_globals_array(int type, const char *name) {
static int phpdbg_dearm_autoglobals(zend_auto_global *auto_global) {
- if (ZSTR_LEN(auto_global->name) != sizeof("GLOBALS") - 1 || memcmp(ZSTR_VAL(auto_global->name), "GLOBALS", sizeof("GLOBALS") - 1)) {
+ if (zend_string_equals_literal(auto_global->name, "GLOBALS")) {
auto_global->armed = 0;
}
@@ -48,14 +46,10 @@ typedef struct {
HashPosition pos[2];
} phpdbg_intersect_ptr;
-static int phpdbg_array_data_compare(const void *a, const void *b) {
- Bucket *f, *s;
+static int phpdbg_array_data_compare(Bucket *f, Bucket *s) {
int result;
zval *first, *second;
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
first = &f->val;
second = &s->val;
@@ -74,8 +68,8 @@ static void phpdbg_array_intersect_init(phpdbg_intersect_ptr *info, HashTable *h
info->ht[0] = ht1;
info->ht[1] = ht2;
- zend_hash_sort(info->ht[0], (compare_func_t) phpdbg_array_data_compare, 0);
- zend_hash_sort(info->ht[1], (compare_func_t) phpdbg_array_data_compare, 0);
+ zend_hash_sort(info->ht[0], phpdbg_array_data_compare, 0);
+ zend_hash_sort(info->ht[1], phpdbg_array_data_compare, 0);
zend_hash_internal_pointer_reset_ex(info->ht[0], &info->pos[0]);
zend_hash_internal_pointer_reset_ex(info->ht[1], &info->pos[1]);
diff --git a/sapi/phpdbg/phpdbg_wait.h b/sapi/phpdbg/phpdbg_wait.h
index b748e162bb..5d5ea0450c 100644
--- a/sapi/phpdbg/phpdbg_wait.h
+++ b/sapi/phpdbg/phpdbg_wait.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c
index 1dab755171..af8de17096 100644
--- a/sapi/phpdbg/phpdbg_watch.c
+++ b/sapi/phpdbg/phpdbg_watch.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -144,7 +142,7 @@ zend_bool phpdbg_check_watch_diff(phpdbg_watchtype type, void *oldPtr, void *new
case WATCH_ON_STR:
return memcmp(oldPtr, newPtr, *(size_t *) oldPtr + XtOffsetOf(zend_string, val) - XtOffsetOf(zend_string, len)) != 0;
case WATCH_ON_HASHDATA:
- ZEND_ASSERT(0);
+ ZEND_UNREACHABLE();
}
return 0;
}
@@ -212,7 +210,7 @@ void phpdbg_print_watch_diff(phpdbg_watchtype type, zend_string *name, void *old
break;
case WATCH_ON_HASHDATA:
- ZEND_ASSERT(0);
+ ZEND_UNREACHABLE();
}
phpdbg_xml("</watchdata>");
@@ -1074,7 +1072,7 @@ void phpdbg_reenable_memory_watches(void) {
phpdbg_watchpoint_t *watch;
ZEND_HASH_FOREACH_NUM_KEY(PHPDBG_G(watchlist_mem), page) {
- /* Disble writing again if there are any watchers on that page */
+ /* Disable writing again if there are any watchers on that page */
res = phpdbg_btree_find_closest(&PHPDBG_G(watchpoint_tree), page + phpdbg_pagesize - 1);
if (res) {
watch = res->ptr;
@@ -1251,10 +1249,12 @@ static int phpdbg_watchpoint_parse_wrapper(char *name, size_t namelen, char *key
if (element->child) {
element = element->child;
}
- element->id = PHPDBG_G(watch_elements).nNextFreeElement;
- zend_hash_index_add_ptr(&PHPDBG_G(watch_elements), element->id, element);
- phpdbg_notice("watchadd", "index=\"%d\" variable=\"%.*s\"", "Added%s watchpoint #%d for %.*s", (element->flags & PHPDBG_WATCH_RECURSIVE_ROOT) ? " recursive" : "", element->id, (int) ZSTR_LEN(element->str), ZSTR_VAL(element->str));
+ /* work around missing API for extending an array with a new element, and getting its index */
+ zend_hash_next_index_insert_ptr(&PHPDBG_G(watch_elements), element);
+ element->id = PHPDBG_G(watch_elements).nNextFreeElement - 1;
+
+ phpdbg_notice("watchadd", "index=\"%d\" variable=\"%.*s\"", "Added%s watchpoint #%u for %.*s", (element->flags & PHPDBG_WATCH_RECURSIVE_ROOT) ? " recursive" : "", element->id, (int) ZSTR_LEN(element->str), ZSTR_VAL(element->str));
}
PHPDBG_G(watch_tmp) = NULL;
@@ -1385,11 +1385,11 @@ PHPDBG_WATCH(array) /* {{{ */
void phpdbg_setup_watchpoints(void) {
-#if _SC_PAGE_SIZE
+#if defined(_SC_PAGE_SIZE)
phpdbg_pagesize = sysconf(_SC_PAGE_SIZE);
-#elif _SC_PAGESIZE
+#elif defined(_SC_PAGESIZE)
phpdbg_pagesize = sysconf(_SC_PAGESIZE);
-#elif _SC_NUTC_OS_PAGESIZE
+#elif defined(_SC_NUTC_OS_PAGESIZE)
phpdbg_pagesize = sysconf(_SC_NUTC_OS_PAGESIZE);
#else
phpdbg_pagesize = 4096; /* common pagesize */
diff --git a/sapi/phpdbg/phpdbg_watch.h b/sapi/phpdbg/phpdbg_watch.h
index 9814d78e2e..6782c38d54 100644
--- a/sapi/phpdbg/phpdbg_watch.h
+++ b/sapi/phpdbg/phpdbg_watch.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_webdata_transfer.c b/sapi/phpdbg/phpdbg_webdata_transfer.c
index 36d327f56f..81f747d69f 100644
--- a/sapi/phpdbg/phpdbg_webdata_transfer.c
+++ b/sapi/phpdbg/phpdbg_webdata_transfer.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -30,7 +28,7 @@ static int phpdbg_is_auto_global(char *name, int len) {
PHPDBG_API void phpdbg_webdata_compress(char **msg, size_t *len) {
zval array;
HashTable *ht;
- zval zv[9] = {{{0}}};
+ zval zv[9];
array_init(&array);
ht = Z_ARRVAL(array);
diff --git a/sapi/phpdbg/phpdbg_webdata_transfer.h b/sapi/phpdbg/phpdbg_webdata_transfer.h
index c08c6e8f93..e840030eac 100644
--- a/sapi/phpdbg/phpdbg_webdata_transfer.h
+++ b/sapi/phpdbg/phpdbg_webdata_transfer.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_win.c b/sapi/phpdbg/phpdbg_win.c
index 6bf79981e0..1b1787526f 100644
--- a/sapi/phpdbg/phpdbg_win.c
+++ b/sapi/phpdbg/phpdbg_win.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_win.h b/sapi/phpdbg/phpdbg_win.h
index ba83062301..44874a50a5 100644
--- a/sapi/phpdbg/phpdbg_win.h
+++ b/sapi/phpdbg/phpdbg_win.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/tests/bug78297.phpt b/sapi/phpdbg/tests/bug78297.phpt
index 47b13ad605..7fa904b03a 100644
--- a/sapi/phpdbg/tests/bug78297.phpt
+++ b/sapi/phpdbg/tests/bug78297.phpt
@@ -9,8 +9,8 @@ include "does_not_exist.php";
--EXPECTF--
[Successful compilation of %s]
prompt>
-Warning: include(%s): failed to open stream: No such file or directory in %s on line %d
+Warning: include(%s): Failed to open stream: No such file or directory in %s on line %d
Warning: include(): Failed opening 'does_not_exist.php' for inclusion (include_path=%s) in %s on line %d
[Script ended normally]
-prompt>
+prompt>
diff --git a/sapi/phpdbg/tests/exceptions_003.phpt b/sapi/phpdbg/tests/exceptions_003.phpt
index 16920870c3..ee68490df1 100644
--- a/sapi/phpdbg/tests/exceptions_003.phpt
+++ b/sapi/phpdbg/tests/exceptions_003.phpt
@@ -26,7 +26,7 @@ prompt> [L7 %s ECHO<1> "ok\n"
00009: } catch (Error $e) {
prompt> ok
[L7 %s FAST_RET ~%d try-catch(0) %s]
-[L9 %s CATCH<%d> "Error" $e %s]
+[L9 %s CATCH<%d> %s "Error" $e %s]
>00005: x();
00006: } finally {
00007: print "ok\n";
diff --git a/sapi/phpdbg/tests/info_001.phpt b/sapi/phpdbg/tests/info_001.phpt
index 2f38fd36af..2807855709 100644
--- a/sapi/phpdbg/tests/info_001.phpt
+++ b/sapi/phpdbg/tests/info_001.phpt
@@ -48,7 +48,7 @@ prompt> ------------------------------------------------
Function Breakpoints:
#0 foo
prompt> [User-defined constants (0)]
-prompt> [Included files: 0]
+prompt> [Included files: %d]%A
prompt> [No error found!]
prompt> [Literal Constants in foo() (2)]
|-------- C0 -------> [var_dump]
diff --git a/sapi/phpdbg/tests/match_breakpoints_001.phpt b/sapi/phpdbg/tests/match_breakpoints_001.phpt
new file mode 100644
index 0000000000..9ef74179c1
--- /dev/null
+++ b/sapi/phpdbg/tests/match_breakpoints_001.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test match default breakpoint with variable assignment
+--INI--
+opcache.enable_cli=0
+--PHPDBG--
+b 5
+b 10
+r
+q
+--EXPECTF--
+[Successful compilation of %s.php]
+prompt> [Breakpoint #0 added at %s.php:5]
+prompt> [Breakpoint #1 added at %s.php:10]
+prompt> [Breakpoint #1 at %s.php:10, hits: 1]
+>00010: default => 'bar', // breakpoint #1
+ 00011: };
+ 00012:
+prompt>
+--FILE--
+<?php
+
+$foo = match (0) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #0
+};
+
+$foo = match (1) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #1
+};
diff --git a/sapi/phpdbg/tests/match_breakpoints_002.phpt b/sapi/phpdbg/tests/match_breakpoints_002.phpt
new file mode 100644
index 0000000000..21b0b4ef3a
--- /dev/null
+++ b/sapi/phpdbg/tests/match_breakpoints_002.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test match default breakpoint with property assignment
+--INI--
+opcache.enable_cli=0
+--PHPDBG--
+b 7
+b 12
+r
+q
+--EXPECTF--
+[Successful compilation of %s.php]
+prompt> [Breakpoint #0 added at %s.php:7]
+prompt> [Breakpoint #1 added at %s.php:12]
+prompt> [Breakpoint #1 at %s.php:12, hits: 1]
+>00012: default => 'bar', // breakpoint #1
+ 00013: };
+ 00014:
+prompt>
+--FILE--
+<?php
+
+$foo = new stdClass();
+
+$foo->bar = match (0) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #0
+};
+
+$foo->bar = match (1) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #1
+};
diff --git a/sapi/phpdbg/tests/match_breakpoints_003.phpt b/sapi/phpdbg/tests/match_breakpoints_003.phpt
new file mode 100644
index 0000000000..dbd7eb70ab
--- /dev/null
+++ b/sapi/phpdbg/tests/match_breakpoints_003.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test match default breakpoint with dim assignment
+--INI--
+opcache.enable_cli=0
+--PHPDBG--
+b 7
+b 12
+r
+q
+--EXPECTF--
+[Successful compilation of %s.php]
+prompt> [Breakpoint #0 added at %s.php:7]
+prompt> [Breakpoint #1 added at %s.php:12]
+prompt> [Breakpoint #1 at %s.php:12, hits: 1]
+>00012: default => 'bar', // breakpoint #1
+ 00013: };
+ 00014:
+prompt>
+--FILE--
+<?php
+
+$foo = [];
+
+$foo['foo'] = match (0) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #0
+};
+
+$foo->bar = match (1) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #1
+};
diff --git a/sapi/phpdbg/tests/match_breakpoints_004.phpt b/sapi/phpdbg/tests/match_breakpoints_004.phpt
new file mode 100644
index 0000000000..d59555e692
--- /dev/null
+++ b/sapi/phpdbg/tests/match_breakpoints_004.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test match default breakpoint with static variable assignment
+--INI--
+opcache.enable_cli=0
+--PHPDBG--
+b 9
+b 14
+r
+q
+--EXPECTF--
+[Successful compilation of %s.php]
+prompt> [Breakpoint #0 added at %s.php:9]
+prompt> [Breakpoint #1 added at %s.php:14]
+prompt> [Breakpoint #1 at %s.php:14, hits: 1]
+>00014: default => 'bar', // breakpoint #1
+ 00015: };
+ 00016:
+prompt>
+--FILE--
+<?php
+
+class Foo {
+ public static $bar;
+}
+
+Foo::$bar = match (0) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #0
+};
+
+Foo::$bar = match (1) {
+ 0 => 'foo',
+ default => 'bar', // breakpoint #1
+};