Re: feature request for __LINE__, __FILE__ andtrigger_error
| From: | Alan Knowles | Date: | Thu, 25 Apr 2002 14:38:53 +0000 |
| Subject: | Re: feature request for __LINE__, __FILE__ andtrigger_error | ||
| References: | 1 2 3 4 5 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-83325@lists.php.net to get a copy of this message | ||
__LINE__ , __FILE__ (and now __FUNCTION__ & __CLASS__) are converted at compile time into a string - have a look at zend/zend_language_scanner.l for more details.
regards
alan
Michael Virnstein wrote:
A short question on this: how about __LINE__? doesn't this also require runtime context or am i wrong? if so, why it is a constant then, not a function? Michael "Stig S. Bakken" <ssb@fast.no> schrieb im Newsbeitrag news:1019701577.1694.33.camel@kirin.trondheim.fast.no...Hi, __FILE__ is compiled into a constant string by Zend. You can think of it as equivalent of putting a string with the filename there instead. It is constant. __CFILE__ would require runtime context (which function called us), so it makes no sense as a constant. Derick's xdebug extension will provide functions for this instead. - Stig On Wed, 2002-04-24 at 21:40, Michael Virnstein wrote:inan additional thought: if __CFILE__ and __CLINE__ are used outside of a function/method, both should be NULL. and trigger_error should only overwrite its __FILE__ and __LINE__ settings, if they are NOT NULL. And if one of the __FILE__ , __LINE parameters of trigger_error is NOT NULL, both have to be set. My 2 cents ;) That's how i would prefer it. <derick@php.net> schrieb im Newsbeitrag news:Pine.LNX.4.44.0204242104560.1215-100000@jdi.jdimedia.nl...Hello Michael, I'm working (80% done) on an extension for this. It should be finishedtrigger_errora few days. It doesn't feature the __C*__ things yet, but I can add a function for that too. I'll keep you posted, Derick On Wed, 24 Apr 2002, Michael Virnstein wrote:manner.It would be really useful for writing functions/Classes, if i were able to determine the __FILE__ and __LINE__ of the script, that is calling my function, without the need to send __FILE__ and __LINE__ as parameter to my function. E.g. __CFILE__ for calling script and __CLINE__ for line in the calling script would be really great. In addition it'll be useful, if I could use trigger_error in thisMost of the time i don't want to know, on which line myitfunction,call is located, but on which line in the script that called mythe error occured. it'll be nice, if trigger_error could be extended, so-----------------------------------------------------------------------__CLINE__);takes to more parameters, which overwrite the default __FILE__, __LINE__ settings of trigger error. Example: function somefunction($array) { if (!is_array($array)) {trigger_error("Not an array", E_USER_ERROR, __CFILE__,} // do something with the array } -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php-----------------------------------------------------------------------Did I help you? Consider a gift: http://www.amazon.co.uk/exec/obidos/registry/SLCB276UZU8B-----------------------------------------------------------------------PHP: Scripting the Web - derick@php.net All your branches are belong to me! SRM: Script Running Machine - www.vl-srm.net-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php