|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-08-24 17:31 UTC] kalle@php.net
-Type: Security
+Type: Bug
-Package: *General Issues
+Package: Scripting Engine problem
[2017-08-24 17:38 UTC] kalle@php.net
-Status: Open
+Status: Not a bug
[2017-08-24 17:38 UTC] kalle@php.net
[2017-08-24 18:06 UTC] php at hitchhikers11 dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 17:00:01 2025 UTC |
Description: ------------ There is a strange behaveour, when assigning a value in an if-statement (=), instead of equate the variable with a value (==): the value of the variable becomes TRUE respectively 1, this happens only if there is another condition in the if-statement after assigning the variable. Tested with PHP Version 5.6 and 7.? Test script: --------------- $var = "original value"; $var2 = 'some_value'; echo "1: ".$var."<br>"; if($var="value" || false){ echo "2: ".$var."<br>"; } /* && or || */ if("any_true_value"==$var){echo "3: ".$var."<br>";} Expected result: ---------------- 1: original value 2: value Actual result: -------------- 1: original value 2: 1 3: 1