From:             [EMAIL PROTECTED]
Operating system: Linux Debian Potato 2.2
PHP version:      4.0.4pl1
PHP Bug Type:     Unknown/Other Function
Bug description:  Require() function : filename string not terminated correctly 
internally

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.





-- 
Edit Bug report at: http://bugs.php.net/?id=8921&edit=1



-- 
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]

Reply via email to