#20075 [Asn->Csd]: assert() callback doesn't get expression

From: Date: Fri, 25 Oct 2002 05:47:55 +0000
Subject: #20075 [Asn->Csd]: assert() callback doesn't get expression
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969349262@lists.php.net to get a copy of this message
ID: 20075 Updated by: derick@php.net Reported By: leon@leonatkinson.com -Status: Assigned +Status: Closed Bug Type: Documentation problem Operating System: RH 7.2 PHP Version: 4.3.0-pre1 Assigned To: derick Previous Comments: ------------------------------------------------------------------------ [2002-10-25 00:30:26] sniper@php.net This is not a bug. Docs need a bit of a clarification about this though. Assigned to Derick per his request. ------------------------------------------------------------------------ [2002-10-24 17:05:11] leon@leonatkinson.com It looks like the callback function registered with assert_options() only gets the third argument set when assert() is called with a string. Consider the following script. <? function failedAssertion($file, $line, $expression) { print("'$file', '$line', '$expression'<br>"); } assert_options(ASSERT_ACTIVE, TRUE); assert_options(ASSERT_CALLBACK, "failedAssertion"); assert("1 == 2"); assert(1 == 2); ?> This produces the following. '/usr/local/apache/htdocs/tricks/assert.php', '9', '1 == 2' '/usr/local/apache/htdocs/tricks/assert.php', '10', '' If I turn error reporting on, the warning messages mirror this by leaving out the expression. Looks like the assert.phpt doesn't test assert() for the old form. Maybe it needs a line like "assert($a != 0);". ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20075&edit=1

« previous php.doc (#969349262) next »