Bug #51176 [Com]: Static calling in non-static method behaves like $this->

2011-07-29 Thread steve at twitpic dot com
Edit report at https://bugs.php.net/bug.php?id=51176&edit=1

 ID: 51176
 Comment by: steve at twitpic dot com
 Reported by:majkl578 at gmail dot com
 Summary:Static calling in non-static method behaves like
 $this->
 Status: Bogus
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   Irrelevant
 PHP Version:5.3.2RC3
 Assigned To:felipe
 Block user comment: N
 Private report: N

 New Comment:

This is ridiculous- this bug is not bogus, it's completely legitimate, 
unexpected 
behavior, and totally non documented. As a reasonable programmer, one expects a 
static call to behave the same inside of a class as well as outside of a class.

How can we bring the "desired" behavior up for vote? I think that it's insane 
to 
not fix it.


Previous Comments:

[2011-05-31 02:06:16] david71rj at gmail dot com

Sorry by realive this topic, but I really think that it is a bug.

If I want call "bar" with context, the correct mean is $this->bar(). Else, the 
"static" sounds for me like "call without context". I'm wrong?

Please, read this topic to understand what I'm saying: 
http://stackoverflow.com/questions/6181603/php-is-handling-incorrectly-my-static-
call


[2010-11-03 12:03:17] majkl578 at gmail dot com

You cannot call foo::start(), because the method is non-static and therefore it 
does not make sense.

Also, self, static and class name are used to call methods statically, not in a 
object context.
For calling method bar in object context, I think '$this->' should be used 
instead.

Obviously parent should not behave this way and respect context, but I think it 
should be the only exception (as shown in #52713).


[2010-11-03 02:45:23] fel...@php.net

Hello, I've reverted the wrong changes introduced by trying to fix the issue 
reported, but actually there is no bug at all. self::bar(), static::bar() and 
foo::bar() are being called in an object context, hence the __call() is called.

I.e.
$foo->start(); // invoke the __call method
foo::start(); // invoke the __callStatic method

Thanks.


[2010-11-03 02:35:28] fel...@php.net

Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=305043
Log: - Reverted fix for bug #51176


[2010-03-04 14:27:55] fel...@php.net

Hello!
This isn't my decision, but the release manager.

Thanks.




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=51176


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


Bug #55311 [Bgs]: Static methods invoke __call when called from within class

2011-07-29 Thread steve at twitpic dot com
Edit report at https://bugs.php.net/bug.php?id=55311&edit=1

 ID: 55311
 User updated by:steve at twitpic dot com
 Reported by:steve at twitpic dot com
 Summary:Static methods invoke __call when called from within
 class
 Status: Bogus
 Type:   Bug
 Package:*General Issues
 Operating System:   Ubuntu 11.04
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

This is ridiculous- this bug is not bogus, it's completely legitimate, 
unexpected 
behavior, and totally non documented. As a reasonable programmer, one expects a 
static call to behave the same inside of a class as well as outside of a class.

How can we bring the "desired" behavior up for vote? I think that it's insane 
to 
not fix it.


Previous Comments:

[2011-07-29 08:33:24] cataphr...@php.net

Closing as bogus, see 
http://www.mail-archive.com/internals@lists.php.net/msg52338.html


[2011-07-29 03:31:19] larue...@php.net

The following patch has been added/updated:

Patch Name: bug55311.phpt
Revision:   1311910279
URL:
https://bugs.php.net/patch-display.php?bug=55311&patch=bug55311.phpt&revision=1311910279


[2011-07-29 03:29:37] larue...@php.net

The following patch has been added/updated:

Patch Name: bug55311.patch
Revision:   1311910177
URL:
https://bugs.php.net/patch-display.php?bug=55311&patch=bug55311.patch&revision=1311910177


[2011-07-29 03:28:51] larue...@php.net

looks like for some reason someone change the if/else sequence make this bug, 
but I am not sure why he do this.

------------
[2011-07-28 21:04:42] steve at twitpic dot com

Description:

When calling a non-existant static method within an objects method, php invokes 
_call instead of 
__callStatic. When calling the same non-existant static method outside of the 
object, php correctly 
invokes __callStatic.

It appears that this broke in php5.3.5 and is still broken in 5.3.6. It works 
as 
expected in 5.3.3, 
however.

Test script:
---
class Test {

  public function __call($method, $args) {
   echo "call\n";
  }

  public static function __callStatic($method, $args) {
   echo "callStatic\n";
  }

  public function testing() {

Test::fakeFunction();

  }

}

$t = new Test;
$t->testing();
Test::fakeFunction();

Expected result:

// expected output
callStatic
callStatic

Actual result:
--
// output
call
callStatic






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


[PHP-BUG] Bug #55311 [NEW]: Static methods invoke __call when called from within class

2011-07-28 Thread steve at twitpic dot com
From: 
Operating system: Ubuntu 11.04
PHP version:  5.3.6
Package:  *General Issues
Bug Type: Bug
Bug description:Static methods invoke __call when called from within class

Description:

When calling a non-existant static method within an objects method, php
invokes 
_call instead of 
__callStatic. When calling the same non-existant static method outside of
the 
object, php correctly 
invokes __callStatic.

It appears that this broke in php5.3.5 and is still broken in 5.3.6. It
works as 
expected in 5.3.3, 
however.

Test script:
---
class Test {

  public function __call($method, $args) {
   echo "call\n";
  }

  public static function __callStatic($method, $args) {
   echo "callStatic\n";
  }

  public function testing() {

Test::fakeFunction();

  }

}

$t = new Test;
$t->testing();
Test::fakeFunction();

Expected result:

// expected output
callStatic
callStatic

Actual result:
--
// output
call
callStatic

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