Open schlessera opened 4 years ago
Yes, the second argument is required. Here is how I fixed it in another plugin:
diff --git a/src/Plugin.php b/src/Plugin.php
index b51910c..d9f79cd 100644
--- a/src/Plugin.php
+++ b/src/Plugin.php
@@ -165,7 +165,12 @@ public function meta( $field = null ) {
static $meta;
if ( ! isset( $meta ) ) {
- $meta = get_file_data( $this->file );
+ $meta = get_file_data(
+ $this->file,
+ array(
+ 'Version' => 'Version',
+ )
+ );
}
if ( isset( $field ) ) {
We could also remove the static cache wrapper and pass the lookup field to get_file_data()
.
The following line throws a fatal error in PHP 7.4+:
https://github.com/xwp/block-scaffolding-wp/blob/412029a0be0f9b08468c195a985a2c4131415ffc/php/Plugin.php#L172
As can be seen in the documentation for
get_file_data()
, the second argument$default_headers
is not optional and has to be provided.