From:             [EMAIL PROTECTED]
Operating system: all
PHP version:      4.2.3
PHP Bug Type:     Feature/Change Request
Bug description:  define() defined() usage of constants -> handler

lets say for example you have vast ammounts of code which use a language
system which is based on define() statements, and ofcourse addressing of
theese in the source code in the following way:

echo date(_MB_TODAYSDATE,time());

things get confusing while editing code and youre bound to come to
unused/unreferenced constants (or missing ones).

having the handler would help us do two things:

#1 using the define() statement to call a handler with the $key, $val
pair, in which a person could for example store this in a database (to
display and edit on a webpage for example)

#2 - this is a three part advancement

a) a person could count how many times a variable has been referenced (and
store that number into the database, so eventually after playtesting every
part of the software you find "unused" keys);

b) a person could also store information on constants that are not really
defined (a defined() check to acctually throw out errors or create
"unused" defines in the database, for easy editing later)

c) a constant doesnt really need to be defined, it can be also fetched
from the database on first reference - or whatever other behaviour the
user wants to make

this could/should be done in the way like set_error_handler and
restore_error_handler, with the sole difference that you would need two
function names as the parameters (or have two functions which have one), i
dont see a problem implementing this in 4.3 or 5.0 the latest, as it would
really proove usefull to many people (mainly the ones who made their
language system based on define statements in order to help them clean
their code or transfer to a more advanced multilanguage system, operated
with a database, xml, whatever they think of when writing a handler for
this)
-- 
Edit bug report at http://bugs.php.net/?id=19610&edit=1
-- 
Try a CVS snapshot:  http://bugs.php.net/fix.php?id=19610&r=trysnapshot
Fixed in CVS:        http://bugs.php.net/fix.php?id=19610&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=19610&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=19610&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=19610&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19610&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=19610&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=19610&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=19610&r=submittedtwice
register_globals:    http://bugs.php.net/fix.php?id=19610&r=globals

Reply via email to