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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sklar at student dot net
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Sun Mar 03 13:01:28 2024 UTC