From:             cory dot mawhorter at ephective dot com
Operating system: na
PHP version:      6CVS-2009-06-14 (CVS)
PHP Bug Type:     Feature/Change Request
Bug description:  include/require callbacks

Description:
------------
Two suggestions for include/require.

1) A callback function.
2) Custom include/require functions.

Reproduce code:
---------------
Callback function example:

function verify_path($absfile) {
   return (basename($absfile) == 'some-file.php');
}

set_include_cb('verify_path');
include 'some-file.php'; // cb returns true: file included
include 'some-other-file.php'; // cb returns false: warning
require 'some-other-file.php'; // cb returns false: fatal error

I could see this being useful in more situations than simply verifying the
include path is correct.

An include/require replacement:

function my_custom_include($inc) {
    // of course, includes into the scope of the function
    include($inc); 

    // it'd be nice if you could tell it to include into 
    // the root scope or whatever... this might be difficult 
    // to do for security reasons... but i'm still throwing 
    // it out there
}

my_custom_include('some-file.php');


-- 
Edit bug report at http://bugs.php.net/?id=48546&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48546&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48546&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48546&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48546&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48546&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48546&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48546&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48546&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48546&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48546&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48546&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48546&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48546&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48546&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48546&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48546&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48546&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48546&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48546&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48546&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48546&r=mysqlcfg

Reply via email to