Skip to content
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

PHP Notices, Warnings from direct access ebsco/detailedrecord #21

Open
jameswilson opened this issue Aug 28, 2018 · 0 comments
Open

PHP Notices, Warnings from direct access ebsco/detailedrecord #21

jameswilson opened this issue Aug 28, 2018 · 0 comments

Comments

@jameswilson
Copy link

jameswilson commented Aug 28, 2018

If someone copies/pastes a link to an ebsco detail record page at url: /ebsco/detailedrecord?id=XXXXXXXX a PHP warning and notice are thrown (stack trace below).

This happens when a user who has a link to a detail record does not have an active session with a previous search.

$lastSearch = isset($params['id']) ? $Document->search_read($params['id'], $params['op']) : [];

Oddly, there is protective code in the template_preprocess_ebsco_result() that prevents the record next/previous and back-to-search-list links from displaying when $lastSearch is empty, but this doesn't prevent the search_read() from triggering the warnings.

Probably some similar protective code needs to be added to EBSCODocument class to gracefully handle an un-initialized Session state.

Notice: Undefined index: records in EBSCODocument->search_read() (line 808 of modules/contrib/edsapi-drupal8-plugin/lib/EBSCODocument.php).
EBSCODocument->search_read('XXXXXXXX', 'Next') (Line: 1194)
template_preprocess_ebsco_result(Array, 'ebsco_result', Array) (Line: 284)
Drupal\Core\Theme\ThemeManager->render('ebsco_result', Array) (Line: 437)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 666)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Warning: Invalid argument supplied for foreach() in EBSCODocument->getIndexOfRecordInArrayWithId() (line 926 of modules/contrib/edsapi-drupal8-plugin/lib/EBSCODocument.php).
EBSCODocument->getIndexOfRecordInArrayWithId(NULL, 'XXXXXXXX') (Line: 814)
EBSCODocument->search_read('XXXXXXXX', 'Next') (Line: 1194)
template_preprocess_ebsco_result(Array, 'ebsco_result', Array) (Line: 284)
Drupal\Core\Theme\ThemeManager->render('ebsco_result', Array) (Line: 437)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 666)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
@jameswilson jameswilson changed the title PHP Notices, Warnings from direct access ebsco/detailrecord PHP Notices, Warnings from direct access ebsco/detailedrecord Aug 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant