ID: 8921
User Update by: [EMAIL PROTECTED]
Status: Open
Bug Type: Unknown/Other Function
Description: Require() function : filename string not terminated correctly internally
Work-around.
-----------
I've since found that the problem only manifests itself when variables are used as
parameters to Require().
eg:
$filename = "test.html";
require($filename);
If a string constant is used as a parameter the function performs correctly.
eg:
require("test.html");
Consequently I was able to solve my problem by using PHPs "evaluate variable within
string" trick -
eg:
$filename = "test.html";
require("$filename");
Previous Comments:
---------------------------------------------------------------------------
[2001-01-25 19:18:31] [EMAIL PROTECTED]
Hi,
I've found what appears to be a reproducable bug with random effects.
When I pass a seemingly perfect filename string to the Require() function it comes
back (2 times out of 3) with extra characters at the end, causing the require function
to fail to find the file. The characters are illustrated below, and many seem to be
non-alphabetic. It looks like a C string buffer overflow problem (ie: the length of
the string has been enlarged by a random amount between about 2 and 5 characters, and
it's picking up additional characters directly out of memory).
This is the code that is executing :
if("" == $inc_filename) {
print("You have to enter a filename first !");
}
else // NON-Blank include filename
{
print("Filename = ".$inc_filename); // <<<<< Note : here the filename displays
fine
require( $inc_filename ); // <<<<< Note : here it is corrupted
}
These are the output lines I got (note the crap at the end of the filename in the
error message) :
Filename = inc/britz/britzspg.inc
Fatal error: Failed opening required 'inc/britz/britzspg.inc���'
(include_path='.:/usr/local/lib/php') in
/home/ekiwi/public_html/layout.php on line 199
Filename = inc/britz/britzspg.inc
Fatal error: Failed opening required 'inc/britz/britzspg.inc)y'
(include_path='.:/usr/local/lib/php') in
/home/ekiwi/public_html/layout.php
on line 199
THEN IT WAS OK TWICE, followed by
Filename = inc/britz/britzspg.inc
Fatal error: Failed opening required 'inc/britz/britzspg.inc'A'
(include_path='.:/usr/local/lib/php') in
/home/ekiwi/public_html/layout.php
on line 199
Filename = inc/britz/britzspg.inc
Fatal error: Failed opening required 'inc/britz/britzspg.inc)�'
(include_path='.:/usr/local/lib/php') in
/home/ekiwi/public_html/layout.php
on line 199
To see this in action see :
http://chips.cwa.co.nz:8080/display.php?FEATURE_ID=13
Be aware that it works perfectly about a third of the time, so keep pressing the
refresh button on your browser until it throws the error.
We're running Linux kernal 2.2.18
Our PHP config details are available at :
http://chips.cwa.co.nz/~ian/php.status.php
Hope this helps,
Simon Mahony,
Technical Director,
CWA New Media,
New Zealand.
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8921
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]