diff --git a/NEWS b/NEWS index 5651067fa93..78c25894391 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,10 @@ PHP NEWS - PCRE: . Fixed bug #77827 (preg_match does not ignore \r in regex flags). (requinix, cmb) + +- PDO: + . Fixed bug #77849 (Disable cloning of PDO handle/connection objects). + (camporter) - phpdbg: . Fixed bug #76801 (too many open files). (alekitto) diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 2c92c50edf0..36bb2a17aca 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -1390,6 +1390,7 @@ void pdo_dbh_init(void) pdo_dbh_object_handlers.offset = XtOffsetOf(pdo_dbh_object_t, std); pdo_dbh_object_handlers.dtor_obj = zend_objects_destroy_object; pdo_dbh_object_handlers.free_obj = pdo_dbh_free_storage; + pdo_dbh_object_handlers.clone_obj = NULL; pdo_dbh_object_handlers.get_method = dbh_method_get; pdo_dbh_object_handlers.compare_objects = dbh_compare; pdo_dbh_object_handlers.get_gc = dbh_get_gc; diff --git a/ext/pdo/tests/bug_77849.phpt b/ext/pdo/tests/bug_77849.phpt new file mode 100644 index 00000000000..6643f8c5813 --- /dev/null +++ b/ext/pdo/tests/bug_77849.phpt @@ -0,0 +1,23 @@ +--TEST-- +PDO Common: Bug #77849 (Unexpected segfault attempting to use cloned PDO object) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Uncaught Error: Trying to clone an uncloneable object of class PDO in %s +Stack trace: +#0 {main} + thrown in %s on line %d