diff --git a/reference/info/functions/assert.xml b/reference/info/functions/assert.xml index 0bfa78b3be..fb38fe6b94 100644 --- a/reference/info/functions/assert.xml +++ b/reference/info/functions/assert.xml @@ -11,6 +11,7 @@ boolassert mixedassertion + stringdescription assert will check the given @@ -50,8 +51,8 @@ The assert_options function and/or - ASSERT_CALLBACK configuration directive allow a callback function - to be set to handle failed assertions. + ASSERT_CALLBACK configuration directive allow a + callback function to be set to handle failed assertions. assert callbacks are particularly useful for @@ -66,8 +67,11 @@ argument will contain the file the assertion failed in. The second argument will contain the line the assertion failed on and the third argument will contain the expression that failed (if - any - literal values such as 1 or "two" will not be passed via - this argument) + any — literal values such as 1 or "two" will not be passed via + this argument). Users of PHP 5.4.8 and later may also provide a fourth + optional argument, which will contain the + description given to assert, if + it was set. @@ -83,6 +87,15 @@ + + description + + + An optional description that will be included in the failure message if + the assertion fails. + + + @@ -94,6 +107,33 @@ + + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 5.4.8 + + The description parameter was added. The + description is also now provided to a callback + function in ASSERT_CALLBACK mode as the fourth + argument. + + + + + + + + &reftitle.examples; @@ -126,6 +166,45 @@ assert('mysql_query("")'); + + + Using a custom handler to print a description + + +]]> + + &example.outputs; + + + + +