Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | 1937616-2-fix-php-notices.patch | 544 bytes | David_Rothstein |
#1 | 1937616-1-fix-php-notices.patch | 504 bytes | cweagans |
Comments
Comment #1
cweagansComment #2
David_Rothstein CreditAttribution: David_Rothstein commentedOne 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.
Comment #3
kmontyI 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!
Comment #4
kmonty