Skip to content

Commit

Permalink
Original pull request ezsystems#1247
Browse files Browse the repository at this point in the history
  • Loading branch information
pkamps committed Sep 11, 2016
1 parent 30705fa commit d477c40
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/ezutils/classes/ezextension.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,11 +544,20 @@ public static function getHandlerClass( ezpExtensionOptions $options )
// we rely on the autoload system here
if ( class_exists( $handler ) )
{
// only use reflection if we have params to avoid exception on objects withouth constructor
// only use reflection if we have params to avoid exception on objects without constructor
if ( $handlerParams !== null && is_array( $handlerParams ) && count( $handlerParams ) > 0 )
{
$reflection = new ReflectionClass( $handler );
$object = $reflection->newInstanceArgs( $handlerParams );
// detect if class has a constructor, and if not write a notice about that
if ( $reflection->getConstructor() !== null )
{
$object = $reflection->newInstanceArgs( $handlerParams );
}
else
{
eZDebug::writeNotice( 'Constructor is missing but parameters are provided to class ' . $handler . " as defined in setting $iniFile [$iniSection] $iniVariable", __METHOD__ );
$object = new $handler();
}
}
else
{
Expand Down

0 comments on commit d477c40

Please sign in to comment.