php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48029 require function fails with fatal error
Submitted: 2009-04-20 18:20 UTC Modified: 2009-04-21 12:45 UTC
From: info at rkphoto dot co dot uk Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.0RC1 OS: Mac OS X
Private report: No CVE-ID: None
 [2009-04-20 18:20 UTC] info at rkphoto dot co dot uk
Description:
------------
The require function produces a fatal error or expects arguments that 
have been removed from previous versions of the 'included' functions

Reproduce code:
---------------
Calling code:

<?php require('includes/mainMenu2.php'); ?>
<html>
  <head></head>
  <body><?php mainMenu(); ?></body>
</html>

Test Code in mainMenu2.php:

function mainMenu() {
	echo 'mainMenu() called';
}


Expected result:
----------------
mainMenu() called

Actual result:
--------------
Warning: require(includes/mainMenu2.php) [function.require]: failed to 
open stream: No such file or directory in 
/Library/WebServer/Documents/rk/require2.php on line 1

Fatal error: require() [function.require]: Failed opening required 
'includes/mainMenu2.php' (include_path='.:/usr/local/lib/php') in 
/Library/WebServer/Documents/rk/require2.php on line 1
____________________

This was the second incarnation of the problem - the first time I was 
working with mainMenu,php, and calling mainMenu() with one argument. I 
had the same error as above, but later this morphed into the error 
below after it dropped the fatal  error and just decided to object to 
the argument change instead.

Warning: Missing argument 1 for mainMenu(), called in 
/Library/WebServer/Documents/rk/require.php on line 4 and defined in 
/Library/WebServer/Documents/rk/includes/mainMenu.php on line 2

Matching the arguments stops this error message, but produces 
truncated html as the view source shows: 

<html>
  <head></head>
  <body>






Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-20 18:23 UTC] jani@php.net
Please try using this CVS snapshot:

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

  http://windows.php.net/snapshots/


 [2009-04-20 22:46 UTC] info at rkphoto dot co dot uk
No, same thing with PHP 5.3.0RC2-dev
 [2009-04-20 23:32 UTC] info at rkphoto dot co dot uk
Err - Sorry, jumped in too soon there, Looks like it now works as 
advertised - Thanks for your help!
 [2009-04-21 12:45 UTC] fa@php.net
Closing this bug then.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 16:01:34 2025 UTC