php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14084 Recursive call of index.php/test=2
Submitted: 2001-11-16 10:34 UTC Modified: 2001-11-16 10:52 UTC
From: francis at groupeiweb dot com Assigned:
Status: Not a bug Package: Apache related
PHP Version: 4.0.6 OS: Redhat 7.1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: francis at groupeiweb dot com
New email:
PHP Version: OS:

 

 [2001-11-16 10:34 UTC] francis at groupeiweb dot com
When we open this url : http://localhost/index.php/test=2

Yep index.php/test=2 not index.php?test=2

Apache open the page index.php one time for every broke link he find in the index.php page.  Example :

<?PHP
  // Simple PHP test page
?>
<HTML>
<TITLE>Simple PHP test page</TITLE>
<BODY>
  <P>Simple PHP test page</P>
  <IMG SRC="image1.gif"><br>
  <IMG SRC="image2.gif"><br>
  <IMG SRC="image3.gif">
</BODY>
</HTML>
<?

  // Keep a log

  /* Log table

CREATE TABLE `simple_log` (
  `sl_time` BIGINT UNSIGNED NOT NULL,
  `sl_url`  VARCHAR(255) NOT NULL
) comment = 'Utilise pour tester le bugs de anikin index/id=2'

  */

  // Current time
  $now = time();

  // Database configuration
  $host     = 'localhost';
  $username = '';
  $password = '';
  $database = '';

  // Open a database connection
  $linkd = mysql_connect($host, $username, $password);
  mysql_select_db($database, $linkd);

  // Insert a log
  $sql = "INSERT INTO simple_log (sl_time, sl_url) VALUES ('$now', '$REQUEST_URI')";
  mysql_query($sql, $linkd);

  // Close the database connection
  mysql_close($linkd);
?>

Images are broke because the path http://localhost/index.php/image1.gif does not exist.  In this case, Apache open 4 times the page index.php.

Here the listing of the log table :

sl_time    sl_url
1005924055 /index.php/test=2
1005924055 /index.php/image1.gif
1005924055 /index.php/image2.gif
1005924055 /index.php/image3.gif

We have the same problem on 3 differents servers.

Compilation script :

'./configure' '--with-mysql=/virtual/mysql' '--enable-bcmath' '--with-gd' '--with-dbase' '--with-curl' '--with-xml' '--with-pgsql=/virtual/postgres/' '--with-imap' '--with-apxs=/virtual/apachedev/bin/apxs'

Apache version :

1.3.20

Php version :

4.0.6 and 4.2.0-dev

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-16 10:38 UTC] derick@php.net
erm, ofcourse this doesn't work. / is not a valid URL separator.
Ask for support questions on the php-general@lists.php.net mailinglist.
Not a PHP bug > Bogus.
 [2001-11-16 10:46 UTC] hholzgra@php.net
still not a php problem, *and* intended behaviour

if only part of a URL path exists on the server
and points to a file (not directory) 
the web server will call that file and pass
the rest of the URL as $PATH_INFO

so /index.php/test=2 calls /index.php with $PATH_INFO="test=2"

for <IMG SRC="image1.gif"> the browser will 
strip of what it thinks to be the filename
(as it does not know anything about the server
file system), that is anything after the last 
'/', ending up with "/index.php/", and adds
the relative path from the src attribute
so requesting "/index.php/image1.gif"
which is again treated by the webserver as
a request to /index.php with $PATH_INFO
="image.gif" this time



 [2001-11-16 10:52 UTC] francis at groupeiweb dot com
Thanks you for your reponse.  I will post a question on 
php-general@lists.php.net for a solution to block that.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Sep 16 18:01:30 2024 UTC