System Architecture (eg. arm, x86_64, ...): x86_64
Your problem description
__construct() and __destruct() are always considered to be public by PH7 Engine and this is wrong behaviour. There should be no exception in the matter of how access modifiers are working.
<?php
class Test {
private function __construct() {
echo "I live, again!\n";
self::__toString();
}
private function __destruct() {
echo "DONE\n";
}
private function __toString() {
echo "STRING\n";
}
}
Test::__destruct();
?>
Above example shows that when calling private __toString method from constructor it is working, but call from outside class is omitted, as expected. Anyway constructor is still called, despite it is private.
Expected results
// No output at all
Current results
I live, again!
STRING
<!--
1. Please speak English, this is the language all of us can speak and write.
2. Please take a moment to check that your issue doesn't already exist.
3. Please give all relevant information below for bug reports, because
incomplete details will be handled as an invalid report.
-->
# Aer Information
- Aer Version (or commit ref): e53cfb8ba0
- Operating System: Linux
- System Architecture (eg. arm, x86_64, ...): x86_64
# Your problem description
__construct() and __destruct() are always considered to be public by PH7 Engine and this is wrong behaviour. There should be no exception in the matter of how access modifiers are working.
<?php
class Test {
private function __construct() {
echo "I live, again!\n";
self::__toString();
}
private function __destruct() {
echo "DONE\n";
}
private function __toString() {
echo "STRING\n";
}
}
Test::__destruct();
?>
Above example shows that when calling private __toString method from constructor it is working, but call from outside class is omitted, as expected. Anyway constructor is still called, despite it is private.
# Expected results
// No output at all
# Current results
I live, again!
STRING
Aer Information
e53cfb8ba0
Your problem description
__construct() and __destruct() are always considered to be public by PH7 Engine and this is wrong behaviour. There should be no exception in the matter of how access modifiers are working.
Above example shows that when calling private __toString method from constructor it is working, but call from outside class is omitted, as expected. Anyway constructor is still called, despite it is private.
Expected results
// No output at all
Current results
I live, again!
STRING
This is fixed by
408ccc73c2
.