From:             michiel at parse dot nl
Operating system: slack 9
PHP version:      5.0.0b1 (beta1)
PHP Bug Type:     PCRE related
Bug description:  preg_replace problem: Using $this when not in object context

Description:
------------
See reproduce code, error: Fatal error: Using $this when not in object
context in /home/michiel/public_html/test.php(11) : regexp code on line 1

Reproduce code:
---------------
<?
class a
{
        var $a = array();

        function a()
        {
                $output = preg_replace(
                                '!\{\s*([a-z0-9_]+)\s*\}!sie',
                                "(in_array('\\1',\$this->a) ? '\'.\$p[\'\\1\'].\'' :
'\'.\$r[\'\\1\'].\'')",
                                "{a} b {c}");
        }
}
new a();
?>

Expected result:
----------------
Worked just fine in PHP4


-- 
Edit bug report at http://bugs.php.net/?id=24403&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=24403&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=24403&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24403&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24403&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24403&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24403&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24403&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24403&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24403&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24403&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24403&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24403&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24403&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24403&r=gnused

Reply via email to