Re: About assert()

From: Date: Wed, 14 Feb 2018 23:13:55 +0000
Subject: Re: About assert()
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-101873@lists.php.net to get a copy of this message
2018-02-14 12:40 GMT-03:00 Michael Morris <tendoaki@gmail.com>: > Assert is a statement in PHP 7. Try this code > > function foo() { > debug_print_backtrace(); > return true; > } > > assert(foo()); > > In PHP 7 only foo() will be in the backtrace. In PHP 5 assert will be > listed as well. > I saw all that PHP_FUNCTION and ZEND_PARSE_PARAMETERS so thought that was just a regular exposed function with compilation toggled by setting. Anyway doing it directly in the lexer would avoid the argument parsing step (and turning parentesis optional). 2018-02-14 13:29 GMT-03:00 Niklas Keller <me@kelunik.com>: > > I don't think that's true. 0 can be used to dynamically switch > assertions on and off, which can be useful in some applications. > This can be useful for testing frameworks which does contract programming by assertions but only in development. Atenciosamente, Pedro

« previous php.internals (#101873) next »