- Fixed bug #38168 (Crash in pdo_pgsql on missing bound parameters). (Ilia)
- Fixed bug #38132 (ReflectionClass::getStaticProperties() retains \0 in key
names). (Ilia)
+- Fixed bug #38064 (ignored constructor visibility). (Marcus)
- Fixed bug #38047 ("file" and "line" sometimes not set in backtrace from
inside error handler). (Dmitry)
- Fixed bug #37846 (wordwrap() wraps incorrectly). (ddk at krasn dot ru, Tony)
if(!ce->constructor) {
zend_error_noreturn(E_ERROR, "Can not call constructor");
}
+ if (Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ zend_error(E_COMPILE_ERROR, "Cannot call private %s::__constrcut()", ce->name);
+ }
EX(fbc) = ce->constructor;
}
if(!ce->constructor) {
zend_error_noreturn(E_ERROR, "Can not call constructor");
}
+ if (Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE) {
+ zend_error(E_COMPILE_ERROR, "Cannot call private %s::__constrcut()", ce->name);
+ }
EX(fbc) = ce->constructor;
}
if(!ce->constructor) {
zend_error_noreturn(E_ERROR, "Can not call constructor");
}
+ if (Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE) {
+ zend_error(E_COMPILE_ERROR, "Cannot call private %s::__constrcut()", ce->name);
+ }
EX(fbc) = ce->constructor;
}
if(!ce->constructor) {
zend_error_noreturn(E_ERROR, "Can not call constructor");
}
+ if (Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE) {
+ zend_error(E_COMPILE_ERROR, "Cannot call private %s::__constrcut()", ce->name);
+ }
EX(fbc) = ce->constructor;
}
if(!ce->constructor) {
zend_error_noreturn(E_ERROR, "Can not call constructor");
}
+ if (Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE) {
+ zend_error(E_COMPILE_ERROR, "Cannot call private %s::__constrcut()", ce->name);
+ }
EX(fbc) = ce->constructor;
}
if(!ce->constructor) {
zend_error_noreturn(E_ERROR, "Can not call constructor");
}
+ if (Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE) {
+ zend_error(E_COMPILE_ERROR, "Cannot call private %s::__constrcut()", ce->name);
+ }
EX(fbc) = ce->constructor;
}
--- /dev/null
+--TEST--
+ZE2 A private constructor cannot be called
+--FILE--
+<?php
+
+class Test
+{
+ function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ }
+}
+
+class Derived extends Test
+{
+ function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ parent::__construct();
+ }
+
+ static function f()
+ {
+ new Derived;
+ }
+}
+
+Derived::f();
+
+class TestPriv
+{
+ private function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ static function f()
+ {
+ new TestPriv;
+ }
+}
+
+TestPriv::f();
+
+class DerivedPriv extends TestPriv
+{
+ function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ parent::__construct();
+ }
+
+ static function f()
+ {
+ new DerivedPriv;
+ }
+}
+
+DerivedPriv::f();
+
+?>
+===DONE===
+--EXPECTF--
+Derived::__construct()
+Test::__construct()
+TestPriv::__construct()
+DerivedPriv::__construct()
+
+Fatal error: Cannot call private TestPriv::__constrcut() in %sctor_visibility.php on line %d