Sorry,
I did not saw that there were an == on the right side, and thought that It
was an assignement
.
Thanks a lot
Best regards,
Pascal KISSIAN
De : Thomas Punt [mailto:tpunt@hotmail.co.uk]
Envoyé : vendredi 30 septembre 2016 12:51
À : Pascal KISSIAN php-mailing-list@lool.fr
Objet : Re: [PHP-DEV] php short circuit bug?
Hi!
The warning is being emitted from the IF statement body, where you're not
actually performing an assignment, but a comparison instead:
$t_aa["bb"]=="cc";
-Tom
From: Pascal KISSIAN <php-mailing-list@lool.fr
mailto:php-mailing-list@lool.fr >
Sent: 30 September 2016 11:45
To: internals@lists.php.net mailto:internals@lists.php.net
Subject: [PHP-DEV] php short circuit bug?
Hi everybody,
Perhaps am I making a mistake, but the following code fragment:
<?php
$t_aa = array();
if ( !isset($t_aa["bb"]) || ($t_aa["bb"]=="") ) $t_aa["bb"]=="cc";
?>
Emits the following notice:
PHP Notice: Undefined index: bb in test.php on line 4
The php documentation :
http://php.net/manual/en/language.operators.logical.php
http://php.net/manual/en/language.operators.logical.php PHP: Logical
Operators - Manual
php.net
Logical Operators; Example Name Result $a and $b: And: TRUE
if both $a and
$b are TRUE. $a or $b: Or: TRUE
if either $a or $b is TRUE. $a xor $b: Xor:
TRUE
if either ...
states in exemple 1 that short circuit is implemented.
In my example as !isset($t_aa["bb"]) true, then the second expression
($t_aa["bb"]=="")should not be evaluated!
Is it a php bug? Or am i missing something?
Cheers,
Pascal KISSIAN