php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1465 a user-defined function reported as "unsupported or undefined"
Submitted: 1999-05-28 12:40 UTC Modified: 1999-06-14 11:41 UTC
From: sklar at student dot net Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0.8 OS: Linux 2.0.35
Private report: No CVE-ID: None
 [1999-05-28 12:40 UTC] sklar at student dot net
This bug happens sporadically. I am using the module with apache 1.3.6.
It seems to happen more frequently after the child processes serve a large number
of requests, but some children can serve tons of requests with no problems.

The error I get is:
PHP 3 Fatal error:  Call to unsupported or undefined function db_write() in global.php on line 30

global.php, which is required at the top of just about every page on my site begins like this:

<?php
if (!isset($GLOBAL_PHP_ALREADY_INCLUDED)) {

  $GLOBAL_PHP_ALREADY_INCLUDED = 1;
  $DEBUG = 0;
  
  function db_read() {
    global $DATABASE_READ;
    mysql_connect($DATABASE_READ,"user","password");
    mysql_select_db("dbname");
  }

  function db_write() {
    global $DATABASE_WRITE;
    mysql_pconnect($DATABASE_WRITE,"user","password");
    mysql_select_db("dbname");
  }

  function db_other() {
    global $DATABASE_OTHER;
    mysql_pconnect($DATABASE_OTHER,"user","password");
    mysql_select_db("dbname");
  }  

  db_write();


-----------

and the error is happening when it gets to the db_write() call. The function has to be defined at that point, since the code that defines it is just a few lines above the function call.

I use these db_*() functions to switch between which database server the php script is talking to as it executes. 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-05-28 12:43 UTC] rasmus at cvs dot php dot net
This bug was fixed in 3.0.8
 [1999-06-01 09:25 UTC] sklar at student dot net
This still happens after upgrading to 3.0.8
 [1999-06-14 11:41 UTC] sklar at student dot net
This went away after upgrading to the CVS version as of 11:47AM EDT 3 June 1999 and stayed away with the 3.0.9 release. 

What was causing the problem?

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC