ID: 22508 Updated by: [EMAIL PROTECTED] Reported By: jim at bluedojo dot com -Status: Open +Status: Assigned Bug Type: *Directory/Filesystem functions Operating System: Windows PHP Version: 4.3.1 -Assigned To: +Assigned To: wez
Previous Comments: ------------------------------------------------------------------------ [2003-03-03 18:46:30] jim at bluedojo dot com Hello wez, and thanks for the speedy updates on fopen(). I've found some more types of URLS that causes an error using fopen(). I'm using Apache 1.3 and PHP 4.3.x (I used the latest CVS version.) They are listed below. 1.) If it redirects from http:// to https:// it will crash Apache connection. Example Link: http://registration.ft.com/registration/sub/manageYourAccount.jsp 2.) If fopen() loads an unauthorized page -- HTTP Error 403 (Forbidden) it crashes Apache connection. Example Link: http://www.fc-gabarron.es/en 3.) And I'm not sure why this is causing an error: Example Link: http://www.sportingnews.com/RealMedia/ads/click_lx.ads/www.sportingnews.com/soccer/articles/20030302/460373.html/1065908018/Right3/default/empty.gif/34313165376634343365363238633430 I'm not to familiar with programming with sockets and HTTP protocol, but is there a way to catch all the errors and just simply return false if the connection doesn't open? Just place the link in this code to see it happen: <? $url = "(url goes here)"; if ($fd = @fopen($url,"r")) echo "Success"; else echo "Failure"; fclose($fd); ?> ------------------------------------------------------------------------ [2003-03-03 03:22:03] [EMAIL PROTECTED] We are not fixing bugs in 4.2.x releases any longer; 4.3.x is the current stable branch, PHP 5 is the current development version. ------------------------------------------------------------------------ [2003-03-02 21:04:36] jim at bluedojo dot com I also wanted to note that in version PHP 4.2.3 fopen will not work if it redirects from http:// to https://. Perhaps it should return false in this case. ------------------------------------------------------------------------ [2003-03-02 16:47:12] [EMAIL PROTECTED] This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2003-03-02 16:25:55] jim at bluedojo dot com The pages that is crashing my Apache server include, "http://www.sltrib2002.com". What is happening is fopen() is trying to open this link but the link redirects. When this link is placed in a browser, it actually redirects to, "http://www.sltrib2002.com/main/index.asp". This occurs in PHP 4.3.1. When I downgraded to PHP 4.2.3 fopen() worked fine. Here is more information about the problem in detail: I am running WinXP, Apache 1.3, MySQL 3.23, and PHP 4.3.1. I have a php page called "populate.php" that is using fopen() to index web pages. This works most of the time when I load this page in a browser, but fopen() is causing problems. Sometimes a specific web site (that has a redirecting link) causes Apache to crash. A window pops up saying, "Apache.exe has encountered a problem and needs to close. We are sorry for the inconvenience." And in the browser it says, "The page cannot be loaded." Although it says it crashes, the Apache server still seems to run if I load another page. It seems as if only that specific connection crashed. But this is the problem. I need to find out a way so it does not crash the page, populate.php, so it can continue running without getting the error in the browser "The page cannot be loaded." I tried the same web site on another configuration of Apache (that I pay for and am trying to avoid) and the page loads fine. Why is fopen crashing my server if the link redirects? Again, this occured in PHP 4.3.1. I had to downgrade for fopen to work ok with websites that redirect. The code below will produce the error in PHP 4.3.1. <? //The site http://www.vsacentral.com //redirects to //http://www.vsacentral.com/main.php // //Also try this //http://www.sltrib2002.com //It redirects to //http://www.sltrib2002.com/main/index.asp $url = "http://www.vsacentral.com"; if ($fd = @fopen($url,"r")) echo "Success"; else echo "Failure"; fclose($fd); ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22508&edit=1