check if transformer for wp_type exists #8

Closed
opened 2023-12-08 12:26:40 +01:00 by ruru4143 · 2 comments
Owner

Quick summary

If a client request a acitivitystream for an post type with no transformer, it still tries to create an instance for it

Steps to reproduce

  1. create an post with an unsupported post typ
  2. Make an Get request with "Accept": "application/ld+json; profile="https://www.w3.org/ns/activitystreams""
  3. get an 500 Internal Server Error

What you expected to happen

maybe an 404?

What actually happened

A 500 Internal Server error plus an error in the log

Impact

All

Available workarounds?

No but the platform is still usable

Logs or notes

wordpress_1   | [Fri Dec 08 11:17:42.538553 2023] [php:error] [pid 23] [client 172.20.0.1:0] PHP Fatal error:  Uncaught Error: Class name must be a valid object or a string in /var/www/html/wp-content/plugins/activitypub/includes/transformer/class-transformer-factory.php:281
Stack trace:
#0 /var/www/html/wp-content/plugins/activitypub/templates/post-json.php(5): Activitypub\Transformer\Transformer_Factory->transform(Object(WP_Post))
#1 /var/www/html/wp-includes/template-loader.php(106): include('/var/www/html/w...')
#2 /var/www/html/wp-blog-header.php(19): require_once('/var/www/html/w...')
#3 /var/www/html/index.php(17): require('/var/www/html/w...')
#4 {main}
  thrown in /var/www/html/wp-content/plugins/activitypub/includes/transformer/class-transformer-factory.php on line 281
### Quick summary If a client request a acitivitystream for an post type with no transformer, it still tries to create an instance for it ### Steps to reproduce 1. create an post with an unsupported post typ 2. Make an Get request with "Accept": "application/ld+json; profile="https://www.w3.org/ns/activitystreams"" 3. get an 500 Internal Server Error ### What you expected to happen maybe an 404? ### What actually happened A 500 Internal Server error plus an error in the log ### Impact All ### Available workarounds? No but the platform is still usable ### Logs or notes ``` wordpress_1 | [Fri Dec 08 11:17:42.538553 2023] [php:error] [pid 23] [client 172.20.0.1:0] PHP Fatal error: Uncaught Error: Class name must be a valid object or a string in /var/www/html/wp-content/plugins/activitypub/includes/transformer/class-transformer-factory.php:281 Stack trace: #0 /var/www/html/wp-content/plugins/activitypub/templates/post-json.php(5): Activitypub\Transformer\Transformer_Factory->transform(Object(WP_Post)) #1 /var/www/html/wp-includes/template-loader.php(106): include('/var/www/html/w...') #2 /var/www/html/wp-blog-header.php(19): require_once('/var/www/html/w...') #3 /var/www/html/index.php(17): require('/var/www/html/w...') #4 {main} thrown in /var/www/html/wp-content/plugins/activitypub/includes/transformer/class-transformer-factory.php on line 281 ```
Author
Owner

Maybe it's a different bug.

Maybe it's a different bug.
Author
Owner

fixed by commit 31c09cd329

fixed by commit 31c09cd329ee01896b311ac87a6af05f98a5b820
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Event-Federation/wordpress-activitypub#8
No description provided.