Page 1 of 1

Has file API changed?

Posted: Sun Mar 18, 2007 8:44 pm
by firemyst
Hi everyone,

I have some PHP code which looked like:

Code: Select all

if (file_exists($file) && $fp = file ($file, "r")) {
and noticed there are several code tutorials floating about the net like that.

However, then I downloaded and installed PHP version 5.2.1 and it complains:



Warning: file() expects parameter 2 to be long, string given in C:\Inetpub\wwwroot\common.php on line 675


Looking up the documentation, I see the "file" function has changed, but could not find it in any of the change logs.

When did it change and why?

Doing a google on the error, I see I'm not the only one who's been caught by this.

Posted: Sun Mar 18, 2007 11:07 pm
by feyd
The file() function hasn't really changed since it's inception. I think you're confusing it with fopen().