php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #23987 Need capability to deregister/overload functions
Submitted: 2003-06-03 09:43 UTC Modified: 2003-06-03 09:49 UTC
From: gfraley5 at earthlink dot net Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.3.2 OS: All
Private report: No CVE-ID: None
 [2003-06-03 09:43 UTC] gfraley5 at earthlink dot net
If this capability already exists I can't find it.  Is it planned/possible to allow functions to be deregistered so that they can be replaced, basically overloading them?  In other words, right now, if function a() is defined/registered, I am not able to replace it conditionally, I imagine since the compiler has already compiled the script prior to processing it.  I am seeking the ability to conditionally call scripts where the different scripts have the same function names that the calling script has.  In other words, the scenario is this.

Script Master.php might look like this:

<?
If (condition) {
    include('override_script.php');
    exit();
}

function sameNameAsInOverride_script() {
//do stuff
}
?>

Possibly have it do this:
<?
If (condition) {
    function_deregister(sameNameAsInOverride_script);
    include('override_script.php');
    exit();
}

function sameNameAsInOverride_script() {
//do stuff
}
?>

Possible?

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-03 09:49 UTC] derick@php.net
We're not going to add stuff to deregister functions, this is a totally broken concept.

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Aug 18 12:01:28 2024 UTC