/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tests/classes/protected_001b.phpt
28 строк
543 B
Máté Kocsis
Review the usage of apostrophes in error messages
10 июл 2020, 22:05
Не верифицирован
10 июл 2020, 22:05
d30cd7d
Код
Авторство
О чём код?
--TEST-- ZE2 A protected method can only be called inside the class --FILE-- <?php class pass { protected function fail() { echo "Call fail()\n"; } public function good() { $this->fail(); } } $t = new pass(); $t->good(); $t->fail();// must fail because we are calling from outside of class pass echo "Done\n"; // shouldn't be displayed ?> --EXPECTF-- Call fail() Fatal error: Uncaught Error: Call to protected method pass::fail() from global scope in %s:%d Stack trace: #0 {main} thrown in %s on line %d