-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add checks to avoid PHP Notices in Resources code. #233
Add checks to avoid PHP Notices in Resources code. #233
Conversation
PHP message: PHP Notice: Undefined index: orderBy in /var/www/coral/resources/admin/classes/domain/Resource.php on line 805 PHP message: PHP Notice: Undefined index: page in /var/www/coral/resources/admin/classes/domain/Resource.php on line 805 PHP message: PHP Notice: Undefined index: recordsPerPage in /var/www/coral/resources/admin/classes/domain/Resource.php on line 805 PHP message: PHP Notice: Undefined variable: currentPage in /var/www/coral/resources/index.php on line 32 PHP message: PHP Notice: Undefined index: startWith in /var/www/coral/resources/index.php on line 49 PHP message: PHP Notice: Undefined index: name in /var/www/coral/resources/index.php on line 69 PHP message: PHP Notice: Undefined index: resourceISBNOrISSN in /var/www/coral/resources/index.php on line 80 PHP message: PHP Notice: Undefined index: fund in /var/www/coral/resources/index.php on line 92 PHP message: PHP Notice: Undefined index: acquisitionTypeID in /var/www/coral/resources/index.php on line 125 PHP message: PHP Notice: Undefined index: acquisitionTypeID in /var/www/coral/resources/index.php on line 125 PHP message: PHP Notice: Undefined index: acquisitionTypeID in /var/www/coral/resources/index.php on line 125 PHP message: PHP Notice: Undefined index: acquisitionTypeID in /var/www/coral/resources/index.php on line 125 PHP message: PHP Notice: Undefined index: statusID in /var/www/coral/resources/index.php on line 150 PHP message: PHP Notice: Undefined index: statusID in /var/www/coral/resources/index.php on line 150 PHP message: PHP Notice: Undefined index: statusID in /var/www/coral/resources/index.php on line 150 PHP message: PHP Notice: Undefined index: creatorLoginID in /var/www/coral/resources/index.php on line 186 PHP message: PHP Notice: Undefined index: resourceFormatID in /var/www/coral/resources/index.php on line 211 PHP message: PHP Notice: Undefined index: resourceFormatID in /var/www/coral/resources/index.php on line 211 PHP message: PHP Notice: Undefined index: resourceFormatID in /var/www/coral/resources/index.php on line 211 PHP message: PHP Notice: Undefined index: resourceTypeID in /var/www/coral/resources/index.php on line 232 PHP message: PHP Notice: Undefined index: resourceTypeID in /var/www/coral/resources/index.php on line 243 PHP message: PHP Notice: Undefined index: generalSubjectID in /var/www/coral/resources/index.php on line 264 PHP message: PHP Notice: Undefined index: generalSubjectID in /var/www/coral/resources/index.php on line 275 PHP message: PHP Notice: Undefined index: detailedSubjectID in /var/www/coral/resources/index.php on line 295 PHP message: PHP Notice: Undefined index: noteTypeID in /var/www/coral/resources/index.php on line 356 PHP message: PHP Notice: Undefined index: noteTypeID in /var/www/coral/resources/index.php on line 366 PHP message: PHP Notice: Undefined index: noteTypeID in /var/www/coral/resources/index.php on line 366 PHP message: PHP Notice: Undefined index: noteTypeID in /var/www/coral/resources/index.php on line 366 PHP message: PHP Notice: Undefined index: noteTypeID in /var/www/coral/resources/index.php on line 366 PHP message: PHP Notice: Undefined index: noteTypeID in /var/www/coral/resources/index.php on line 366 PHP message: PHP Notice: Undefined index: noteTypeID in /var/www/coral/resources/index.php on line 366 PHP message: PHP Notice: Undefined index: resourceNote in /var/www/coral/resources/index.php on line 382 PHP message: PHP Notice: Undefined index: resourceNote in /var/www/coral/resources/index.php on line 384 PHP message: PHP Notice: Undefined index: createDateStart in /var/www/coral/resources/index.php on line 393 PHP message: PHP Notice: Undefined index: createDateEnd in /var/www/coral/resources/index.php on line 399 PHP message: PHP Notice: Undefined index: purchaseSiteID in /var/www/coral/resources/index.php on line 414 PHP message: PHP Notice: Undefined index: purchaseSiteID in /var/www/coral/resources/index.php on line 424 PHP message: PHP Notice: Undefined index: authorizedSiteID in /var/www/coral/resources/index.php on line 446 PHP message: PHP Notice: Undefined index: authorizedSiteID in /var/www/coral/resources/index.php on line 456 PHP message: PHP Notice: Undefined index: administeringSiteID in /var/www/coral/resources/index.php on line 478 PHP message: PHP Notice: Undefined index: administeringSiteID in /var/www/coral/resources/index.php on line 488 PHP message: PHP Notice: Undefined index: authenticationTypeID in /var/www/coral/resources/index.php on line 508 PHP message: PHP Notice: Undefined index: authenticationTypeID in /var/www/coral/resources/index.php on line 519 PHP message: PHP Notice: Undefined index: authenticationTypeID in /var/www/coral/resources/index.php on line 519 PHP message: PHP Notice: Undefined index: authenticationTypeID in /var/www/coral/resources/index.php on line 519 PHP message: PHP Notice: Undefined index: catalogingStatusID in /var/www/coral/resources/index.php on line 537 PHP message: PHP Notice: Undefined index: catalogingStatusID in /var/www/coral/resources/index.php on line 546 PHP message: PHP Notice: Undefined index: catalogingStatusID in /var/www/coral/resources/index.php on line 546 PHP message: PHP Notice: Undefined index: catalogingStatusID in /var/www/coral/resources/index.php on line 546 PHP message: PHP Notice: Undefined index: stepName in /var/www/coral/resources/index.php on line 568 PHP message: PHP Notice: Undefined index: stepName in /var/www/coral/resources/index.php on line 568 PHP message: PHP Notice: Undefined index: stepName in /var/www/coral/resources/index.php on line 568 PHP message: PHP Notice: Undefined index: stepName in /var/www/coral/resources/index.php on line 568
PHP message: PHP Notice: Undefined variable: currentPage in /var/www/coral/resources/queue.php on line 24
PHP message: PHP Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/coral/resources/templates/header.php:183) in /var/www/coral/resources/admin/classes/common/CoralSession.php on line 25 PHP message: PHP Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/coral/resources/templates/header.php:183) in /var/www/coral/resources/admin/classes/common/CoralSession.php on line 25
PHP message: PHP Notice: Undefined variable: currentPage in /var/www/coral/resources/admin.php on line 24
PHP message: PHP Notice: Undefined variable: currentPage in /var/www/coral/resources/resource.php on line 34 PHP message: PHP Notice: Undefined index: ref in /var/www/coral/resources/resource.php on line 52 PHP message: PHP Notice: Undefined index: workflowID in /var/www/coral/resources/admin/classes/domain/Resource.php on line 1976
PHP message: PHP Notice: Undefined variable: resourceOrganization in /var/www/coral/resources/ajax_forms/getUpdateProductForm.php on line 306 PHP message: PHP Notice: Undefined index: resourceID in /var/www/coral/resources/admin/classes/domain/Resource.php on line 1526
PHP message: PHP Notice: Undefined index: organizationID in /var/www/coral/resources/ajax_forms/getNewDowntimeForm.php on line 4 PHP message: PHP Notice: Undefined index: issueID in /var/www/coral/resources/ajax_forms/getNewDowntimeForm.php on line 7 PHP message: PHP Notice: Undefined offset: 0 in /var/www/coral/resources/admin/classes/domain/Downtime.php on line 67 PHP message: PHP Notice: Undefined index: downtimeTypeID in /var/www/coral/resources/ajax_forms/getNewDowntimeForm.php on line 97 PHP message: PHP Notice: Undefined index: shortName in /var/www/coral/resources/ajax_forms/getNewDowntimeForm.php on line 97
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, except for the one comment I left about the change Downtime.php which seems to break the functionality, unless I'm mistaken.
@@ -64,7 +64,7 @@ public function getDowntimeTypesArray() { | |||
$result = $this->db->processQuery($query, "assoc"); | |||
$names = array(); | |||
|
|||
if (is_array($result[0])) { | |||
if (is_array(isset($result[0]))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see how this would avoid an undefined index error, but it won't work when the index is set either. is_array
will return false with a true or a false result from isset
, so the foreach
loop will never trigger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Thank you. I’ll put in a fix shortly.
I’ve changed the |
Everything looks good to me. I think we can merge this. |
Merging based on the review by @jeffnm. |
I tried the Squash and Merge option on this PR to try and keep the history cleaner, and it doesn’t create a merge commit, which might be what we want. Maybe we should discuss this in an issue. |
Mostly using
isset()
. All original notices are included in the commit messages.Issue #77