- Fixed bug #44159 (Crash: $pdo->setAttribute(PDO::STATEMENT_ATTR_CLASS, NULL)).
(Felipe)
- Fixed bug #44152 (Possible crash with syslog logging on ZTS builds). (Ilia)
+- Fixed bug #44141 (private parent constructor callable through static
+ function). (Dmitry)
- Fixed bug #44069 (Huge memory usage with concatenation using . instead of
.=). (Dmitry)
- Fixed bug #44046 (crash inside array_slice() function with an invalid
--- /dev/null
+--TEST--
+Bug #44141 (private parent constructor callable through static function)
+--FILE--
+<?php
+class X
+{
+ public $x;
+ private function __construct($x)
+ {
+ $this->x = $x;
+ }
+}
+
+class Y extends X
+{
+ static public function cheat($x)
+ {
+ return new Y($x);
+ }
+}
+
+$y = Y::cheat(5);
+echo $y->x, PHP_EOL;
+--EXPECTF--
+Fatal error: Call to private X::__construct() from context 'Y' in %sbug44141.php on line 15
} else if (constructor->op_array.fn_flags & ZEND_ACC_PRIVATE) {
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
- if (Z_OBJ_HANDLER_P(object, get_class_entry)(object TSRMLS_CC) != EG(scope)) {
+ if (constructor->common.scope != EG(scope)) {
if (EG(scope)) {
zend_error(E_ERROR, "Call to private %s::%s() from context '%s'", constructor->common.scope->name, constructor->common.function_name, EG(scope)->name);
} else {