Re: cvs: Zend / zend_operators.c
| From: | Yasuo Ohgaki | Date: | Mon, 15 Jul 2002 01:27:29 +0000 |
| Subject: | Re: cvs: Zend / zend_operators.c | ||
| References: | 1 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-253@lists.php.net to get a copy of this message | ||
Is this patch is safe to do
if ($some_bool_var === TRUE) // -1 === TRUE is TRUE?
output_to_client_that_expects_true_as_1($val); // break php/java script?
test_TRUE_with_assumption_TRUE_is_1($val); // break php script?
etc.
PS: Changes that may have serious impact should be
discussed on mail list. IMHO.
--
Yasuo Ohgaki
Derick Rethans wrote:
derick Sun Jul 14 05:35:38 2002 EDTModified files: /Zend zend_operators.c Log:- Now implement is as documented: considered TRUE, like any other non-zero(whether negative or positive) number! This means that FALSE++ = TRUE and TRUE++ is still TRUE. Same for FALSE-- = TRUE and TRUE-- = FALSE; Index: Zend/zend_operators.cdiff -u Zend/zend_operators.c:1.119 Zend/zend_operators.c:1.120 --- Zend/zend_operators.c:1.119 Sun Jul 14 05:26:41 2002 +++ Zend/zend_operators.c Sun Jul 14 05:35:38 2002 @@ -1443,10 +1443,9 @@ { switch (op1->type) { case IS_BOOL: - if (op1->value.lval) { - op1->type = IS_LONG; + if (!op->value.lval) { + op1->value.lval = 1; } - op1->value.lval++; break; case IS_LONG: if(op1->value.lval == LONG_MAX) { @@ -1511,10 +1510,11 @@ switch (op1->type) { case IS_BOOL: - if (!op1->value.lval) { - op1->type = IS_LONG; + if (op->value.lval) { + op1->value.lval = 0; + } else { + op1->value.lval = 1; } - op1->value.lval--; break; case IS_LONG: if(op1->value.lval == LONG_MIN) {