php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33357 require_once randomly fails to include file
Submitted: 2005-06-15 23:04 UTC Modified: 2005-06-23 01:00 UTC
From: elite at programmer dot net Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.0.4 OS: Windows 2003 SP1
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: elite at programmer dot net
New email:
PHP Version: OS:

 

 [2005-06-15 23:04 UTC] elite at programmer dot net
Description:
------------
When using require_once("file.php") to include "file.php" in multiple files, files which are included in each another on several levels, require_once("file.php") randomly fails to include the file at all.
Most of the time it includes it, but sometimes it will just fail and the system will come to a halt since that file is vital.

Changing to require("file.php") works, but obviously this would include the file several times.

Reproduce code:
---------------
inc.php

$dsn = 'mssql://user:pass@localhost/database';
$db = DB::connect($dsn);
if( PEAR::isError( $db ) )
{
   die "Database connect failed";
}

file1.php:

require_once("inc.php");

file2.php
require_once("file1.php");
require_once("inc.php");

Expected result:
----------------
inc.php included once every timed

Actual result:
--------------
inc.php sometimes is not included at all, since the database connection in inc.php is not initialized and $db is NULL

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-15 23:13 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-06-23 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun May 11 15:01:27 2025 UTC