note 123522 deleted from function.assert by cmb
| From: | cmb@php.net | Date: | Wed, 16 Jan 2019 20:08:04 +0000 |
| Subject: | note 123522 deleted from function.assert by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210067@lists.php.net to get a copy of this message | ||
Note Submitter: keikland
----
Had a tricky situation where the code with assert() worked fine in development, but not in
production. The problem was when variables changed value as part of the assert test, for example:
assert(5 === ++$i);
This is valid PHP code, but caused havoc in production when the logic expected $i to have been
incremented. A similar problem would exist with in-line assignments, such as:
assert(!$i = sin($angle));
This is probably a very rare problem, but PHP should in principle throw an error in such cases.
Hopefully that can be added in all maintained versions.