small error in condition, result: warning: array_key_exists() - fix attached

vpiotr - June 16, 2008 - 18:41
Project:Custom review
Version:5.x-2.0-1
Component:Code
Category:bug report
Priority:critical
Assigned:Striky2
Status:closed
Description

There is a small error in condition in custom_review_form_alter():

Error message:

warning: array_key_exists() [function.array-key-exists]:
The first argument should be either a string or an integer in
/home/x/public_html/modules/custom_review/custom_review.module on line 177

Solution - change:

  $short_type = substr($form_id, 0, -10); // 'short_type_node_form' => 'short_type'
  if (array_key_exists($short_type, $custom_review_reviewers)) {

to:

  $short_type = substr($form_id, 0, -10); // 'short_type_node_form' => 'short_type'
  if (!empty($short_type) && array_key_exists($short_type, $custom_review_reviewers)) {

#1

Striky2 - June 16, 2008 - 19:00
Priority:normal» critical
Assigned to:Anonymous» Striky2

Wow nice! I'll do my best to change that today. Thx! Btw, if you want to become co-maintainer of the module, feel free to ask! I'm seeing that people are interested in the way it works, so it can be great if we help each other on the module.

And I now get why I didn't see it... I was testing the module on an environment where warning logs were deactivated :)... oops!

#2

Striky2 - June 17, 2008 - 14:16
Status:active» fixed

fixed in DRUPAL-5--2-1-1. thx again

#3

Striky2 - June 17, 2008 - 14:16

#4

Striky2 - June 19, 2008 - 02:01
Status:fixed» closed

other error :

$short_type = substr($form_id, 0, -10); // 'short_type_node_form' => 'short_type'
if (!empty($short_type) && !empty($short_type) && array_key_exists($short_type, $custom_review_reviewers)) {

 
 

Drupal is a registered trademark of Dries Buytaert.