I see the following error notice on a Pressflow site:

Notice: Undefined index: type in node_gallery_hierarchy_form_alter() (line 202 of /opt/drupal/6/modules/node_gallery_hierarchy/node_gallery_hierarchy.module).

though regular Drupal 6 site on the same server doesn't output such notice. The discussion on http://groups.drupal.org/node/170339 suggests

Pressflow uses the more strict PHP E Notice - by default... great for revealing issues!

Changing line 202 from

if (in_array($form['type']['#value'], (array)node_gallery_get_types('gallery'))) {

to

if (in_array(isset($form['type']['#value']), (array)node_gallery_get_types('gallery'))) {
 

takes care of the issue.

However, I wanted to be sure if that was the correct approach to address the issue and so reporting this here.

http://drupal.org/node/1063684, http://drupal.org/node/984006#comment-3772862 suggest suppressing the notices, but I really like addressing the error notices instead of suppressing even though they were just notices.

Comments

scroogie’s picture

It should probably be

if (isset($form['type']['#value']) && 
    in_array($form['type']['#value']), (array)node_gallery_get_types('gallery'))) {
...
}

Otherwise the return code of isset() (true/false) is searched in the array instead of the form type value.

yngens’s picture

Unfortunately, your code produces "HTTP Error 500 "


if (isset($form['type']['#value']) && in_array($form['type']['#value'], (array)node_gallery_get_types('gallery'))) {

continues to give the same error notice.

scroogie’s picture

Hi yngens,

I didn't see that its already the "form" element thats missing. Although I guess that shouldn't happen, you'd need to check both:

if (isset($form['type']) && isset($form['type']['#value']) && in_array($form['type']['#value'], (array)node_gallery_get_types('gallery'))) {
scroogie’s picture

Project: Node Gallery » Node Gallery Hierarchy
Version: 6.x-3.2 » 6.x-1.x-dev

changed tracker. Note that the 6.3.x branch of NG and NGH is not really maintained anymore.

yngens’s picture

too much hassle to make all the modules work with pressflow, so decided to switch to regular durpal 6. thanks anyway!

yngens’s picture

Issue summary: View changes

added