1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.2' into PHP-8.3

This commit is contained in:
David Carlier
2024-06-29 15:52:28 +01:00
4 changed files with 36 additions and 1 deletions

4
NEWS
View File

@@ -15,6 +15,10 @@ PHP NEWS
- LibXML:
. Fixed bug GH-14563 (Build failure with libxml2 v2.13.0). (nielsdos)
- PDO:
. Fixed bug GH-14712 (Crash with PDORow access to null property).
(David Carlier)
- Phar:
. Fixed bug GH-14603 (null string from zip entry).
(David Carlier)

View File

@@ -3234,6 +3234,9 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
}
}
/* Pointer on property callback is required */
ZEND_ASSERT(zobj->handlers->get_property_ptr_ptr != NULL);
if (prop_op_type == IS_CONST) {
name = Z_STR_P(prop_ptr);
} else {

View File

@@ -2450,6 +2450,16 @@ static zend_function *row_get_ctor(zend_object *object)
return NULL;
}
static zval *pdo_row_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot)
{
ZEND_IGNORE_VALUE(object);
ZEND_IGNORE_VALUE(name);
ZEND_IGNORE_VALUE(type);
ZEND_IGNORE_VALUE(cache_slot);
return NULL;
}
void pdo_row_free_storage(zend_object *std)
{
pdo_row_t *row = (pdo_row_t *)std;
@@ -2490,7 +2500,7 @@ void pdo_stmt_init(void)
memcpy(&pdo_row_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
pdo_row_object_handlers.free_obj = pdo_row_free_storage;
pdo_row_object_handlers.clone_obj = NULL;
pdo_row_object_handlers.get_property_ptr_ptr = NULL;
pdo_row_object_handlers.get_property_ptr_ptr = pdo_row_get_property_ptr_ptr;
pdo_row_object_handlers.read_property = row_prop_read;
pdo_row_object_handlers.write_property = row_prop_write;
pdo_row_object_handlers.has_property = row_prop_exists;

View File

@@ -0,0 +1,18 @@
--TEST--
GH-14712: segfault on PDORow
--EXTENSIONS--
pdo_sqlite
--CREDITS--
YuanchengJiang
--FILE--
<?php
$db = new PDO('sqlite::memory:');
try {
$db->query("select 1 as queryStringxx")->fetch(PDO::FETCH_LAZY)->documentElement->firstChild->nextElementSibling->textContent = "é";
} catch (Error $e) {
echo $e->getMessage();
}
?>
--EXPECT--
Attempt to modify property "firstChild" on null