Skip to content

Commit

Permalink
Allow for the fact $this->plugins_locked is an object
Browse files Browse the repository at this point in the history
Before: we were trying to loop through `$this->plugins_locked` as if it
was an array (as previously we'd been using `foreach` with key/value
pairs). However, it's actually an object, and foreach-ing an object
produces a key-value array of the visible properties of that object.

Now: we use get_object_vars to get the visible properties as an array,
then use array_keys on that.
  • Loading branch information
RobjS committed Oct 4, 2023
1 parent 5a8438e commit d481fdc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Modules/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function install($internal = false)
$gitignore = new \Dxw\Whippet\Git\Gitignore($this->project_dir);
$ignores = $gitignore->get_ignores();

foreach (array_keys($this->plugins_locked) as $dir) {
foreach (array_keys(get_object_vars($this->plugins_locked)) as $dir) {
$plugin_dir = "/wp-content/plugins/" . strval($dir) . "\n";

if (array_search($plugin_dir, $ignores) === false) {
Expand Down

0 comments on commit d481fdc

Please sign in to comment.