Skip to content

Exception when sizes is undefined #121

@ataker

Description

@ataker

Get the following error when my sizes (for some reason) were undefined.

Slim Application Error
The application could not run because of the following error:

Details

Type: ErrorException
Code: 8
Message: Undefined variable: sizes
File: /var/www/html/wordpress/wp-content/plugins/thermal-api/api/v1/controllers/Posts.php
Line: 589
Trace

#0 /var/www/html/wordpress/wp-content/plugins/thermal-api/api/v1/controllers/Posts.php(589): Slim\Slim::handleErrors(8, 'Undefined varia...', '/var/www/html/w...', 589, Array)
#1 /var/www/html/wordpress/wp-content/plugins/thermal-api/api/v1/controllers/Posts.php(337): Voce\Thermal\v1\Controllers\Posts::_format_image_media_item(57)
#2 [internal function]: Voce\Thermal\v1\Controllers\Posts::format(Object(WP_Post), 0, 'read')
#3 /var/www/html/wordpress/wp-content/plugins/thermal-api/api/v1/controllers/Posts.php(35): array_walk(Array, Array, 'read')
#4 [internal function]: Voce\Thermal\v1\Controllers\Posts::find(Object(Slim\Slim))
#5 /var/www/html/wordpress/wp-content/plugins/thermal-api/api/API_Base.php(87): call_user_func_array(Array, Array)
#6 [internal function]: Voce\Thermal\{closure}()
#7 /var/www/html/wordpress/wp-content/plugins/thermal-api/vendor/slim/slim/Slim/Router.php(172): call_user_func_array(Object(Closure), Array)
#8 /var/www/html/wordpress/wp-content/plugins/thermal-api/vendor/slim/slim/Slim/Slim.php(1222): Slim\Router->dispatch(Object(Slim\Route))
#9 /var/www/html/wordpress/wp-content/plugins/thermal-api/vendor/slim/slim/Slim/Middleware/Flash.php(86): Slim\Slim->call()
#10 /var/www/html/wordpress/wp-content/plugins/thermal-api/vendor/slim/slim/Slim/Middleware/MethodOverride.php(94): Slim\Middleware\Flash->call()
#11 /var/www/html/wordpress/wp-content/plugins/thermal-api/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()
#12 /var/www/html/wordpress/wp-content/plugins/thermal-api/vendor/slim/slim/Slim/Slim.php(1174): Slim\Middleware\PrettyExceptions->call()
#13 /var/www/html/wordpress/wp-content/plugins/thermal-api/dispatcher.php(57): Slim\Slim->run()
#14 [internal function]: Voce\Thermal\API_Dispatcher->dispatch_api('')
#15 /var/www/html/wordpress/wp-includes/plugin.php(503): call_user_func_array(Array, Array)
#16 /var/www/html/wordpress/wp-settings.php(374): do_action('wp_loaded')
#17 /var/www/html/wordpress/wp-config.php(104): require_once('/var/www/html/w...')
#18 /var/www/html/wordpress/wp-load.php(37): require_once('/var/www/html/w...')
#19 /var/www/html/wordpress/wp-blog-header.php(12): require_once('/var/www/html/w...')
#20 /var/www/html/wordpress/index.php(17): require('/var/www/html/w...')
#21 {main}

Taking a look in controllers/Posts.php, it's easy to see that $sizes is defined in an if statement and then used outside of it. I've fixed this for myself, but I'm sure should be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions