From: derick
Operating system: *
PHP version: 5.3SVN-2011-09-12 (SVN)
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Compiler creates (unused) compiled variables for self::$foo
Description:
------------
When having the following code:
<?php
class foo {
function bar() {
self::$bar = 42;
}
}
?>
The compiler generates compiled variable !0 for $bar, even though it's a
class variable:
derick@whisky:/tmp$ php -dvld.active=1 -r 'class foo { function bar() {
self::$bar = 42; } }'
Finding entry points
Branch analysis from position: 0
Return found
filename: Command line code
function name: (null)
number of ops: 2
compiled vars: none
line # * op fetch ext return
operands
---------------------------------------------------------------------------------
1 0 > NOP
1 > RETURN
null
branch: # 0; line: 1- 1; sop: 0; eop: 1
path #1: 0,
Class foo:
Function bar:
Finding entry points
Branch analysis from position: 0
Return found
filename: Command line code
function name: bar
number of ops: 4
compiled vars: !0 = $bar
line # * op fetch ext return
operands
---------------------------------------------------------------------------------
0 > ZEND_FETCH_CLASS 1
1 FETCH_W static member $1
'bar'
2 ASSIGN
$1, 42
3 > RETURN
null
branch: # 0; line: 1- 1; sop: 0; eop: 3
path #1: 0,
End of function bar.
End of class foo.
14:41 <@Derick> dmitry: I am wondering why self::$foo creates a compiled
variable. Any idea?
14:42 <@Derick> dmitry: it creates it, but it's never used
14:44 <@dmitry> I see. It's probably because od simple one-pass compiler
that first interpret $foo as local variable and only then as a class
variable :)
14:44 <@Derick> dmitry: any way we can fix that perhaps?
14:44 <@dmitry> Derick: could you please create a bug and assign it to me
14:44 <@Derick> yes, sure
--
Edit bug report at https://bugs.php.net/bug.php?id=55673&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55673&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55673&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=55673&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55673&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=55673&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55673&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=55673&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=55673&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=55673&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=55673&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=55673&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=55673&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=55673&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55673&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=55673&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55673&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=55673&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=55673&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=55673&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=55673&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=55673&r=mysqlcfg