From:             pha dot bridgman at gmail dot com
Operating system: Debian 7.0
PHP version:      5.5.0RC3
Package:          *General Issues
Bug Type:         Bug
Bug description:Protected, private __invoke() magic method raises Warning

Description:
------------
Definition of a non-public __invoke() magic-method in a class raises a
warning.

PHP 5.4 did not exhibit this behaviour, and the manual 
(http://www.php.net/manual/en/language.oop5.magic.php#object.invoke) does
not 
stipulate that the __invoke() magic-method must be public.

Test script:
---------------
<?php

class test
{
    public function __construct()
    {
        $this();
    }

    protected function __invoke()
    {
        echo PHP_VERSION;
    }
}

new test;

?>

Expected result:
----------------
peter@xenon:~/build$ php ~/test/invoke.php 
5.4.4-14

Actual result:
--------------
peter@xenon:~/build/php-5.5.0RC3$ sapi/cli/php ~/test/invoke.php 

Warning: The magic method __invoke() must have public visibility and cannot
be 
static in /home/peter/test/invoke.php on line 10
5.5.0RC3

-- 
Edit bug report at https://bugs.php.net/bug.php?id=65042&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65042&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65042&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65042&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65042&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65042&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65042&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65042&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65042&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65042&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65042&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65042&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65042&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65042&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65042&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65042&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65042&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65042&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65042&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65042&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65042&r=mysqlcfg

Reply via email to