Edit report at https://bugs.php.net/bug.php?id=61025&edit=1

 ID:                 61025
 Updated by:         larue...@php.net
 Reported by:        jpa...@php.net
 Summary:            __invoke() visibility not honored
-Status:             Closed
+Status:             Open
 Type:               Bug
 Package:            Class/Object related
 Operating System:   *nix
 PHP Version:        5.3.10
 Block user comment: N
 Private report:     N

 New Comment:

jpauli, I commit the patch I said last night, if you want to marco it, please 
do 
it.

since I need this at trunk before I can improve the __Invoke implemention.

thanks


Previous Comments:
------------------------------------------------------------------------
[2013-03-08 02:36:36] larue...@php.net

Automatic comment on behalf of laruence
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=01049ca7aed40a5f1081d0303c69a40dae0f982e
Log: Fixed bug #61025 (__invoke() visibility not honored)

------------------------------------------------------------------------
[2013-03-08 02:34:24] larue...@php.net

Automatic comment on behalf of laruence
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=01049ca7aed40a5f1081d0303c69a40dae0f982e
Log: Fixed bug #61025 (__invoke() visibility not honored)

------------------------------------------------------------------------
[2013-03-07 14:27:32] larue...@php.net

the __toString is more likely:

<?php
class A {
    private function __toString() {
        echo __CLASS__;
    }
}

$a = new A;
echo $a;
echo $a->__toString();
?>

result:

PHP Warning:  The magic method __toString() must have public visibility and 
cannot be static in /tmp/1.php on line 3
A
PHP Fatal error:  Call to private method A::__toString() from context '' in 
/tmp/1.php on line 10


so, I don't see much problem here, I think we only need a warning is okey. 
since 
it's a magic method, not a normal method.

------------------------------------------------------------------------
[2013-03-07 03:20:30] larue...@php.net

I don't think this need to be fixed in this way,  like __call:
```php
<?php

class Bar {
    private function __call($name, $value) {
        return __CLASS__;
    }
}

$b = new Bar;
$b->__call("name", NULL);
```

works well, but with an warning:
```
Warning: The magic method __call() must have public visibility and cannot be 
static 
```

I am not sure whether this is a bug, or just need document.

------------------------------------------------------------------------
[2013-03-06 16:58:22] re...@php.net

Hi, I made a patch again 5.5. how about fix it in 5.5?

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=61025


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

Reply via email to