Download & Extend

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

Project:Custom review
Version:5.x-2.0-1
Component:Code
Category:bug report
Priority:critical
Assigned:Striky2
Status:closed (fixed)

Issue Summary

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)) {

Comments

#1

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

Status:active» fixed

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

#3

#4

Status:fixed» closed (fixed)

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)) {

nobody click here