[PHP-DOC] #20075 [Asn->Csd]: assert() callback doesn't get expression From: derick <email protected>
Date: 10/25/02

 ID: 20075
 Updated by: derick <email protected>
 Reported By: leon <email protected>
-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 <email protected>

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 <email protected>

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

-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php