Closed AlfredoRamos closed 6 years ago
Currently the php_exporter class checks for exactly array() for the event $vars variable.
php_exporter
array()
$vars
https://github.com/phpbb/epv/blob/2797678c7d4cabe915445bbf2ee643e9b9179666/src/Events/php_exporter.php#L284
https://github.com/phpbb/epv/blob/2797678c7d4cabe915445bbf2ee643e9b9179666/src/Events/php_exporter.php#L313
So using the short array syntax ([], PHP >= 5.4) throws an error.
[]
Fatal error: Can not find '$vars = array();'-line for event '{EVENT}' in file '{FILE}:{LINE}'. Are you using UNIX style linefeeds?
This works:
/** * Sample event. * * @event vendor.extension.event_name * @var int var1 * @var array var2 * @since 1.0.0 */ $vars = array( 'var1', 'var2', ); extract($this->dispatcher->trigger_event('vendor.extension.event_name', compact($vars)));
This gives the fatal error:
/** * Sample event. * * @event vendor.extension.event_name * @var int var1 * @var array var2 * @since 1.0.0 */ $vars = [ 'var1', 'var2', ]; extract($this->dispatcher->trigger_event('vendor.extension.event_name', compact($vars)));
Both examples are using a valid PHP code and considering that phpBB 3.2.x requires at least PHP 5.4, it should support the short syntax.
This was already fixed in the phpBB core and needs to be updated in EPV. See https://github.com/phpbb/phpbb/pull/4877 and https://github.com/phpbb/phpbb/pull/4988
Currently the
php_exporter
class checks for exactlyarray()
for the event$vars
variable.https://github.com/phpbb/epv/blob/2797678c7d4cabe915445bbf2ee643e9b9179666/src/Events/php_exporter.php#L284
https://github.com/phpbb/epv/blob/2797678c7d4cabe915445bbf2ee643e9b9179666/src/Events/php_exporter.php#L313
So using the short array syntax (
[]
, PHP >= 5.4) throws an error.This works:
This gives the fatal error:
Both examples are using a valid PHP code and considering that phpBB 3.2.x requires at least PHP 5.4, it should support the short syntax.