Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Notice: Undefined index: class in ais_preprocess_image() (line 204 of C:\xampp\htdocs\playground2\sites\all\modules\ais\ais.module).
Comment | File | Size | Author |
---|---|---|---|
#19 | ais-undefined_index_fix-1370186-18.patch | 871 bytes | DigitalFrontiersMedia |
#6 | Undefined index line 204.png | 128.1 KB | steve65140 |
Comments
Comment #1
spotzero CreditAttribution: spotzero commentedNotice could occur if your theme doesn't add any css classes to your images.
Fixed in the dev branch.
Comment #2
spotzero CreditAttribution: spotzero commentedClosing issue.
Comment #3
JohnAlbinYour fix did not work. See http://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_ima...
For one thing, you would still get an "undefined index: class" notice. You are now using it twice; you should have checked if it existed first.
Also, the $variables['attributes']['class'] is actually an array, not a string. (Though the docs don't show this well.)
What you should be doing is appending your class to the end of the list of existing classes. If the "class" array doesn't exist previously, that code will also have the advantage of creating the array without generating any errors/notices.
Comment #4
spotzero CreditAttribution: spotzero commented[attributes][class] should totally be an array, not a string. I've updated the 7.x-1.x branch to reflect this.
Thanks JohnAlbin!
Comment #5
spotzero CreditAttribution: spotzero commentedComment #6
steve65140 CreditAttribution: steve65140 commentedHi,
I've just followed the excellent documentation on http://coldfrontlabs.ca/blog/creating-responsive-image-slider-galleries-... to build my first Flex Slider based on AIS.
I've loaded 3 pictures on a node. When I then view the node the first two pictures are shown OK then just the side arrows and 3 dots but no third picture. I then get the error message in the title of this issue.
Please see screen shot.
Please let me know if there's anything else I can provide to help get this fixed.
Comment #7
minorOffense CreditAttribution: minorOffense commentedThis isn't an issue with ais, it was a bug with Flex Slider. See issue #1509102: slideToStart value set to string '0' instead of integer 0. It should now fixed in the RC. If you have any other issues with Flex Slider, feel free to drop it in the issue queue over there and I'll have a look.
Thanks!
Comment #8
nflowers1228 CreditAttribution: nflowers1228 commentedI'm having the same problem and I have the most current versions of Flex Slider and Adaptive Image Styles. Not sure where to post to get help.
Notice: Undefined index: class in ais_preprocess_image() (line 204 of /home5/sitename/public_html/drupal7/sites/all/modules/ais/ais.module).
Comment #9
spotzero CreditAttribution: spotzero commentedThis issue is currently only fixed in the dev branch. I'll be rolling a 1.1 release soon however.
Comment #10
onehandsomedog CreditAttribution: onehandsomedog commentedI just updated to the newest dev version and the 'Notice: Undefined index: class in ais_preprocess_image() (line 205' problem came back. I also tried the newest recommended release and have the same issue. Any ideas? Also, I noticed the 'adaptive' class has a single space preceding it in the markup.
Comment #11
selinav CreditAttribution: selinav commented+1
Comment #12
jordiserratosa CreditAttribution: jordiserratosa commented+1
Comment #13
s_u_s_a_f_o_n CreditAttribution: s_u_s_a_f_o_n commentedHi guys, thanks for your hard work. I've checked the code around the line 205 of dev version of ais.module file, found logical error. I guess, it would be better to replace the following code:
with:
Comment #14
kingfisher64 CreditAttribution: kingfisher64 commented#13 works great - thanks
Comment #15
spotzero CreditAttribution: spotzero commentedPushed the fixed into the dev branch.
Comment #16
DigitalFrontiersMediaUpdated to latest ais-7.x-1.x-dev (Last packaged version: 7.x-1.1+1-dev, Last updated: May 17, 2012 - 19:02) and still getting this error:
One error for each adaptive image on the page.
Comment #17
kingfisher64 CreditAttribution: kingfisher64 commentedCan confirm this. Don't know what's going on as #13 fixed the problem then out of the blue the error has returned? Strange.
Comment #18
s_u_s_a_f_o_n CreditAttribution: s_u_s_a_f_o_n commentedThe problem remains due to wrong / insufficient IF clause:
if (!isset($variables['attributes']['class']) or !is_array($variables['attributes']['class']))
should be:
if (!isset($variables['attributes']['class']) && !is_array($variables['attributes']['class']))
replace "or" and with "&&", so #13 should be ok.
Comment #19
DigitalFrontiersMediaI think the code (even the proposed patch) is flawed. I believe it should be:
Comment #20
kingfisher64 CreditAttribution: kingfisher64 commentedYep #18 solves the issue. Think I must have copied that fix into another install of the mod and not changed or to &&. Many thanks s_u_s_a_f_o_n
Comment #21
DigitalFrontiersMedias_u_s_a_f_o_n snipes me while I'm building a patch! :-D
My thinking on my version was that it might be possible for one to wipe out the values entirely if the variable is set but it's not an array with earlier proposed method (instead of recasting it).
Comment #22
s_u_s_a_f_o_n CreditAttribution: s_u_s_a_f_o_n commentedDigitalFrontier is right, his latest patch provided in #19 is much safer!
Comment #23
spotzero CreditAttribution: spotzero commentedThe 'or' definitely needed to be an 'and', but Digital's patch is a complete fix, so I've committed it to dev.
Please report if the latest dev clears the warning, if so I'll roll a release 1.2 and hopefully close this issue once and for all :D
Comment #24
lameei CreditAttribution: lameei commented@spotzero I confirm that Dev clears the warning.
Comment #25
s_u_s_a_f_o_n CreditAttribution: s_u_s_a_f_o_n commentedI can confirm that, too.
Comment #26
spotzero CreditAttribution: spotzero commentedTagged release 7.x-1.2 with the fix for this issue.