php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57492 bcompiler not extending good
Submitted: 2007-01-24 13:13 UTC Modified: 2009-11-30 07:29 UTC
From: dudubs at nana dot co dot il Assigned: val (profile)
Status: Closed Package: bcompiler (PECL)
PHP Version: 5.0.0 OS: WinXP Pro
Private report: No CVE-ID: None
 [2007-01-24 13:13 UTC] dudubs at nana dot co dot il
Description:
------------
I job with bcompiler for compile classes these extends class extends class

Reproduce code:
---------------
// file 'Classes.php'
class OutputClass {
	function WriteString($str) {
		echo $str;
	}
}
// file 'Code.php'
class FontClass extends OutputClass {
	function FontAndWrite($str) {
		parent::WriteString("<font color=red>$str</font>");
	}
}

class StyleClass extends FontClass {
	function StyleAndFont($str) {
		parent::FontAndWrite("<b>$str</b>");
	}
}

// file Compiling.php
include("Classes.php");
$h = fopen('Code.phb', 'w');
bcompiler_write_header($h);
bcompiler_write_file($h, 'Code.php');
bcompiler_write_footer($h);
fclose($h);

// file Loading.php
include("Classes.php");
bcompiler_load('Code.phb');

StyleClass::StyleAndFont('My Text');
!!!!! Fatal error: Call to undefined method OutputClass::fontandwrite() in ...


I first run Compiling.php and after Loading.php

Expected result:
----------------
!!!!! Fatal error: Call to undefined method OutputClass::fontandwrite() in ...


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-18 02:20 UTC] danhen at web dot de
This only happens when there is a class which extends another  in the same source file. Following 'one class per file' paradigm could be a workaround.
 [2009-11-23 12:56 UTC] val@php.net
This bug has been fixed in CVS.

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.

The current CVS version (0.9.1) doesn't have this bug. Tested with PHP 5.2.11-dev and 5.3.1-dev.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 01 23:03:34 2021 UTC