php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #12199 Bad return value from include_once()
Submitted: 2001-07-17 05:51 UTC Modified: 2001-08-08 10:22 UTC
From: marten at ditt dot as Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.6 OS: Any
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: marten at ditt dot as
New email:
PHP Version: OS:

 

 [2001-07-17 05:51 UTC] marten at ditt dot as
Currently include_once() returns 1 the first time a file is included and NULL the second time (when the file is already included) but NULL is also returned if an error occurs when including the file (file not found, parse error etc).

I?d like include_once() to return 1 or even better, TRUE, if the file was succesfully included or if it?s already included and FALSE if an error occured.

<?php
// Returns 1, evaluates to TRUE
if(include_once('myfile.php')) {
	echo "SUCCESS\n";
}
else {
	echo "FAILURE\n";
}

// Returns NULL, evaluates to FALSE
if(include_once('myfile.php')) {
	echo "SUCCESS\n";
}
else {
	echo "FAILURE\n";
}
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-08 10:22 UTC] marten at ditt dot as
Fixed in CVS by Zeev on August 2. Thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC