ctsit / project_ownership

A REDCap module to aid in the collection and management of project ownership details.
Other
2 stars 7 forks source link

Bug with PHP 7.1+ #26

Closed pbchase closed 5 years ago

pbchase commented 6 years ago

Rob Taylor reports

Fatal error: Uncaught ArgumentCountError: Too few arguments to function Projec
tOwnership\ExternalModule\ExternalModule::redcap_every_page_before_render(), 0
passed and exactly 1 expected in C:\xampp\htdocs\redcap_standard\modules\proje
ct_ownership_v1.2.1\ExternalModule.php:23 Stack trace: #0 [internal function]:
ProjectOwnership\ExternalModule\ExternalModule->redcap_every_page_before_rende
r() #1 C:\xampp\htdocs\redcap_standard\codebase\ExternalModules\classes\Extern
alModules.php(1309): call_user_func_array(Array, Array) #2 C:\xampp\htdocs\red
cap_standard\codebase\ExternalModules\classes\ExternalModules.php(1392):
ExternalModules\ExternalModules::startHook('project_ownersh...', 'v1.2.1',
Array) #3 C:\xampp\htdocs\redcap_standard\codebase\Classes\Hooks.php(37):
ExternalModules\ExternalModules::callHook('every_page_befo...', Array) #4
C:\xampp\htdocs\redcap_standard\codebase\Classes\System.php(480):
Hooks::call('redcap_every_pa...') #5
C:\xampp\htdocs\redcap_standard\codebase\Config\init_global.php(9):
System::initGlobalPage in C:\xampp\htdocs\redcap_standard\modules\project_owne
rship_v1.2.1\ExternalModule.php on line 23
REDCap crashed due to an unexpected PHP fatal error!

Error message: Uncaught ArgumentCountError: Too few arguments to function Proj
ectOwnership\ExternalModule\ExternalModule::redcap_every_page_before_render(),
0 passed and exactly 1 expected in C:\xampp\htdocs\redcap_standard\modules\pro
ject_ownership_v1.2.1\ExternalModule.php:23 Stack trace: #0 [internal
function]: ProjectOwnership\ExternalModule\ExternalModule->redcap_every_page_b
efore_render() #1 C:\xampp\htdocs\redcap_standard\codebase\ExternalModules\cla
sses\ExternalModules.php(1309): call_user_func_array(Array, Array) #2 C:\xampp
\htdocs\redcap_standard\codebase\ExternalModules\classes\ExternalModules.php(1
392): ExternalModules\ExternalModules::startHook('project_ownersh...',
'v1.2.1', Array) #3
C:\xampp\htdocs\redcap_standard\codebase\Classes\Hooks.php(37):
ExternalModules\ExternalModules::callHook('every_page_befo...', Array) #4
C:\xampp\htdocs\redcap_standard\codebase\Classes\System.php(480):
Hooks::call('redcap_every_pa...') #5
C:\xampp\htdocs\redcap_standard\codebase\Config\init_global.php(9):
System::initGlobalPage
File: C:\xampp\htdocs\redcap_standard\modules\project_ownership_v1.2.1\ExternalModule.php
Line: 23

Further, Rob says

On Jul 12, 2018, at 2:05 PM, Taylor, Rob <xxxxx@yyyyy> wrote:

Sorry, I should have provided that info. I tested it on PHP 7.2. But thinking
about it now, I think it’s related to PHP 7.1+, which is when I’ve seen that
issue in the past.

Rob Taylor
REDCap Development Team - Senior Developer (http://projectredcap.org)
Vanderbilt Institute for Clinical and Translational Research (VICTR)
marlycormar commented 6 years ago

I'm unable to reproduce this issue. Tested _project_ownershipv1.2.1 on redcap_v8.7.1 with php7.1 & php7.2. In both instances no errors are produced. It would be useful to know the RC version used, as wells as steps to reproduce the issue.

As a side note, this seems to be RC-php related and not specific to this module. The function _redcap_every_page_beforerender is being called with no arguments. Similar issues have appeared before (see RC community issues #12148, #15333, #16302). All those issues have been fixed by the RC support team. As a temporarily solution, setting a default value for _projectid as so redcap_every_page_before_render($project_id=null) was proposed.

pbchase commented 6 years ago

@marlycormar, please implement your proposal so we can test this.