Skip to content

Commit

Permalink
Automatic conversion of false to array is deprecated hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Liblastic committed Jan 25, 2023
1 parent 2619651 commit 591a815
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

[unreleased]

[php-81-automatic-conversion-hotfix]
### Fixed
- Fixes "Automatic conversion of false to array is deprecated" on Dust.php

[released]
## [1.38.1]

### Fixed
Expand Down
6 changes: 6 additions & 0 deletions src/Renderer/Dust.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ public function __construct( string $template ) {
public function render( array $fields ) : string {
$compiled = self::$dust->compileFile( $this->template );

// In same cases this might be false.
// We need to set key as an array after PHP 8.1 in these situations.
if ( empty( $fields['data'] ) ) {
$fields['data'] = [];
}

// Pass on the block data
$fields['data']['block'] = $fields['block'];

Expand Down

0 comments on commit 591a815

Please sign in to comment.