[php-maint] Bug#406264: __autoload() doesn't work in interactive mode

Rafał Wrzeszcz wrzasq at gmail.com
Wed Jan 10 00:12:15 CET 2007


Package: php5-cli
Version: 5.2.0-8

__autoload() function doesn't work in php-cli (it does work correctly
in apache2 module). to make it clear:

$ diff /etc/php5/cli/php.ini /etc/php5/apache2/php.ini

shows now differences. example code:

$ php -a
Interactive mode enabled

<?php
function __autoload($class)
{
echo $class;// should output class name
echo 'lol';// should at least print it if it comes into function body
require($class . '.php');// should break script because of missing file
}
// but it will just cause fatal error about missing class :|
$foo = new Bar(); ?>

Fatal error: Class 'Bar' not found in /home/wrzasq/public_html/- on line 9

However when i save that very same code in file it works as it should:

$ php test.php
Barlol
Warning: require(Bar.php): failed to open stream(...)

-- 
//Wrzasq




More information about the pkg-php-maint mailing list