Edit report at https://bugs.php.net/bug.php?id=55159&edit=1
ID: 55159
User updated by: knappster_1 at hotmail dot com
Reported by: knappster_1 at hotmail dot com
Summary: fopen encodes ampersand '&' as '&'
-Status: Open
+Status: Closed
Type: Bug
Package: Unknown/Other Function
Operating System: Unix
PHP Version: 5.2.17
Block user comment: N
Private report: N
New Comment:
I have tried your script on 2 Windows machines with Apache 2.2.11 and PHP
5.2.17 and my results match yours. I was sure I saw it when I first upgraded
to 5.2.17 on my machine, but this now seems to be an issue with the web host
rather than a bug in php. Sorry for the red herring. I am changing the status
to closed.
Previous Comments:
------------------------------------------------------------------------
[2011-07-07 20:24:23] lonnyk at gmail dot com
I tested this on the 5.4 alpha and did not have this problem.
Here is my test script:
----------------------
<?php
error_reporting(E_ALL);
$fh = fopen("http://finance.yahoo.com/d/quotes.csv?
s=ABT&f=sl1d1t1c1ohgvpnbaejkr&o=t", "r");
while( !feof( $fh ) ){
echo fgets( $fh ) . "\n";
}
Result:
---------------------
"ABT",53.54,"7/7/2011","4:01pm",+0.26,53.49,53.60,53.24,4932482,53.28,"Abbott
Laboratori",N/A,N/A,2.87,44.59,54.24,18.56
------------------------------------------------------------------------
[2011-07-07 16:32:41] knappster_1 at hotmail dot com
Description:
------------
---
>From manual page: http://www.php.net/function.fopen%23Parameters
---
The function used to return a csv file with a stock quote with PHP 5.2.9.
However, now with 5.2.17 the function will replace '&' with '&' and it
returns a csv file with just the text: "Missing Format Variable".
It is easy to verify by using a malformed URL with '&' in it and on the
resulting html, view source and the error message will show '&' where '&'
should be. I have been unable to locate a workaround.
Test script:
---------------
fopen("http://finance.yahoo.com/d/quotes.csv?s=ABT&f=sl1d1t1c1ohgvpnbaejkr&o=t",
"r");
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55159&edit=1