Home > Forum > General discussion/Presale questions > Site Discussion > Undefined offset 0 quiz.php line 401
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Undefined offset 0 quiz.php line 401

Undefined offset 0 quiz.php line 401 1 year 11 months ago #25520

  • James
  • James's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0
Hi,

Another Notice so not necessarily a problem
Notice: Undefined offset: 0 in C:\.........\components\com_joomlaquiz\models\quiz.php on line 401
This line is using the list function to assign a result to a single variable which as it stands looks a bit overkill however there might be a reason for this or it could be legacy or future expansion.

The function being called is the JEventDispatcher trigger which returns an array of results so we have changed it to not do anything on an empty array of results and therefore doesn't complain about an undefined offset, otherwise we take the first array element.
list($processed_desc) = $dispatcher->trigger('onQuizCustomFieldsRender', array($quiz_params->c_description));
if($processed_desc) $quiz_params->c_description = $processed_desc;
if(!empty($processed_desc = $dispatcher->trigger('onQuizCustomFieldsRender', array($quiz_params->c_description)))) $quiz_params->c_description = $processed_desc[0];
Last Edit: 1 year 11 months ago by James. Reason: Needs to be moved to Joomla Quix Deluxe Category please
The administrator has disabled public write access.
  • Page:
  • 1
Time to create page: 0.149 seconds