[wp-trac] [WordPress Trac] #50864: Handling readme.txt file in validate_theme_requirements function
WordPress Trac
noreply at wordpress.org
Thu Aug 6 16:17:23 UTC 2020
#50864: Handling readme.txt file in validate_theme_requirements function
-----------------------------+------------------------------
Reporter: tmatsuur | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses:
-----------------------------+------------------------------
Comment (by tmatsuur):
Thanks @SergeyBiryukov
| So maybe complicating the fallback check is not worth it.
I agree with you on this.
However, I think that the current source code will behave differently
depending on the OS.
If README.txt exists in the theme directory, README.txt will be read on
Windows OS, but README.txt should not be read on most other OSes.
What are your thoughts on this?
----
Also, I am concerned about the part where the arrays are merged.
For example, create a small theme and write the following at the beginning
of style.css.
{{{
/*
Theme Name: Twenty Twenty Child
Description: Twenty Twenty Child Theme
Template: twentytwenty
Requires at least: WordPress 5.5.0
Version: 0.0.1
*/
}}}
The beginning of readme.txt is as follows:
{{{
=== Twenty Twenty Child ===
Contributors: the WordPress team
Requires PHP: 5.6.0
Tested up to: 5.5
Stable tag: 1.0
}}}
Now when you call the validate_theme_requirements function, the contents
of $requirements before the merge are as follows:
{{{
array(2) {
["requires"]=>
string(15) "WordPress 5.5.0"
["requires_php"]=>
string(0) ""
}
}}}
The contents of $readme_headers are as follows:
{{{
array(2) {
["requires"]=>
string(0) ""
["requires_php"]=>
string(5) "5.6.0"
}
}}}
The contents of merging these two arrays are as follows.
{{{
array(2) {
["requires"]=>
string(15) "WordPress 5.5.0"
["requires_php"]=>
string(0) ""
}
}}}
The contents of $readme_headers are overwritten by the contents of
$requirements because the array keys are the same.
Is this as expected?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50864#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list