[PHP-CVS] [php-src] master: main: convert last_error_lineno global to type uint32_t
[email protected] (Gina Peter Banyard) Thu, 30 Jul 2026 08:46:03 +0000
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: Gina Peter Banyard (Girgias)
Date: 2026-07-30T09:45:57+01:00
Commit: https://github.com/php/php-src/commit/6877f77c628c09899af2daecea33cc0fb127e58a
Raw diff: https://github.com/php/php-src/commit/6877f77c628c09899af2daecea33cc0fb127e58a.diff
main: convert last_error_lineno global to type uint32_t
As this is the expected type for lineno everywhere else in the engine
Changed paths:
M ext/standard/basic_functions.c
M main/main.c
M main/php_globals.h
M sapi/cli/php_cli_server.c
M sapi/phpdbg/phpdbg_info.c
Diff:
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index e81050323754..f8fcc01bf5bb 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 48cdc4e05d37..3c079cb7fd77 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 537e1cfd2dc7..5e6b7a30e85b 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 e06f30b9e2d2..85028cc03f7c 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 ee579e81df02..2100d6e7dca4 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));