note 8760 added to fopen
| From: | kessler at kessler-design dot com | Date: | Wed, 27 Sep 2000 12:47:58 +0000 |
| Subject: | note 8760 added to fopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-5516@lists.php.net to get a copy of this message | ||
Possible security-problem with fopen() if error-reporting is not suppressed.
Imagine you use 2 scripts on same or different hosts, but only first one is visible for the user.
Within the first script, you construct an URL with some (maybe not public) parameters to call the
second script, parse it's output and return something to the user, still from the first script.
#we are in script1.php and we construct the URL, then we try to open it
$filename="http://domain.com/script2.php?someparam=1&somemore=2";
$fh = fopen($filename, "r");
if ($fh) {
# ...
}
If the host (of second script) is not reachable, we wait a while and then get (with
'normal' error-reporting) the following text with the users browser-window.
Warning: fopen("http://domain.com/script2.php?someparam=1&somemore=2","r")
- Unknown error in domain.com\script1.phtml on line xxx
The error-report shows the whole (not public) filename of the second script including all (not
public) params instead of a simple connection timeout-message.
Make sure that you set error_reporting if you have to use such constructions.
http://www.php.net/manual/function.fopen.php