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

Remove suppression of ArgumentCountError exceptions from Gdn_Pluggable #8547

Merged
merged 1 commit into from
Mar 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 7 additions & 43 deletions library/core/class.pluggable.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,7 @@ public function fireEvent($eventName, $arguments = null) {
}

// Look to the PluginManager to see if there are related event handlers and call them
try {
return Gdn::pluginManager()->callEventHandlers($this, $fireClass, $eventName);
} catch (ArgumentCountError $ex) {
if (debug()) {
throw $ex;
}
Logger::event('arg_error', Logger::CRITICAL, $ex->getMessage());
return false;
}
return Gdn::pluginManager()->callEventHandlers($this, $fireClass, $eventName);
}

/**
Expand Down Expand Up @@ -202,52 +194,24 @@ public function __call($methodName, $arguments) {
// Make sure the arguments get passed in the same way whether firing a custom event or a magic one.
$this->EventArguments = $arguments;

// Call the "Before" event handlers.
try {
Gdn::pluginManager()->callEventHandlers($this, $className, $referenceMethodName, 'Before');
} catch (ArgumentCountError $ex) {
if (debug()) {
throw $ex;
}
Logger::event('arg_error', Logger::CRITICAL, $ex->getMessage());
}
// Call the "Before" event handlers
Gdn::pluginManager()->callEventHandlers($this, $className, $referenceMethodName, 'Before');

// Call this object's method
if (Gdn::pluginManager()->hasMethodOverride($className, $referenceMethodName)) {
// The method has been overridden
$this->HandlerType = HANDLER_TYPE_OVERRIDE;
try {
$return = Gdn::pluginManager()->callMethodOverride($this, $this->ClassName, $referenceMethodName);
} catch (ArgumentCountError $ex) {
if (debug()) {
throw $ex;
}
Logger::event('arg_error', Logger::CRITICAL, $ex->getMessage());
}
$return = Gdn::pluginManager()->callMethodOverride($this, $this->ClassName, $referenceMethodName);
} elseif (Gdn::pluginManager()->hasNewMethod($className, $referenceMethodName)) {
$this->HandlerType = HANDLER_TYPE_NEW;
try {
$return = Gdn::pluginManager()->callNewMethod($this, $className, $referenceMethodName);
} catch (ArgumentCountError $ex) {
if (debug()) {
throw $ex;
}
Logger::event('arg_error', Logger::CRITICAL, $ex->getMessage());
}
$return = Gdn::pluginManager()->callNewMethod($this, $className, $referenceMethodName);
} else {
// The method has not been overridden.
$return = call_user_func_array([$this, $actualMethodName], $arguments);
}

// Call the "After" event handlers.
try {
Gdn::pluginManager()->callEventHandlers($this, $className, $referenceMethodName, 'After');
} catch (ArgumentCountError $ex) {
if (debug()) {
throw $ex;
}
Logger::event('arg_error', Logger::CRITICAL, $ex->getMessage());
}
// Call the "After" event handlers
Gdn::pluginManager()->callEventHandlers($this, $className, $referenceMethodName, 'After');

return $return;
}
Expand Down