php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23910 opening a URL with fopen gives different results than in 4.3.1
Submitted: 2003-05-30 16:24 UTC Modified: 2003-05-30 16:57 UTC
From: nmcfaul at mcfaulgolf dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.2 OS: Linux 2.4.20
Private report: No CVE-ID: None
 [2003-05-30 16:24 UTC] nmcfaul at mcfaulgolf dot com
I'm having trouble figuring out why when I use fopen to open a URL in 4.3.2 I get different output than in 4.3.1.

I'm using the following to get sport scores from sportline.com, i also put in some troubleshooting code to help me determine the problem.

$url = "http://www.sportsline.com/mlb/box-scoreboards";

$fp=fopen($url,"rb") or die ("<p>Could not Open Sportsline.com</p>");
$handle = fopen("/opt/web/sportsline.txt","a");

$file=fread($fp,600000);
$new=substr($file,0);

fwrite($handle,$new);
fclose($handle);
fclose($fp);

When I run the above script in 4.3.2 I get a filesize of 2434 bytes, when I run the exact same code in 4.3.1, I get a filesize of 10733 bytes.

I've used the exact same configure script parameters for both PHP builds, and the same apache version (2.0.46)

Any assistance would be appreciated!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-30 16:57 UTC] wez@php.net
4.3.0 and 4.3.1 were actually broken in allowing your script to work in the way that it did.
4.3.2 re-introduces the correct behaviour from 4.2.x days and earlier.
We updated the online manual today to reflect this; please read this:
http://www.php.net/manual/en/function.fread.php

This is expected behaviour, so I'm marking this report as bogus (as it is not a bug).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 22:01:33 2024 UTC