]> granicus.if.org Git - php/commit
Fix compile-time/run-time discrepancies with unary operators
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 15 Sep 2020 13:06:56 +0000 (15:06 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 15 Sep 2020 13:08:55 +0000 (15:08 +0200)
commit16b9f196782281e2bb407f3217695205d8cb70ff
tree0b483d5c9d6fcb27634eef576cf216106b7cb17f
parentf5bbb0480ef1ea03d7011af128369d10ca726d72
Fix compile-time/run-time discrepancies with unary operators

This addresses two issues:
 * ~ throws for a number of types, and we should not compile-time
   evaluate in that case. Add a check similar to what we do for
   binary ops.
 * Unary +/- may produce a different error message due to
   canonicalization of the constant operand to the RHS. To avoid
   this, put the constant operand on the RHS right away.

Fixes oss-fuzz #25649.
Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt
Zend/tests/runtime_compile_time_binary_operands.phpt
Zend/zend_compile.c