Code Modernization: Check the input type in `validate_file()`.
This fixes a `preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated` notice on PHP 8.1. The behavior for `null` and `string` input is covered by the existing `Tests_Functions::test_validate_file()` test. Effect: Errors down by 238, assertions up by 1920, failures down by 1. Props jrf, hellofromTonya, SergeyBiryukov. See #53635. Built from https://develop.svn.wordpress.org/trunk@51625 git-svn-id: http://core.svn.wordpress.org/trunk@51231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8a98b96f36
commit
532bd808c9
|
@ -5709,6 +5709,10 @@ function iis7_supports_permalinks() {
|
|||
* @return int 0 means nothing is wrong, greater than 0 means something was wrong.
|
||||
*/
|
||||
function validate_file( $file, $allowed_files = array() ) {
|
||||
if ( ! is_scalar( $file ) || '' === $file ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// `../` on its own is not allowed:
|
||||
if ( '../' === $file ) {
|
||||
return 1;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.9-alpha-51624';
|
||||
$wp_version = '5.9-alpha-51625';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue