aboutsummaryrefslogtreecommitdiffhomepage
path: root/Digitigrade/Model/FetchableModel.php
diff options
context:
space:
mode:
Diffstat (limited to 'Digitigrade/Model/FetchableModel.php')
-rw-r--r--Digitigrade/Model/FetchableModel.php5
1 files changed, 2 insertions, 3 deletions
diff --git a/Digitigrade/Model/FetchableModel.php b/Digitigrade/Model/FetchableModel.php
index e091a87..bd25d39 100644
--- a/Digitigrade/Model/FetchableModel.php
+++ b/Digitigrade/Model/FetchableModel.php
@@ -15,9 +15,8 @@ abstract class FetchableModel extends Model implements RemoteFetchable {
protected static function fetchFromRemote(string $uri, bool $autoSave): ?static {
// fetch the object
- $data = @file_get_contents($uri, context: stream_context_create(['http' => [
- 'header' => 'Accept: application/json'
- ]]));
+ // janky hack: if this is an Instance then avoid recursively fetching itself
+ $data = @get_remote_object_authenticated($uri, static::class == Instance::class);
if ($data === false)
return null;
$data = json_decode($data);