Last active
March 5, 2021 02:10
-
-
Save tim-cotten/b009e854ea34afa5f9891113588872a8 to your computer and use it in GitHub Desktop.
PHP Bugs: Confusing Non-Objects for Objects (Example F)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function exchange_send_message_raw($context, $content) | |
{ | |
$location = "https://test.cotten.io/exchange/raw_message.php"; | |
$request = array('direction' => 1, // outgoing | |
'context' => $context, | |
'content' => json_encode($content)); | |
$response = ProxyPostClient::request($location, $request); | |
$response_obj = json_decode($response); | |
if (!empty($response_obj) && isset($response_obj->content)) { | |
print_formatted_log("Exchange Response: Success"); | |
print_formatted_log(json_encode($response_obj)); | |
echo "\n"; | |
} else { | |
print_formatted_log("Exchange Response: Error"); | |
print_formatted_log(json_encode($response_obj)); | |
print_formatted_log($response); // raw text response | |
echo "\n"; | |
} | |
return $response_obj->content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment