summaryrefslogtreecommitdiff
path: root/sapi/cli
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-05-29 10:33:22 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-06-05 09:54:02 +0200
commit975acfe71ebed352d86753a6deba3475acad3238 (patch)
tree6f6755b1edab59897e16bf9ca8a128ed554e0dfb /sapi/cli
parente949f306be9e7d54a700cccd5b9af9711615b43f (diff)
downloadphp-git-975acfe71ebed352d86753a6deba3475acad3238.tar.gz
Pass zend_string message to zend_error_cb
This makes the zend_error_cb API simpler, and avoid formatting the same message in multiple places. It should be noted that the passed zend_string is always non-persistent, so if you want to store it persistently somewhere, you may still need to duplicate it. The last_error_message is cleared a bit more aggressive, to make sure it doesn't hang around across allocator life-cycles. Closes GH-5639.
Diffstat (limited to 'sapi/cli')
-rw-r--r--sapi/cli/php_cli_server.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index dbee30700f..b9c5aa523b 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -1214,7 +1214,8 @@ static void php_cli_server_log_response(php_cli_server_client *client, int statu
/* error */
if (append_error_message) {
- spprintf(&error_buf, 0, " - %s in %s on line %d", PG(last_error_message), PG(last_error_file), PG(last_error_lineno));
+ spprintf(&error_buf, 0, " - %s in %s on line %d",
+ ZSTR_VAL(PG(last_error_message)), PG(last_error_file), PG(last_error_lineno));
if (!error_buf) {
efree(basic_buf);
if (message) {