php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20723 include self file
Submitted: 2002-11-29 06:50 UTC Modified: 2002-12-10 02:54 UTC
From: ionuta at infoiasi dot ro Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.2.2 OS: Red Hat 7.2
Private report: No CVE-ID: None
 [2002-11-29 06:50 UTC] ionuta at infoiasi dot ro
script.php

<?php
echo "hello\n";
include("script.php");
?>


if you try this you will get:
hello
hello
hello
...

and the script will failure

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-29 06:51 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php
 [2002-12-10 01:25 UTC] gali at email dot ro
it is a bug
 [2002-12-10 02:54 UTC] philip@php.net
I'm not sure what expected behavior should be here but consider using include_once().

On a related note:  include 'idonotexist.php'; gives a confusing error these days:

Warning: main(idonotexist.php) [function.main]: failed to create stream: No such file or directory in /var/www/include.php on line 3

Warning: main() [function.main]: Failed opening 'idonotexist.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/include.php on line 3

A lot of people are going to find themselves here:

http://www.php.net/function.main

;)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 17 11:01:28 2024 UTC