Bug #2667: readfile() fails with Invalid URL specified

From: Date: Fri, 05 Nov 1999 01:34:24 +0000
Subject: Bug #2667: readfile() fails with Invalid URL specified
Groups: php.dev 
Request: Send a blank email to php-dev+get-12122@lists.php.net to get a copy of this message
From: simon.greaves@usp.ac.fj Operating system: Digital UNIX 4.0D PHP version: 3.0.12 PHP Bug Type: Misbehaving function Bug description: readfile() fails with Invalid URL specified Example script: <?php readfile("http://www.usp.ac.fj/"); ?> the above URL is valid, I got the same error with _any_ URL. I tried exactly the same from a RH6.0 Linux box running the same version of PHP and it works perfectly. Seems to happen regardless of the modules compiled in, even if I simply type './configure'. I've compiled with both gcc 2.8.1 and DEC's C compiler (DEC C V5.6-075, using CFLAGS="-g -std"). Using a CGI version configured using 'CFLAGS=-g ./configure --enable-debug=yes', I tried running under gdb. The problem seems to be related to the use of a RE whilst parsing the HTTP username, password and port no from the URL (url.c:url_parse()). The RE compiles ok, but during the regexec() call, a function 'smatcher()' is called which calls 'fast()" which fails, returning NULL, causing url_parse to fail with the 'Invalid URL' message. Using the same environment on Linux, the same regexec() call calls 'lmatcher()' instead which then calls 'fast()' which succeeds. Unfortunately the RE code is fairly 'hairy'. I've just tried it with php-3.0.13-dev fresh today from cvs and I get the same problem. Dunno if it's related, but I have noticed a few other differences between the DU and Linux versions. DU tends to be a bit more pedantic, eg it will often complain about undefined variables when Linux does not. Also, Linux PHP will accept RE's in the pcre functions if they are surrounded by double or single quotes whereas DU PHP will often give the wrong results, or errors if the RE's are not in single quotes. I renamed php3.ini and the problem still exists, so I didn't bother including it. Could this be a 64 bit issue? Is this the latest version of the Henry Spencer RE libraries? Anything I can do to help, please let me know. Thanks, Simon

« previous php.dev (#12122) next »