Bug #51803 [Fbk->Bgs]: Interface implementation silently fails

From: Date: Thu, 13 May 2010 15:35:22 +0000
Subject: Bug #51803 [Fbk->Bgs]: Interface implementation silently fails
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-150435@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51803&edit=1

 ID:               51803
 Updated by:       dtajchreber@php.net
 Reported by:      kherge at me dot com
 Summary:          Interface implementation silently fails
-Status:           Feedback
+Status:           Bogus
 Type:             Bug
 Package:          Reproducible crash
 Operating System: Windows XP SP3
 PHP Version:      5.3.2

 New Comment:

Closing as bogus.


Previous Comments:
------------------------------------------------------------------------
[2010-05-12 22:43:48] dtajchreber@php.net

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.

------------------------------------------------------------------------
[2010-05-12 22:09:18] kherge at me dot com

Error reporting is currently set to 32767 (E_ALL | E_STRICT).

------------------------------------------------------------------------
[2010-05-12 22:05:32] dtajchreber@php.net

Do you have error reporting settings at the right level.. display
errors? I get a nice fatal error as expected..

david@beirut:~$ php test.php 
PHP Fatal error:  Access level to MyClass::_test() must be public (as in
class MyInterface) in /home/david/test.php on line 9

Fatal error: Access level to MyClass::_test() must be public (as in
class MyInterface) in /home/david/test.php on line 9
david@beirut:~$ echo $?
255

------------------------------------------------------------------------
[2010-05-12 21:55:55] 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


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51803&edit=1


Thread (5 messages)

« previous php.bugs (#150435) next »