Skip to content

Instantly share code, notes, and snippets.

@tim-cotten
Created March 4, 2021 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tim-cotten/7dc94b110f1a65878a55a6519260bcf5 to your computer and use it in GitHub Desktop.
Save tim-cotten/7dc94b110f1a65878a55a6519260bcf5 to your computer and use it in GitHub Desktop.
PHP Bugs: Confusing Non-Objects for Objects (Example C)
<?php
// ... Missile Command API called ...
$api_result = "{launch_verification:false,msg:'abort'}";
$result = json_decode($api_result);
if (isset($result->launch_verification) && $result->launch_verification == true) {
echo "Launching nuclear missiles.";
launch_missiles();
exit();
}
echo "Terminating launch sequence.";
// Output:
// Terminating launch sequence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment