Skip to content

Commit 9b3929a

Browse files
committed
- Need to make PDO::__construct() final to prevent SEGV it isn't called 1st
1 parent d2018ef commit 9b3929a

File tree

11 files changed

+1
-20
lines changed

11 files changed

+1
-20
lines changed

ext/pdo/pdo_dbh.c

+1
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,7 @@ void pdo_dbh_init(TSRMLS_D)
10751075
INIT_CLASS_ENTRY(ce, "PDO", pdo_dbh_functions);
10761076
pdo_dbh_ce = zend_register_internal_class(&ce TSRMLS_CC);
10771077
pdo_dbh_ce->create_object = pdo_dbh_new;
1078+
pdo_dbh_ce->constructor->common.fn_flags |= ZEND_ACC_FINAL;
10781079

10791080
memcpy(&pdo_dbh_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
10801081
pdo_dbh_object_handlers.get_method = dbh_method_get;

ext/pdo/tests/pdo_023_def.inc

-6
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ class PDODatabaseX extends PDO
2121
{
2222
public $test1 = 1;
2323

24-
function __construct($connect)
25-
{
26-
echo __METHOD__ . "()\n";
27-
parent::__construct($connect);
28-
}
29-
3024
function __destruct()
3125
{
3226
echo __METHOD__ . "()\n";

ext/pdo/tests/pdo_026.inc

-6
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ class PDOStatementX extends PDOStatement
3030

3131
class PDODatabase extends PDO
3232
{
33-
function __construct($connect)
34-
{
35-
echo __METHOD__ . "()\n";
36-
parent::__construct($connect);
37-
}
38-
3933
function __destruct()
4034
{
4135
echo __METHOD__ . "()\n";

ext/pdo_mysql/tests/pdo_023.phpt

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ require_once($PDO_TESTS . 'pdo_023.inc');
2222
===DONE===
2323
<?php exit(0); ?>
2424
--EXPECTF--
25-
PDODatabaseX::__construct()
2625
int(1)
2726
int(2)
2827
object(PDODatabaseX)#%d (2) {

ext/pdo_mysql/tests/pdo_026.phpt

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ require_once($PDO_TESTS . 'pdo_026.inc');
1515
===DONE===
1616
<?php exit(0); ?>
1717
--EXPECT--
18-
PDODatabase::__construct()
1918
string(11) "PDODatabase"
2019
string(12) "PDOStatement"
2120
PDODatabase::query()

ext/pdo_pgsql/tests/pdo_023.phpt

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ require_once($PDO_TESTS . 'pdo_023.inc');
2222
===DONE===
2323
<?php exit(0); ?>
2424
--EXPECTF--
25-
PDODatabaseX::__construct()
2625
int(1)
2726
int(2)
2827
object(PDODatabaseX)#%d (2) {

ext/pdo_pgsql/tests/pdo_026.phpt

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ require_once($PDO_TESTS . 'pdo_026.inc');
1515
===DONE===
1616
<?php exit(0); ?>
1717
--EXPECT--
18-
PDODatabase::__construct()
1918
string(11) "PDODatabase"
2019
string(12) "PDOStatement"
2120
PDODatabase::query()

ext/pdo_sqlite/tests/pdo_023.phpt

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ require_once($PDO_TESTS . 'pdo_023.inc');
2222
===DONE===
2323
<?php exit(0); ?>
2424
--EXPECTF--
25-
PDODatabaseX::__construct()
2625
int(1)
2726
int(2)
2827
object(PDODatabaseX)#%d (2) {

ext/pdo_sqlite/tests/pdo_026.phpt

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ require_once($PDO_TESTS . 'pdo_026.inc');
1515
===DONE===
1616
<?php exit(0); ?>
1717
--EXPECT--
18-
PDODatabase::__construct()
1918
string(11) "PDODatabase"
2019
string(12) "PDOStatement"
2120
PDODatabase::query()

ext/sqlite/tests/pdo/pdo_023.phpt

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ require_once($PDO_TESTS . 'pdo_023.inc');
2222
===DONE===
2323
<?php exit(0); ?>
2424
--EXPECTF--
25-
PDODatabaseX::__construct()
2625
int(1)
2726
int(2)
2827
object(PDODatabaseX)#%d (2) {

ext/sqlite/tests/pdo/pdo_026.phpt

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ require_once($PDO_TESTS . 'pdo_026.inc');
1515
===DONE===
1616
<?php exit(0); ?>
1717
--EXPECT--
18-
PDODatabase::__construct()
1918
string(11) "PDODatabase"
2019
string(12) "PDOStatement"
2120
PDODatabase::query()

0 commit comments

Comments
 (0)