Bug #15999 Updated: fread() hangs apache when file pointer obtained from a url parameter PHPSESSID
| From: | sniper@php.net | Date: | Thu, 11 Jul 2002 04:40:20 +0000 |
| Subject: | Bug #15999 Updated: fread() hangs apache when file pointer obtained from a url parameter PHPSESSID | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-13820@lists.php.net to get a copy of this message | ||
ID: 15999
Updated by: sniper@php.net
Reported By: didier.alain@laposte.net
-Status: Open
+Status: Feedback
Bug Type: Session related
Operating System: Linux
PHP Version: 4.1.0, 4.0.6
New Comment:
Your scripts will never work since the session data
will be available AFTER the script is run.
What are you trying to achieve? Can't you just use include()
as the files are on same machine???
Previous Comments:
------------------------------------------------------------------------
[2002-06-01 11:56:54] didier.alain@laposte.net
$doc="http://myserver/docs/mydoc.html?PHPSESSID=".session_id();
It was a type mismatch, of course, sorry.
------------------------------------------------------------------------
[2002-06-01 11:51:18] didier.alain@laposte.net
Sorry for the long time...
Here's a complete but simple example :
-------------
In httpd.conf
-------------
<Directory "/var/www/docs/">
php_value auto_prepend_file "block.php"
</Directory>
(block.php is in my php.ini include_path, and /var/www is my Apache
DocumentRoot)
------------
open_doc.php (<--I call this one with my browser)
------------
<?php
session_register("s_util");
$s_util = toto";
session_start();
echo "Session Id :".session_id(); //just to be sure...
$doc =
"http://http://myserver/docs/mydoc.html?PHPSESSID=".session_id();
readfile($doc); //same with $fp=fopen($doc, "r");
?>
---------
block.php
---------
<?php
session_start();
echo "Session Id :".session_id(); //just to be sure...
if (session_is_registered("s_util"))
{
echo "Right, man !";
}
else
{
echo "No auth!";
}
?>
I can't see any infinite loop here, but I may be wrong... Whenever you
don't pass the session param in the url anymore, there's "no problem"
anymore, except you can't retrieve session values !
------------------------------------------------------------------------
[2002-03-19 05:03:47] yohgaki@php.net
What is the name of the script you have pasted?
What is the content of block.html?
It seems you are not calling the same script, but
if block.html is calling the script pasted, it's
the same.
------------------------------------------------------------------------
[2002-03-11 13:28:19] sniper@php.net
Ok..let's reopen this. I have no idea what you're doing
but if you're not doing what I thought you were, it might
be a bug..although that auto_prepend thing makes me wonder..
Please add some example scripts and what needs to be set
in php.ini / httpd.conf to reproduce this.
------------------------------------------------------------------------
[2002-03-11 12:38:04] didier.alain@laposte.net
Why do you think that block.html is the same script ? Maybe my example
is not very clear. But you are right, Apache behavior looks like
infinite recursion. Let me explain again and more precisly :
the script A (the one in the previous post) tries to open the url B
($url). Script C is auto_prepended (at fread instruction, right ?) and
validate the access to the script B, with the session variable. If I
don't use the PHPSESSID in the url parameter (and skip the test in the
script C), the script is OK. If I use another parameter than PHPSESSID,
the script A is OK. Same behavior with fgets, readfile, etc... Note
that the script C is auto_prepended only in a subdirectory (containing
only docs like B) by apache configuration (<Directory ...> php_value
....</Directory>) and of course scripts A and C are not on this
directory.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/15999
--
Edit this bug report at http://bugs.php.net/?id=15999&edit=1