By upgrading to PHP5.4.6 on the server comes this error:
Warning: Creating default object from empty value in groundwork_preprocess_html () (line 16 of xx/sites/all/themes/groundwork/groundwork/inc/template.process.inc).

Line 16 = $variables['rdf']->version = 'version="HTML+RDFa 1.1"';

How to fix this?

CommentFileSizeAuthor
#2 groundwork_preprocess_html.png6.51 KBwismbuh
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Ole Martin’s picture

Using negosyante 7.x-1.0

wismbuh’s picture

Title: Error with PHP 5.4.6 » Error with PHP 5.3.8
Version: 7.x-1.2 » 7.x-1.3
Assigned: Unassigned » wismbuh
FileSize
6.51 KB

me too gan,

Strict warning: Creating default object from empty value in groundwork_preprocess_html() (line 16 of C:\xampp\htdocs\pks\sites\all\themes\groundwork\inc\template.process.inc).

My Envi:
D7.19
PHP5.3.8
Negosyante 7.x-1.0
Groundwork 7.x-1.3

and, Only on home this warning not shown...
please help

javamonkey’s picture

Newer versions of PHP are stricter so objects need to be declared (created) before using them. I don't know if this will be the solution the developer of this project will take but for the moment I solved it on my site by adding a line in two places to create the object. So far it works, no error reported and nothing broken elsewhere. Try it at your own risk.

Edit \sites\all\themes\groundwork\inc\template.process.inc and insert the line where I indicate:

 if (module_exists('rdf')) {
    $variables['doctype'] = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML+RDFa 1.1//EN">' . "\n";
// Javamonkey added next line to comply with newer PHP standards
    $variables['rdf']= new stdClass();
    $variables['rdf']->version = 'version="HTML+RDFa 1.1"';
    $variables['rdf']->namespaces = $variables['rdf_namespaces'];
    $variables['rdf']->profile = ' profile="' . $variables['grddl_profile'] . '"';
  }
  else {
    $variables['doctype'] = '<!DOCTYPE html>' . "\n";
// Javamonkey added next line to comply with newer PHP standards
    $variables['rdf']= new stdClass();
    $variables['rdf']->version = '';
    $variables['rdf']->namespaces = '';
    $variables['rdf']->profile = '';
  }

It is added twice so it works with both sides of the if/else condition. You could add it just once above the if/else test but I decided to put it right where the error happens as my temporary solution.