Notice: Undefined property: stdClass::$cssclasses in adsense_consent_preprocess_block() (line 257 of adsense_consent.module)

I also get a " Uncaught ReferenceError: Drupal is not defined " running the Mobile Friendly test at https://search.google.com/test/mobile-friendly not that might be related - except after fixing the robots.txt errors, I now get ALL "Other Error" messages even from the advagg module files locations

I am running Apache 2.4.34 latest with 10.2.16-MariaDB - and PHP-FPM and this page shows some issues with this Drupal not defined error https://drupal.stackexchange.com/questions/56940/referenceerror-drupal-i... - I already checked that misc/drupal.js is accessible in the browser

The ads load in Chrome and Firefox desktop browsers, but in UC_Browser on Mobile Android I get the yellow box only for straight javascript code using Content Injector - but in the Adsense User Consent block area I get no yellow box

I created a new issue because of the Notice: Undefined property: stdClass::$cssclasses in adsense_consent_preprocess_block() (line 257 of adsense_consent.module)

Comments

bobburns created an issue. See original summary.

  • JamesOakley committed f61ae9b on 7.x-1.x
    Issue #2990633 Fix missing cssclasses property when associated variable...
jamesoakley’s picture

Status: Active » Fixed

I've pushed a commit that I think should fix

Notice: Undefined property: stdClass::$cssclasses in adsense_consent_preprocess_block() (line 257 of adsense_consent.module)

For the rest, I'm afraid I'm not familiar with Content Injector and the yellow boxes you mention. Could you see if the newly generated -dev release (or applying https://cgit.drupalcode.org/adsense_consent/commit/?id=f61ae9b) fixes it? If not, could you give a simple set of steps to reproduce the remaining problem on a fresh Drupal install.

Of course, if the change doesn't fix the "undefined property" problem, please come back here and let me know.

bobburns’s picture

Thanks - I tried a patch similar like it but had the property_exists function before the isset like this => if property_exists($this, $property) && isset($this->$property); (See https://stackoverflow.com/questions/14414379/php-check-whether-property-...

It did not work - of course yours does

- if (isset($variables['elements']['#block'])) {
+ if (isset($variables['elements']['#block']) &&
+ property_exists($variables['elements']['#block'], 'cssclasses')) {

Now I just need to figure out why Google's javascript ads are not served and load into the mobile version browsers

Status: Fixed » Closed (fixed)

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