Commit 50decba4a80 for php.net
commit 50decba4a8069007cbe0149f3f514d3e4884e314
Merge: 00d7f85afbb 407c45debce
Author: ndossche <7771979+ndossche@users.noreply.github.com>
Date: Thu Jun 11 22:39:50 2026 +0200
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
sqlite: fix error checks for column retrieval
diff --cc NEWS
index 96ad7840b5b,faeb27fdf6d..51775f01961
--- a/NEWS
+++ b/NEWS
@@@ -30,10 -36,9 +30,13 @@@ PH
Phar::addEmptyDir() for paths starting with "/.phar", while allowing
non-magic directory names that merely share the ".phar" prefix. (Weilin Du)
+- SOAP:
+ . Fixed bug GH-22218 (SoapServer::handle() crash on $_SERVER not being
+ an array). (David Carlier / Rex-Reynolds)
+
+ - Sqlite:
+ . Fix error checks for column retrieval. (ndossche)
+
- Zlib:
. Fixed memory leak if deflate initialization fails and there is a dict.
(ndossche)
diff --cc ext/sqlite3/sqlite3.c
index 7aef25bf73b,1bb93e0e267..a9e2a3a6c30
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@@ -703,14 -735,13 +729,14 @@@ PHP_METHOD(SQLite3, querySingle
case SQLITE_ROW: /* Valid Row */
{
if (!entire_row) {
- sqlite_value_to_zval(stmt, 0, return_value);
+ sqlite_value_to_zval(db_obj, stmt, 0, return_value);
} else {
- int i = 0;
- array_init(return_value);
- for (i = 0; i < sqlite3_data_count(stmt); i++) {
+ int i = 0, count = sqlite3_data_count(stmt);
+
+ array_init_size(return_value, count);
+ for (i = 0; i < count; i++) {
zval data;
- sqlite_value_to_zval(stmt, i, &data);
+ sqlite_value_to_zval(db_obj, stmt, i, &data);
add_assoc_zval(return_value, (char*)sqlite3_column_name(stmt, i), &data);
}
}
@@@ -2467,27 -2418,6 +2493,27 @@@ static void sqlite3_param_dtor(zval *da
}
/* }}} */
+static zend_always_inline void php_sqlite3_fetch_one(int n_cols, php_sqlite3_result *result_obj, zend_long mode, zval *result)
+{
+ for (int i = 0; i < n_cols; i ++) {
+ zval data;
- sqlite_value_to_zval(result_obj->stmt_obj->stmt, i, &data);
++ sqlite_value_to_zval(result_obj->db_obj, result_obj->stmt_obj->stmt, i, &data);
+
+ if (mode & PHP_SQLITE3_NUM) {
+ add_index_zval(result, i, &data);
+ }
+
+ if (mode & PHP_SQLITE3_ASSOC) {
+ if (mode & PHP_SQLITE3_NUM) {
+ Z_TRY_ADDREF(data);
+ }
+ /* Note: we can't use the "add_new" variant here instead of "update" because
+ * when the same column name is encountered, the last result should be taken. */
+ zend_symtable_update(Z_ARR_P(result), result_obj->column_names[i], &data);
+ }
+ }
+}
+
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(sqlite3)
{