[wp-trac] [WordPress Trac] #48091: Remove conditional use of PHP stream_get_contents()
WordPress Trac
noreply at wordpress.org
Sat Sep 21 00:23:27 UTC 2019
#48091: Remove conditional use of PHP stream_get_contents()
-------------------------------------------+-----------------------------
Reporter: jrf | Owner: SergeyBiryukov
Type: task (blessed) | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords: has-patch
Focuses: performance, coding-standards |
-------------------------------------------+-----------------------------
While working on #48075 / looking for code which can be removed now
support for PHP < 5.6.20 has been dropped, I came across three instances
where checks were done for the existance of the `stream_get_contents()`
function.
{{{#!php
<?php
if ( function_exists( 'stream_get_contents' ) ) {
// Code.
}
}}}
Now, there are only two reasons I can think for this code to exist:
1. Support for PHP < 5.
The [https://www.php.net/manual/en/function.stream-get-contents.php
`stream_get_contents()` function] was introduced in PHP 5.0.0. It might be
that this code is from before that time.
2. Hosts disabling the function using the
[https://www.php.net/manual/en/ini.core.php#ini.disable-functions
`disabled_functions` ini directive].
I honestly don't know if that's a thing, but that's the only other reason
I could think of for this code to exist.
----
Based on the comment found in the
[https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes
/class-wp-filesystem-ssh2.php#L29 `class-wp-filesystem-ssh2.php`]
documentation, I strongly believe the reason is **1)** and that the
removal of these conditions is long overdue, if for no other reason than
that the function is used unconditionally in the
[https://core.trac.wordpress.org/browser/trunk/src/wp-
includes/pomo/mo.php#L76 `mo.php`] file.
So based on that I am attaching a patch to ''remove'' the condition.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48091>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list