#24967 [Opn->Bgs]: fopen when placed within a function causes function to return

From: Date: Wed, 06 Aug 2003 21:33:50 +0000
Subject: #24967 [Opn->Bgs]: fopen when placed within a function causes function to return
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-45479@lists.php.net to get a copy of this message
ID: 24967 Updated by: wez@php.net Reported By: laurie at oneuponedown dot co dot uk -Status: Open +Status: Bogus Bug Type: *Directory/Filesystem functions Operating System: Linux PHP Version: 4.3.2 New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. Remove the @ from the fopen() call, and then go read the manual. Previous Comments: ------------------------------------------------------------------------ [2003-08-06 16:13:53] laurie at oneuponedown dot co dot uk Description: ------------ When using fopen inside a function to open a file for reading - irrerspective of weather fopen successfully opens the file, the use of fopen causes the function to return. Reproduce code: --------------- <html> <head> <title>TEST</title> </head> <body> <? function test () { // OPEN FILE FOR READING if ($ID = @fopen("/tmp/213.212.78.27.1060201522.txtfgbxdf","wb")) { // NOTHING FROM HERE DOWNWARDS IS EXCUTED // PRINT FIRST LINE OF FILE print(fgets($ID)); } else { // PRINT ERROR print("FOPEN FAILED"); } } ?> </body> </html> Expected result: ---------------- First line of file if success, "FOPEN FAILED" if fail. Actual result: -------------- Nothing ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24967&edit=1

« previous php.bugs (#45479) next »