Bug #66739 [NEW]: strange behavior
From: temenb at gmail dot com
Operating system: ubuntu
PHP version: 5.4Git-2014-02-18 (Git)
Package: Scripting Engine problem
Bug Type: Bug
Bug description:strange behavior
Description:
------------
static::foo() in the method A::a1() in some cases calls method B::foo()
It is not late static bindings, B doesn't extend A
Test script:
---------------
<?php
class A
{
public function a1()
{
static::foo();
}
static public function a2()
{
static::foo();
}
static public function foo()
{
echo 'A';
}
}
class B
{
public function b1()
{
A::a1();
A::a2();
}
static public function b2()
{
A::a1();
A::a2();
}
static public function foo()
{
echo 'B';
}
}
B::b1();//A
B::b2();//A
$b = new B;
$b->b1();//B
$b->b2();//A
--
Edit bug report at https://bugs.php.net/bug.php?id=66739&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66739&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66739&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66739&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66739&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66739&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66739&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66739&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66739&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66739&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66739&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66739&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66739&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66739&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66739&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66739&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66739&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66739&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66739&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66739&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66739&r=mysqlcfg
Thread (7 messages)
- temenb at gmail dot com