View Single Post

  #1 (permalink)  
Old 11-15-2004
Sundial Services
 
Posts: n/a
Default "Class '1' not found" - caused by mysql_fetch_object!


I recently brought an old application out of mothballs and launched it under
PHP5, only to get this message:

Fatal Error: Class '1' not found

It was clearly somehow an /execution/ time problem, because it did not
appear on the first page I had linked to, all of which use the same
includes. Even though it appears to be a compile-time error ...

Anyhow, I solved it. The statement read:

$r = mysql_fetch_object($DB, MYSQL_ASSOC);

.... and PHP (now) doesn't like that. "mysql_fetch_object" is now listed as
having only one parameter. [Note: "mysql_fetch_array" still has two!] The
error disappeared when the second parameter was removed.

I consider this to be a PHP bug, however, because the compiler should have
caught the fact that only one parameter is permitted to this function. And
at the very least it should have responded more cleanly. In retrospect, I
speculate that the value of MYSQL_ASSOC is '1' and that perhaps there /is/
an undocumented second parameter ...


Reply With Quote