|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-05-12 21:55 UTC] kherge at me dot com
Description:
------------
Running the test script, PHP silently exists with the error code 255. If you
remove the protected access type from the _test() function in the MyClass class,
the script executes normally.
Test script:
---------------
<?php
interface MyInterface
{
function _test ( );
function test ( );
}
class MyClass implements MyInterface
{
protected function _test ( )
{
echo 'My _test() function', "\n";
}
public function test ( )
{
self::_test( );
}
}
MyClass::test( );
Expected result:
----------------
Output: "My _test() function"
Actual result:
--------------
PHP exits with %ERRORLEVEL% = 255
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 20:00:01 2025 UTC |
Ditto on reproducing it. C:\Documents and Settings\David\Desktop\php-5.3.2-Win32-VC6-x86>php ..\test.php Fatal error: Access level to MyClass::_test() must be public (as in class MyInte rface) in C:\Documents and Settings\David\Desktop\test.php on line 9 C:\Documents and Settings\David\Desktop\php-5.3.2-Win32-VC6-x86>echo %ERRORLEVEL% 255 I think it's a configuration issue on your end. Check your error log/display error settings. Your class has to implement the method the way that the interface describes it. Your interface defaults to public for _test() and test() but you alter that.. a simpler test case: class A implements Iterator { private function next() { } } should yield the same error as in your example.