I would like to put in some additiona comments to this: >-----Original Message----- >From: Svensson, B.A.T. (HKG) >Sent: Thursday, February 21, 2002 2:51 PM >To: [EMAIL PROTECTED] >Cc: 'Olga Tonkonog' >Subject: RE: [PHP-WIN] fopen() > > >>I have problem with function fopen() - if file not exists, fopen() don't >>return false, it returnnothing. > >It is impossible for a function in a typed language to return >different data types dependent on the evaluation of the >function. According to the manual pages of php's fiopen() it >should return an integer value. > >The php manual says about fopen: > >Description > > int fopen ( string filename, string mode [, int use_include_path]) > > >I assume php calls fopen() from the C-library (with some >preparing of the arguments). C's fopen() returns a handler >(e.g. an int, a.k.a. integer) to a file. If the file could not >be open the "handler" returned will be zero (0) - according to >the ANSI C std lib spec. I assume that php's fopen() just >forwards this handler, and in case a of failure to open a >file, the value returned by fopen() will be, most likely be, zero.
According to the ANSI-C specifications of fopen() it returns a NULL pointer to the file pointer if an error occurs while opening the file. It seams like, according to the problem some people has with it, that the php parser does not translate this null pointer, but just forwards it? A suggestion to the guys involved in the php development team: If it is like the case above, maybe the dev. team should consider to change this null pointer into a zero value before returning the value to the application programmer? /Anders -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php