Posted by Caffeine Addict on December 7, 2011 at 2:13pm
6 followers
Jump to:
| Project: | Block Class |
| Version: | 7.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
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
#1
<?phpfunction 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.
#2
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:)
#3
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.
#4
I was going to suggest:
<?php$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:
<?php$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.
#5
Automatically closed -- issue fixed for 2 weeks with no activity.