It might be the fact that I just woke up but why can't constants have the same name as function names or class names? Secondly, I wouldn't put in the check for the reserved words. People have managed without it up to today and any check would slow it down a bit (*and* it would be another hard coded place to update reserved words when added). BTW, quicker ways of doing this check is having a sorted list and doing a binary search or putting them in a hash table and searching for them. But I wouldn't do any of these.
Andi At 01:22 AM 10/2/2001 -0600, Zak Greant wrote: >Bug report 13505 got me thinking about the behavior of define() - if >you try to define a constant name that is a reserved word, or an >existing function or class name, no warning is generated. > >This could have been a conscious decision - a case where it was >decided that some safety could be traded for a bit of extra speed. If >it wasn't, then here is a patch to check that the constant name does >not clash with a reserved work, function name or class name. > >I used an array of reserved words and a for loop to handle finding >conflicting reserved words. Is there a better way to do this. AFAICT >the other methods for handling reserved word conflicts are handled at >the parser level. i.e. Trying to define 'function and (){}' generates a >parser error. > >Anyhoo, perhaps someone could take a look at the patch? :) > >-- >Zak Greant > >PHP Quality Assurance Team >http://qa.php.net/ > >"We must be the change we wish to see." - M. K. Ghandi >-- >PHP Development Mailing List <http://www.php.net/> >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]