|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-06-06 18:34 UTC] toastboot at gmx dot de
Description:
------------
In advance I have to say, that it is not version 5.6.22 but 5.6.3 (german XAMPP installation) where I found the issue. I can't find this version in your list. Maybe you can change your list and then refer it correctly?!?
Normally I like the variable handling in PHP, that includes the possibility to be able to switch between var types but there is an issue with the var types. It can occur that an if-request will ignore the variable value... See more in the test script / example as follows...
Additional warning: I have not made any deeper checks but maybe it can cause security issues. In a simple check I saw, that it seems not to be possible to cause this issue via GET. There it works correctly (in my test scenario) but maybe there are other possibilities...
Test script:
---------------
$the_variable = 0;
/* make sth */
if($the_variable == "stop") {
# 'the_variable' is still set to 0
echo "hello";
}
# This will cause the wrong behaviour that the code within the if-request will be executed / 'hello' is displayed.
# now try it vice versa:
$the_variable = "stop";
if($the_variable == 0) {
echo "hello";
}
# The second if-request works as expected.
## Workaround ##
# use '===' instead of '=='
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 09:00:01 2025 UTC |
Where is exactly this behaviour described? To refer only to the mainpage of the php manual is not helpful. From my perspective it is a critical issue because: think about the situation that you check only text values and someone comes into the position to foist an integer on to the if-request of the script. Than you can cause unexpected behaviours and maybe open security issues (ie: if($password == "xyz") { echo "you are allowed to make this"; } -> $password = 0; will cause that the if-request does not bite). Another point is that in one direction it works correctly but not in the other. When I look at your position it says to me "hopefully the developer all uses '===' instead of '==' in such possible cases".