Forums

Errors on lines 815 and 853 of scissors/scissors.php (3 posts)

  1. sgmx
    Member
    Posted 5 months ago #

    I've begun to notice error messages on any of the media listing pages (in the library and in the "insert image into post" screens). This is a recent occurrence (within the last week or so) and seems to fit withing the timeframe of the latest upgrade of the Scissors plugin. I've tried rolling back to previous versions of Scissors, but have been getting the same errors.

    I did some sorting through the code, which led me to finding that the data in the postmeta table is incomplete for any of the records providing the errors. The "sizes" array in the serialized data is missing (I inherited the site, and it appears that no thumbnails were created in the timeframe before I took over).

    I'm not sure at this point if the best bet is to recreate all of the serialized data (which, because we're running MU, would be very time consuming), rewrite the lines of code throwing the errors (which would just ignore the problem instead of fixing it), or if there is another avenue that I haven't discovered yet.

    Any ideas would be greatly appreciated.

  2. stephanreiter
    Member
    Posted 5 months ago #

    I think the best way to approach this problem is to add checks to the code to test whether 'sizes' exists or not. From my point of view it's valid to have media for which no intermediate images have been created.

    Get the latest development version. The issue should be fixed there ...

  3. sgmx
    Member
    Posted 5 months ago #

    Sorry for the delay in response. The dev build didn't quite fix the problem, but it pointed me in the right direction to find the fix.

    Where you had put the isset($metadata['sizes']) I replaced it with is_array($metadata). For some reason, without the sizes term defined in the data, the wp_get_attachment_metadata() function returns a string instead of an array.

    I resolved the "division by 0" problem that was showing up on line 850 by just throwing in if(isset($width)&&isset($height)).

    I don't think that either of my solutions adequately fix the real problem (which I definitely think is our data), but it is giving us functionality for now.

Reply

You must log in to post.

About this Topic

Tags