php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #15233 Possibility to make include() from within functions with global scope
Submitted: 2002-01-26 06:45 UTC Modified: 2002-10-02 04:04 UTC
Votes:18
Avg. Score:4.8 ± 0.4
Reproduced:18 of 18 (100.0%)
Same Version:3 (16.7%)
Same OS:8 (44.4%)
From: flying at dom dot natm dot ru Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.0.6 OS: all
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: flying at dom dot natm dot ru
New email:
PHP Version: OS:

 

 [2002-01-26 06:45 UTC] flying at dom dot natm dot ru
 It is very important to have a possibility to perform include() or require() from within a function or class method and have included file into global scope.

 Here is a lot of reasons. Primary one is to make it possible to create dynamically loaded modules, it is very important into large projects. 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-10 05:37 UTC] kevin at oceania dot net
for modular installations this type of feature is critical. The alternatives are the code you see produced in *nuke type cms system. I really leaves php lacking
 [2002-06-05 13:29 UTC] tero dot tilus at iki dot fi
I had to change my developement tool due to lack of the possibility to create dynamically loadable (php) modules (with php).  PHP just could't do what I wanted.  Just as Kevin said, this is critical feature in modular systems.
 [2002-06-06 06:44 UTC] tero dot tilus at iki dot fi
Possible (even though not particularily good) workaround is to "register" (put them in say global array, which maps class/function names to filenames) your "dynamic libraries" where you would normally want to load them.  Then where ever you want to access dynamically loaded classes/functions, first include file containing it/them.

This works only when you don't really _have_to_ access global namespace.  I used this approach on a system where config files scattered all over the filesystem (like apache's .htaccess) can locally change behaviour of my system and add features (register new "handlers" etc).  Instead of actually loading these configs only register new features and loading is performed only when I need to instantiate a "dynamically loaded" class.
 [2002-10-02 03:59 UTC] flying at dom dot natm dot ru
This bug was submitted about a year ago, but no any developer comments are still available. According to comments, added by other PHP programmers - this feature is quite important. 
 Will we ever have a chance to know if such funtcionality is planned for implementation?
 [2002-10-02 04:04 UTC] derick@php.net
This is technically almost impossible without rewriting the whole engine.
 [2004-06-25 15:10 UTC] mail at spybreak dot de
> This is technically almost impossible without
> rewriting the whole engine.
Now after two years: same situation for PHP5? I could really use something like this (also for a more modular system).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 22:01:27 2024 UTC