php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58981 Class support spotty
Submitted: 2009-12-06 18:57 UTC Modified: 2011-09-05 07:39 UTC
From: msteele at beringmedia dot com Assigned: val (profile)
Status: Closed Package: bcompiler (PECL)
PHP Version: 5.2.11 OS: Linux
Private report: No CVE-ID: None
 [2009-12-06 18:57 UTC] msteele at beringmedia dot com
Description:
------------
Extending built-in classes or implementing classes causes segfault when compiled with bcompiler_compile.php


Reproduce code:
---------------
Extend issue:
<?php

class Blargh extends Exception {
  public function bla() {
    echo "hello\bn";
  }
}
?>
Interface issue:
<?php

class Blargh implements Countable {

  public function count() {}
}
?>

Interface issue:
<?php

interface Blargh {
  public function blah();
}

class Boo implements Blargh {
  public function blah() {}
}
?>

Expected result:
----------------
All test cases should produce working bytecode

Actual result:
--------------
The compiler script does segmentation fault

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-07 15:49 UTC] val@php.net
Bug doesn't reproduce on my system. Please see my e-mail with details and check files I sent you.
 [2011-04-08 04:31 UTC] mshonich at yandex dot ru
bug reproduced on FreeBSD 8.1, PHP 5.3.6, bcompiler 0.9.3

# cat comp.php
<?php
function compileFile($input, $output)
{
        $f = fopen($output, 'w');
        bcompiler_write_header($f);
        bcompiler_write_file($f, $input);
        bcompiler_write_footer($f);
        fclose($f);
}
compileFile($argv[1], $argv[2]);
?>

# cat fuck.php
<?php

class QQQ
{
    function __construct()
    {
        $this->i();
    }
    function i()
    {}
};

class QQQ1 extends QQQ
{
    function q($addrs, $listenport)
    {
        if (is_string($addrs)) {
            echo('.');
            $addrs = explode(',', $addrs);
            echo('?');
        }

        echo('!');
    }
};

class QQQ2 extends QQQ1
{
    function i()
    {
        $this->q('test', 'whatever');
    }
};

$m = new QQQ2;
?>

# php fuck.php
.?!
# php comp.php fuck.php fuck.bin
# php fuck.bin
.?Segmentation fault (core dumped)
 [2011-04-09 00:42 UTC] maxzerker at hotmail dot com
This bug also occurs on php 5.2.1 and 5.3.6 with bcompiler 0.9.3

same code that worked file on php 5.1.6 with bcompiler 0.8.1

i would be glad to donate money to eliminate this bug
if you have paypal account please email to me.
 [2011-06-12 11:59 UTC] zhihong dot chen dot cn at gmail dot com
fuck.php still cause segfault of bcompiler.
 [2011-09-02 03:21 UTC] zhihong dot chen dot cn at gmail dot com
This bug still could be reproduced for 5.3.6/5.3.8 with 
bcompiler 1.0.2 for fuck.php in comments.
 [2011-09-05 06:29 UTC] val@php.net
Please try the latest SVN revision, which should have this one fixed. If it works fine, please let me know and I'll close this bug.
 [2011-09-05 07:38 UTC] zhihong dot chen dot cn at gmail dot com
Many thanks for val.
Bug is confirmed fixed. 
Fuck.php can not break php anymore.
 [2011-09-05 07:39 UTC] val@php.net
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 12 11:01:28 2024 UTC