Strict warning: Creating default object from empty value in block_class_form_alter() (line 27 of C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\drupal-ash-dev\sites\all\modules\block_class\block_class.module).

The above error appears on a clean install on windows 7 / apache 2.2.21 / php 5.3.8 / drupal 7.10 inside Structure - Blocks - Configure at the top.

Comments

Caffeine Addict’s picture

function block_class_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'block_admin_configure' || $form_id == 'block_add_block_form') {
    $block = new stdClass(); //added line
    $block->module = $form['module']['#value'];
    $block->delta = $form['delta']['#value'];
    $css_class = block_class($block);

Added setting of block as an object of php standard class to solve.

Morpheus0101’s picture

Category: bug » support
Priority: Normal » Critical

After installing, I am getting the same strict warning message. Caffeine Addict seems to have solved it. How do I apply these changes. I would really appreciate someones help (i am not a programmer so please explain in simple terms). Thanks:)

Booranger’s picture

Edit block_class.module in notepad.

At about line 25 paste in Caffeine addicts code.

before:

function block_class_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'block_admin_configure' || $form_id == 'block_add_block_form') {
    $block->module = $form['module']['#value'];
    $block->delta = $form['delta']['#value'];
    $css_class = block_class($block);

after:

function block_class_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'block_admin_configure' || $form_id == 'block_add_block_form') {
    $block = new stdClass(); //added line
    $block->module = $form['module']['#value'];
    $block->delta = $form['delta']['#value'];
    $css_class = block_class($block);

Save the file.

alan d.’s picture

Category: support » bug
Priority: Critical » Normal
Status: Active » Fixed

I was going to suggest:

    $block = (object) array(
      'module' => $form['module']['#value'],
      'delta' => $form['delta']['#value'],
    );
    $css_class = block_class($block);

But the latest GIT version is already fixed via:

    $block = new stdClass;
    $block->module = $form['module']['#value'];
    $block->delta = $form['delta']['#value'];
    $css_class = block_class($block);

Either chance it with the latest GIT / dev version or ping the maintainer to do a new release.

Status: Fixed » Closed (fixed)

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