Skip to content

Validation error on CollectionPage #31

@Crell

Description

@Crell

I am trying to build out Mastodon support for an application, and running into a validation error I cannot explain.

Here's the code:

$server new Server([
    'ontologies' => [
        // I'm building out the ontology class based on the error messages I get.
        'mastodon' => MastodonOntology::class,
    ]
]);

// This works (after I create an extended Person and a PropertyValue)
$actor = $this->server->actor('crell@phpc.social');

$outbox = $this->server->outbox('crell@phpc.social');

$pages = [];

// This fails.
$page = $outbox->getPage($outbox->get()->first);

Specifically, the error comes from Util::hasProperties(), which is called with an array for $item instead of an object. (The method really needs better native types.) That makes the property_exists() call fail with a type error. After some debugging, I have determined it's being called with this array:

[
  'type' => 'CollectionPage',
  'next' => 'https://phpc.social/users/Crell/statuses/...',
  'partOf' => 'https://phpc.social/users/Crell/statuses/...',
  'items' => [],
]

Which... doesn't make sense, as CollectionPage is a built-in supported type, so I have no idea how it's still an array at that point.

I've hit a wall on debugging at this point. Any help on what's going on? There's like 10 stack layers between my code and where the error is, and I have on idea where the issue is.

(I'm quite open to submitting the Mastodon ontology as a PR once I have it working, if there would be interest.)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestquestionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions