From: jhorner@jhorner.com
Operating system: Linux
PHP version: 4.2.1
PHP Bug Type: Feature/Change Request
Bug description: Changing auto_append_file option within script is useless
According to the documentation of ini_set(), it is possible to change the
auto_append_file option anywhere within a
script. It would be nice to dynamically set the auto_append_file
option from within a php script and have it executed when
the primary script has completed. Although it's possible
to change it using ini_set(), the scripting engine has already determined
which prepend and append file to use even
before calling the primary script.
Line 1381 of PHP_SOURCE_DIR/main/main.c confirms this:
retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 3,
prepend_file_p, primary_file, append_file_p) == SUCCESS);
Here's some pseudo-code to possibly fix this:
retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 2,
prepend_file_p, primary_file) == SUCCESS);
if (PG(auto_append_file) && PG(auto_append_file)[0]) {
append_file.filename = PG(auto_append_file);
append_file.opened_path = NULL;
append_file.free_filename = 0;
append_file.type = ZEND_HANDLE_FILENAME;
append_file_p = &append_file;
retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 1,
append_file_p) == SUCCESS);
}
--
Edit bug report at http://bugs.php.net/?id=18283&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18283&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18283&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18283&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18283&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18283&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18283&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18283&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18283&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18283&r=globals