actions.inc: Undefined index: configurable on line 267

eMPee584 - October 13, 2008 - 16:16
Project:Drupal
Version:7.x-dev
Component:base system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:by design
Description

At least the user_stats and the backup_migrate modules give an action array as parameter without the index 'configurable' set. Replacing the boolean comparision with empty fixes the php errors caused by this.

AttachmentSize
actions-fix-undefined-index-configurable.patch612 bytes

#1

earnie - October 13, 2008 - 22:58
Version:6.x-dev» 7.x-dev
Status:patch (code needs review)» patch (code needs work)

This should be patched in HEAD first but you need to keep the !$array['configurable'] so it should read

<?php
if (empty($array['configurable']) || !$array['configurable']) {
  ...
}
?>

#2

Dave Reid - October 13, 2008 - 23:06

According to the API docs (http://api.drupal.org/api/function/hook_action_info/7), 'configurable': (required). We should not be doing this check for incorrect implementations. Or correct the api docs that the parameter is not required.

#3

eMPee584 - October 14, 2008 - 02:00

regarding the first comment, if i get it correctly,

<?php
empty($foo)
?>
equals
<?php
!isset($foo) || !$foo
?>
so that's redundant..
anyways thx dave for looking it up you're definitly right i will redirect appropiate one-liners to the violating modules... right after some sleep ^^

#4

earnie - October 14, 2008 - 12:02

You're correct. Forgive the noise.

#5

Dave Reid - October 14, 2008 - 17:39
Status:patch (code needs work)» by design

I'll mark this as 'by design' then.

 
 

Drupal is a registered trademark of Dries Buytaert.