Skip to content

Commit e35cd34

Browse files
committed
Fix assertion warning message when no description is provided
1 parent aae39fe commit e35cd34

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

ext/standard/assert.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ PHP_FUNCTION(assert)
177177
zend_exception_error(EG(exception), E_ERROR);
178178
}
179179
} else if (ASSERTG(warning)) {
180-
php_error_docref(NULL, E_WARNING, "%s failed", description_str ? ZSTR_VAL(description_str) : "Assertion failed");
180+
php_error_docref(NULL, E_WARNING, "%s failed", description_str ? ZSTR_VAL(description_str) : "Assertion");
181181
}
182182

183183
if (ASSERTG(bail)) {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
assert(): warnings with no descriptions.
3+
--INI--
4+
assert.active = 1
5+
assert.warning = 1
6+
assert.bail = 0
7+
assert.exception=0
8+
--FILE--
9+
<?php
10+
assert(0, null);
11+
?>
12+
--EXPECTF--
13+
Warning: assert(): Assertion failed in %s on line %d

0 commit comments

Comments
 (0)