Skip to content

Commit

Permalink
Merge pull request #157 from stellarwp/bugix/142/undefined-array-key
Browse files Browse the repository at this point in the history
Bugfix: PHP Warning: Undefined array key 1 in services.php on line 294
lucatume authored Mar 22, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 4463348 + 1b7b206 commit ab66e40
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.4] - 2023-03-21

* Fix - [issue 142](https://github.com/stellarwp/slic/issues/142) ensure the hosts file in the docker container contains a tab character before trying to explode it.

## [1.2.3] - 2023-03-21

* Added - Pass through the [COMPOSER_AUTH](https://getcomposer.org/doc/03-cli.md#composer-auth) environment variable to the slic docker container to allow composer installs for private or otherwise protected dependencies. Especially useful when running in GitHub Actions.
4 changes: 4 additions & 0 deletions src/services.php
Original file line number Diff line number Diff line change
@@ -291,6 +291,10 @@ function add_hosts_to_service( string $service_id, array $hosts ) {

// If a line is already present in the file, do not re-add it.
$new_lines = array_filter( $output, static function ( $line ) use ( $hosts ) {
if ( strpos( $line, "\t" ) === false ) {
return true;
}

list( $ip, $hostname ) = explode( "\t", $line, 2 );

return ! in_array( $hostname, $hosts, true );

0 comments on commit ab66e40

Please sign in to comment.