E_STRICT notices on audio node creation

Shiny - August 30, 2009 - 22:20
Project:Audio
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:minor
Assigned:Shiny
Status:needs work
Description

notice: Undefined property: stdClass::$audio_tags in /home/br3nda/projects/drupal/sites/all/modules/audio/audio.module on line 816.
notice: Undefined property: stdClass::$audio_images in /home/br3nda/projects/drupal/sites/all/modules/audio/audio.module on line 817.
warning: Invalid argument supplied for foreach() in /home/br3nda/projects/drupal/sites/all/modules/audio/audio.module on line 551.

patch attached

AttachmentSize
0001-fixed-some-E_STRICT-notices.patch1.68 KB

#1

drewish - September 14, 2009 - 04:43
Status:needs review» needs work

Thanks for the patch. Noticed a couple of small issues though.

I think we should probably be using an isset() or !empty() here to avoid the warning rather than is_array():

+  if (is_array($node->audio_tags)) {

shouldn't have a space between isset and the parens:

+    $form_state['values']['audio_tags'] = (isset ($node->audio_tags) ? $node->audio_tags : '');
+    $form_state['values']['audio_images'] = (isset ($node->audio_images) ? $node->audio_images : '');

#2

rajaito - September 29, 2009 - 17:59

oh man... I am getting this error on a fresh install of Drupal 6.14 with Audio 6.x-1.x-dev:

warning: Invalid argument supplied for foreach() in /home/br3nda/projects/drupal/sites/all/modules/audio/audio.module on line 551.

But I have no idea to apply your patch. I looked up patching on Drupal but its a bit beyond my level of expertise. What confuses me, is that I used Audio on another Drupal site on the same server without this error.

 
 

Drupal is a registered trademark of Dries Buytaert.