php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21868 include()/require() bug
Submitted: 2003-01-24 15:57 UTC Modified: 2003-01-24 16:09 UTC
From: omikorn at yahoo dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.2.1 OS: Windoze
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: omikorn at yahoo dot com
New email:
PHP Version: OS:

 

 [2003-01-24 15:57 UTC] omikorn at yahoo dot com
A BIG ATTENTION!
let`s say that we have this 2 files include.php & test.php:
include.php
<?
$foo="blabla";
?>
and now test.php:
<?
require "include.php";
function do_test()
{
if ($foo) {echo "foo is set if called from function<br>";} else {echo "bang foo is not set if called from function<br>";}
}

do_test();
if ($foo) {echo "foo is set if called from main<br>";} else {echo "bang foo is not set if called from main<br>";}
Result of the program is:
bang foo is not set if called from function.
foo is set if called from main

Bug?
Server: Apache/1.3.26 (Win32) PHP/4.2.3

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-24 16:09 UTC] moriyoshi@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

You should use "global" declarations when you want to use global variables
in the functions.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 03 20:01:29 2024 UTC