mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00

Calling the constructor twice has no real world benefit. Block it to fix these two issues. We also clean up the constructor code a bit: - `in_ctor` implies `object` exist. - We surround the instance check with ZEND_DEBUG to avoid a runtime penalty. Closes GH-17900. Closes GH-8084. Closes GH-17908.
19 lines
405 B
PHP
19 lines
405 B
PHP
--TEST--
|
|
Incomplete initialization edge case where mysql->mysql is NULL
|
|
--EXTENSIONS--
|
|
mysqli
|
|
--FILE--
|
|
<?php
|
|
|
|
mysqli_report(MYSQLI_REPORT_OFF);
|
|
$mysqli = new mysqli();
|
|
@$mysqli->__construct('doesnotexist');
|
|
$mysqli->close();
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Fatal error: Uncaught Error: Cannot call constructor twice in %s:%d
|
|
Stack trace:
|
|
#0 %s(%d): mysqli->__construct('doesnotexist')
|
|
#1 {main}
|
|
thrown in %s on line %d
|