Commit 6877f77c628 for php.net
commit 6877f77c628c09899af2daecea33cc0fb127e58a
Author: Gina Peter Banyard <girgias@php.net>
Date: Sun Jul 19 18:22:38 2026 +0100
main: convert last_error_lineno global to type uint32_t
As this is the expected type for lineno everywhere else in the engine
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index e8105032375..f8fcc01bf5b 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -1434,7 +1434,7 @@ PHP_FUNCTION(error_get_last)
ZVAL_STR_COPY(&tmp, PG(last_error_file));
zend_hash_update(Z_ARR_P(return_value), ZSTR_KNOWN(ZEND_STR_FILE), &tmp);
- ZVAL_LONG(&tmp, PG(last_error_lineno));
+ ZVAL_LONG(&tmp, (zend_long)PG(last_error_lineno));
zend_hash_update(Z_ARR_P(return_value), ZSTR_KNOWN(ZEND_STR_LINE), &tmp);
if (!Z_ISUNDEF(EG(last_fatal_error_backtrace))) {
diff --git a/main/main.c b/main/main.c
index 48cdc4e05d3..3c079cb7fd7 100644
--- a/main/main.c
+++ b/main/main.c
@@ -1315,7 +1315,7 @@ static ZEND_COLD void php_error_cb(int orig_type, zend_string *error_filename, c
* be NULL if PG(last_error_message) is not NULL */
if (!zend_string_equals(PG(last_error_message), message)
|| (!PG(ignore_repeated_source)
- && ((PG(last_error_lineno) != (int)error_lineno)
+ && ((PG(last_error_lineno) != error_lineno)
|| !zend_string_equals(PG(last_error_file), error_filename)))) {
display = 1;
} else {
diff --git a/main/php_globals.h b/main/php_globals.h
index 537e1cfd2dc..5e6b7a30e85 100644
--- a/main/php_globals.h
+++ b/main/php_globals.h
@@ -136,7 +136,7 @@ struct _php_core_globals {
bool report_zend_debug;
int last_error_type;
- int last_error_lineno;
+ uint32_t last_error_lineno;
zend_string *last_error_message;
zend_string *last_error_file;
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index e06f30b9e2d..85028cc03f7 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -1219,7 +1219,7 @@ 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",
+ spprintf(&error_buf, 0, " - %s in %s on line %" PRIu32,
ZSTR_VAL(PG(last_error_message)), ZSTR_VAL(PG(last_error_file)), PG(last_error_lineno));
if (!error_buf) {
efree(basic_buf);
diff --git a/sapi/phpdbg/phpdbg_info.c b/sapi/phpdbg/phpdbg_info.c
index ee579e81df0..2100d6e7dca 100644
--- a/sapi/phpdbg/phpdbg_info.c
+++ b/sapi/phpdbg/phpdbg_info.c
@@ -81,7 +81,7 @@ PHPDBG_INFO(error) /* {{{ */
{
if (PG(last_error_message)) {
phpdbg_try_access {
- phpdbg_writeln("Last error: %s at %s line %d",
+ phpdbg_writeln("Last error: %s at %s line %" PRIu32,
ZSTR_VAL(PG(last_error_message)),
ZSTR_VAL(PG(last_error_file)),
PG(last_error_lineno));