diff options
author | Joe Watkins <krakjoe@php.net> | 2019-04-06 00:55:58 +0200 |
---|---|---|
committer | Joe Watkins <krakjoe@php.net> | 2019-04-06 00:56:23 +0200 |
commit | 7f4a6b147825eb1d64598075362ba2b8e330216a (patch) | |
tree | f3eef5dd48d14ab2286ff6b77a189e41ca83c7c3 /ext/pdo | |
parent | 7d186bc416623345f21e80ac9838a4917c0d725f (diff) | |
parent | 0d5be6ce91701bcb47efe7a520189e035e38cd08 (diff) | |
download | php-git-7f4a6b147825eb1d64598075362ba2b8e330216a.tar.gz |
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
Fix bug #77849 Disable cloning of PDO handle/connection objects to avoid segfault
Diffstat (limited to 'ext/pdo')
-rw-r--r-- | ext/pdo/pdo_dbh.c | 1 | ||||
-rw-r--r-- | ext/pdo/tests/bug_77849.phpt | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 0e3f63fe3f..160be18387 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -1375,6 +1375,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 0000000000..6643f8c581 --- /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-- +<?php +if (!extension_loaded('pdo')) die('skip'); +$dir = getenv('REDIR_TEST_DIR'); +if (false == $dir) die('skip no driver'); +require_once $dir . 'pdo_test.inc'; +PDOTest::skip(); +?> +--FILE-- +<?php +if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/'); +require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; + +$db = PDOTest::factory(); +$db2 = clone $db; +?> +--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 |