sshambar / ExternalAuth

Piwigo plugin that supports login via webserver provided identity
https://piwigo.org/ext/extension_view.php?eid=894
GNU General Public License v2.0
5 stars 2 forks source link

Immediately throws an exception #1

Closed hdholm closed 4 years ago

hdholm commented 4 years ago

https://example.com/piwigo/admin.php?page=plugin-ExternalAuth results in

Fatal error: Uncaught Error: Call to undefined function array_key_first() in /piwigo/plugins/ExternalAuth/admin.php:112 Stack trace: #0 /piwigo/plugins/ExternalAuth/admin.php(402): ExternalAuthAdmin->get_tab() #1 /piwigo/include/functions_plugins.inc.php(264): ExternalAuthAdmin->add_layout() #2 /piwigo/include/page_header.php(84): trigger_notify('loc_end_page_he...') #3 /piwigo/admin.php(320): include('/...') #4 {main} thrown in /piwigo/plugins/ExternalAuth/admin.php on line 112

The obvious reason for this is that array_key_first() is described by https://www.php.net/manual/en/function.array-key-first.php as (PHP 7 >= 7.3.0) and I'm only running PHP: 7.2.27-6+ubuntu16.04.1+deb.sury.org+1 (which is limited by my current hosting provider.)

https://piwigo.org/doc/doku.php?id=user_documentation:learn:install:before shows the requirements for Piwigo as PHP 5.3 (recommended 7.0 or 7.1) so 7.3 is kind of a stretch. If the minimum were bumped, all the cruft from pwg_password_hash could be removed, so it looks like there's no push to increase the minimum, certainly not to 7.3. There are some workarounds in the comments on https://www.php.net/manual/en/function.array-key-first.php.

sshambar commented 4 years ago

My bad! I had even gone through and checked for PHP compatibility, and then added that silly optimization afterwards haha...

v0.3.0 should fix the issue.