when running foo.php the __autoload function in base.php gets confused (see second example of
foo.ctl.php marked as "this DOESN'T WORK")
when I disable eaccelerator in /etc/php.ini both versions of foo.ctl.php work fine.
## php/appache configuration ##
PHP 5.2.5 (cli) (built: Feb 26 2008 00:50:14)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
Server version: Apache/2.2.8 (Unix)
Server built: Feb 25 2008 00:11:06
## php/appache configuration ##
code follows:
<?php
# abstr.cls.php
# dummy class
abstract class abstr {
protected $attr=array();
public function __get($v){return $this->attr[$v];}
abstract public function do_search($options=NULL);
}
?>
--------------------------------------------------------
<?php
# foo.php
include_once 'base.php';
include_once 'foo.ctl.php';
foreach ($bo->foo as $v) print "--".$v."<br />\n";
?>
--------------------------------------------------------
<?php
# base.php
function __autoload($class) {
$absolute_class_path=dirname(__FILE__)."/$class".'.cls.php';
print "autoloading class: '$class'<br />\n";
print "absolute class path: '$absolute_class_path'<br />\n";
require_once $absolute_class_path;
print "OK<br />\n";
}
?>
--------------------------------------------------------
<?php
# foo.ctl.php
# this works
class BO extends abstr {
public function do_search($options=NULL) {
$this->attr[['foo']]=array('bar','foo','foobar');
}
}
$bo = new BO();
$bo->do_search();
?>
--------------------------------------------------------
<?php
# foo.ctl.php
# this DOESN'T WORK
$bo = new BO();
$bo->do_search();
class BO extends abstr {
public function do_search($options=NULL) {
$this->attr['foo']=array('bar','foo','foobar');
}
}
?>
## BROWSER OUTPUT START ##
autoloading class: 'BO'
absolute class path: '/var/www/iwww/test/BO.cls.php'
Warning: require_once(/var/www/iwww/test/BO.cls.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/iwww/test/base.php on line 7
Fatal error: require_once() [function.require]: Failed opening required '/var/www/iwww/test/BO.cls.php' (include_path='.:/usr/share/pear') in /var/www/iwww/test/base.php on line 7
## BROWSER OUTPUT END ##
Thanx