If the preg_match_all() conditional at the top of _caption_filter_get_width() fails to find an img or object tag, the $width variable never gets defined, causing the two uses of it at the end of the function to generate the following errors:

Notice: Undefined variable: width in _caption_filter_get_width() (line 117 of caption_filter.module).
Notice: Undefined variable: width in _caption_filter_get_width() (line 121 of caption_filter.module).

An easy fix would be to add an else { $width = NULL; } after that first conditional at line 113.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cweagans’s picture

Status: Active » Needs review
FileSize
504 bytes
David_Rothstein’s picture

One slight issue with that though is that in the code that runs above it, $width can be a string, so this will result in that being overwritten with NULL.

Here's a new patch that just sets $width to NULL at the top of the function instead.

kmonty’s picture

Status: Needs review » Closed (fixed)

I implemented slightly different code than in the second patch (defined width as "auto", per CSS defaults), but thanks for the patches + help on the issue!

kmonty’s picture

Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.