Fixed crash from broken plugin loaded hook input from global

Fixes #35
This commit is contained in:
Andrey Savchenko committed 2019-07-02 14:46:13 +03:00
1 parent e2f85f44d2
commit 54ba716ba8
2 files changed
+11 -1

No files matched your search

+3
View File
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Unreleased ## Unreleased
### Fixed
- crash from broken plugin loaded hook input from global
## 3.3 - 2019-03-27 ## 3.3 - 2019-03-27
### Added ### Added
@@ -32,9 +32,16 @@ class Plugin_Load_Collector implements Record_Collector_Interface {
* *
* @param string $plugin Plugin file path. * @param string $plugin Plugin file path.
*/ */
public function plugin_loaded( string $plugin ): void { public function plugin_loaded( $plugin ): void {
$time = microtime( true ); $time = microtime( true );
if ( ! is_string( $plugin ) ) { // Broken hook input from global.
$this->last = $time;
return;
}
$this->entries[] = [ $this->entries[] = [
'name' => $plugin, 'name' => $plugin,
'origin' => $this->last, 'origin' => $this->last,