The ever flaky Xdebug is on the fritz at the mo’ (normal service will be resumed as soon as possible), so I am reduced to “debug by echo”.
echo($path_info['filename'] . ' ' . $licence['issue_timestamp'].'<br>');
if ($path_info['filename'] != $licence['issue_timestamp'])
{
die('They are NOT equal');
$_SESSION['error_messages'][] = 'This licence file has been copied';
return False;
}
else
die('They are equal');
outputs
1319266557_ 1319266557
They are equal
Any idea what I am doing wrong? Is there something special about (trailing) underscores?
The docs state:
And that "type juggling" looks mighty suspicious. Elsewhere on that page, it mentions:
And the example is a dead giveaway as to what’s happening in your case:
In terms of how strings are converted to integers, that can be seen here. The salient bit is (my bold):
That’s why "123_" is equal to "123" (a). Bottom line, use
!==since that ensures both the value and the type are the same.(a) See the online PHP executor:
