<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[56031] trunk/src: Code Modernization: Use `str_contains()` in a few more places.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/56031">56031</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/56031","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-06-26 10:15:04 +0000 (Mon, 26 Jun 2023)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Code Modernization: Use `str_contains()` in a few more places.
`str_contains()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) contains the given substring (needle).
WordPress core includes a polyfill for `str_contains()` on PHP < 8.0 as of WordPress 5.9.
This commit replaces `false !== strpos( ... )` with `str_contains()` in core files, making the code more readable and consistent, as well as better aligned with modern development practices.
Follow-up to <a href="https://core.trac.wordpress.org/changeset/55988">[55988]</a>, <a href="https://core.trac.wordpress.org/changeset/56021">[56021]</a>.
See <a href="https://core.trac.wordpress.org/ticket/58206">#58206</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesajaxactionsphp">trunk/src/wp-admin/includes/ajax-actions.php</a></li>
<li><a href="#trunksrcwpadminincludesmediaphp">trunk/src/wp-admin/includes/media.php</a></li>
<li><a href="#trunksrcwpincludesclasswpeditorphp">trunk/src/wp-includes/class-wp-editor.php</a></li>
<li><a href="#trunksrcwpincludesclasswprewritephp">trunk/src/wp-includes/class-wp-rewrite.php</a></li>
<li><a href="#trunksrcwpincludesclasswpxmlrpcserverphp">trunk/src/wp-includes/class-wp-xmlrpc-server.php</a></li>
<li><a href="#trunksrcwpincludesformattingphp">trunk/src/wp-includes/formatting.php</a></li>
<li><a href="#trunksrcwpincludesfunctionsphp">trunk/src/wp-includes/functions.php</a></li>
<li><a href="#trunksrcwpincludesgeneraltemplatephp">trunk/src/wp-includes/general-template.php</a></li>
<li><a href="#trunksrcwpincludesloadphp">trunk/src/wp-includes/load.php</a></li>
<li><a href="#trunksrcwpincludesmediaphp">trunk/src/wp-includes/media.php</a></li>
<li><a href="#trunksrcwpincludesrestapiclasswprestserverphp">trunk/src/wp-includes/rest-api/class-wp-rest-server.php</a></li>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswprestattachmentscontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesajaxactionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/ajax-actions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/ajax-actions.php 2023-06-26 08:55:31 UTC (rev 56030)
+++ trunk/src/wp-admin/includes/ajax-actions.php 2023-06-26 10:15:04 UTC (rev 56031)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3319,7 +3319,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $url = empty( $attachment['url'] ) ? '' : $attachment['url'];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $rel = ( strpos( $url, 'attachment_id' ) || get_attachment_link( $id ) == $url );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $rel = ( str_contains( $url, 'attachment_id' ) || get_attachment_link( $id ) === $url );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'media_send_to_editor', 'image_media_send_to_editor' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpadminincludesmediaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/media.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/media.php 2023-06-26 08:55:31 UTC (rev 56030)
+++ trunk/src/wp-admin/includes/media.php 2023-06-26 10:15:04 UTC (rev 56031)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -831,7 +831,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $attachment['url'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $rel = '';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $attachment['url'], 'attachment_id' ) || get_attachment_link( $send_id ) == $attachment['url'] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( str_contains( $attachment['url'], 'attachment_id' ) || get_attachment_link( $send_id ) === $attachment['url'] ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $rel = " rel='attachment wp-att-" . esc_attr( $send_id ) . "'";
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1359,7 +1359,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $align = ! empty( $attachment['align'] ) ? $attachment['align'] : 'none';
</span><span class="cx" style="display: block; padding: 0 10px"> $size = ! empty( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium';
</span><span class="cx" style="display: block; padding: 0 10px"> $alt = ! empty( $attachment['image_alt'] ) ? $attachment['image_alt'] : '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $rel = ( strpos( $url, 'attachment_id' ) || get_attachment_link( $attachment_id ) === $url );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $rel = ( str_contains( $url, 'attachment_id' ) || get_attachment_link( $attachment_id ) === $url );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return get_image_send_to_editor( $attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size, $alt );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpeditorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-editor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-editor.php 2023-06-26 08:55:31 UTC (rev 56030)
+++ trunk/src/wp-includes/class-wp-editor.php 2023-06-26 10:15:04 UTC (rev 56031)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -571,7 +571,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $editor_styles ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Force urlencoding of commas.
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $editor_styles as $key => $url ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $url, ',' ) !== false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( str_contains( $url, ',' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $editor_styles[ $key ] = str_replace( ',', '%2C', $url );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludesclasswprewritephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-rewrite.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-rewrite.php 2023-06-26 08:55:31 UTC (rev 56030)
+++ trunk/src/wp-includes/class-wp-rewrite.php 2023-06-26 10:15:04 UTC (rev 56031)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1060,13 +1060,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * 2) post ID, 3) page name, 4) timestamp (year, month, day, hour, second and
</span><span class="cx" style="display: block; padding: 0 10px"> * minute all present). Set these flags now as we need them for the endpoints.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $struct, '%postname%' ) !== false
- || strpos( $struct, '%post_id%' ) !== false
- || strpos( $struct, '%pagename%' ) !== false
- || ( strpos( $struct, '%year%' ) !== false && strpos( $struct, '%monthnum%' ) !== false && strpos( $struct, '%day%' ) !== false && strpos( $struct, '%hour%' ) !== false && strpos( $struct, '%minute%' ) !== false && strpos( $struct, '%second%' ) !== false )
- ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( str_contains( $struct, '%postname%' )
+ || str_contains( $struct, '%post_id%' )
+ || str_contains( $struct, '%pagename%' )
+ || ( str_contains( $struct, '%year%' )
+ && str_contains( $struct, '%monthnum%' )
+ && str_contains( $struct, '%day%' )
+ && str_contains( $struct, '%hour%' )
+ && str_contains( $struct, '%minute%' )
+ && str_contains( $struct, '%second%' ) )
+ ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $post = true;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $struct, '%pagename%' ) !== false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( str_contains( $struct, '%pagename%' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $page = true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1074,7 +1079,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $post ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // For custom post types, we need to add on endpoints as well.
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( get_post_types( array( '_builtin' => false ) ) as $ptype ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $struct, "%$ptype%" ) !== false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( str_contains( $struct, "%$ptype%" ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $post = true;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // This is for page style attachment URLs.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1555,7 +1560,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Apache 1.3 does not support the reluctant (non-greedy) modifier.
</span><span class="cx" style="display: block; padding: 0 10px"> $match = str_replace( '.+?', '.+', $match );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $query, $this->index ) !== false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( str_contains( $query, $this->index ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n";
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $rules .= 'RewriteRule ^' . $match . ' ' . $site_root . $query . " [QSA,L]\n";
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpxmlrpcserverphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-xmlrpc-server.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-xmlrpc-server.php 2023-06-26 08:55:31 UTC (rev 56030)
+++ trunk/src/wp-includes/class-wp-xmlrpc-server.php 2023-06-26 10:15:04 UTC (rev 56031)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6990,7 +6990,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $preg_target = preg_quote( $pagelinkedto, '|' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $p as $para ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $para, $pagelinkedto ) !== false ) { // It exists, but is it a link?
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( str_contains( $para, $pagelinkedto ) ) { // It exists, but is it a link?
</ins><span class="cx" style="display: block; padding: 0 10px"> preg_match( '|<a[^>]+?' . $preg_target . '[^>]*>([^>]+?)</a>|', $para, $context );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // If the URL isn't in a link context, keep looking.
</span></span></pre></div>
<a id="trunksrcwpincludesformattingphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/formatting.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/formatting.php 2023-06-26 08:55:31 UTC (rev 56030)
+++ trunk/src/wp-includes/formatting.php 2023-06-26 10:15:04 UTC (rev 56031)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1019,7 +1019,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Don't bother if there are no entities - saves a lot of processing.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $text, '&' ) === false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! str_contains( $text, '&' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return $text;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2474,7 +2474,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> _deprecated_argument( __FUNCTION__, '0.71' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $content, '&' ) !== false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( str_contains( $content, '&' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $content = preg_replace( '/&([^#])(?![a-z1-4]{1,8};)/i', '&$1', $content );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2525,7 +2525,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'Ÿ' => 'Ÿ',
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $content, '' ) !== false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( str_contains( $content, '' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $content = strtr( $content, $wp_htmltranswinuni );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5581,7 +5581,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $filtered = wp_check_invalid_utf8( $str );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $filtered, '<' ) !== false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( str_contains( $filtered, '<' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $filtered = wp_pre_kses_less_than( $filtered );
</span><span class="cx" style="display: block; padding: 0 10px"> // This will strip extra whitespace for us.
</span><span class="cx" style="display: block; padding: 0 10px"> $filtered = wp_strip_all_tags( $filtered, false );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6066,7 +6066,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $headers as $header ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $header, ':' ) === false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! str_contains( $header, ':' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6078,7 +6078,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $content = trim( $content );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'content-type' === strtolower( $name ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $content, ';' ) !== false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( str_contains( $content, ';' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> list( $type, $charset ) = explode( ';', $content );
</span><span class="cx" style="display: block; padding: 0 10px"> $content_type = trim( $type );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span></span></pre></div>
<a id="trunksrcwpincludesfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/functions.php 2023-06-26 08:55:31 UTC (rev 56030)
+++ trunk/src/wp-includes/functions.php 2023-06-26 10:15:04 UTC (rev 56031)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6104,7 +6104,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $script_filename_dir = dirname( $_SERVER['SCRIPT_FILENAME'] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // The request is for the admin.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) !== false || str_contains( $_SERVER['REQUEST_URI'], 'wp-login.php' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( str_contains( $_SERVER['REQUEST_URI'], 'wp-admin' ) || str_contains( $_SERVER['REQUEST_URI'], 'wp-login.php' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $path = preg_replace( '#/(wp-admin/?.*|wp-login\.php.*)#i', '', $_SERVER['REQUEST_URI'] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // The request is for a file in ABSPATH.
</span></span></pre></div>
<a id="trunksrcwpincludesgeneraltemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/general-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/general-template.php 2023-06-26 08:55:31 UTC (rev 56030)
+++ trunk/src/wp-includes/general-template.php 2023-06-26 10:15:04 UTC (rev 56031)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -907,9 +907,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $url = true;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $show, 'url' ) === false &&
- strpos( $show, 'directory' ) === false &&
- strpos( $show, 'home' ) === false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( ! str_contains( $show, 'url' )
+ && ! str_contains( $show, 'directory' )
+ && ! str_contains( $show, 'home' )
+ ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $url = false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3738,7 +3740,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $is_safari ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && (int) $match[1] >= 534 );
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( $is_IE ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_rich_edit = ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Trident/7.0;' ) !== false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_rich_edit = str_contains( $_SERVER['HTTP_USER_AGENT'], 'Trident/7.0;' );
</ins><span class="cx" style="display: block; padding: 0 10px"> } elseif ( $is_gecko || $is_chrome || $is_edge || ( $is_opera && ! wp_is_mobile() ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $wp_rich_edit = true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludesloadphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/load.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/load.php 2023-06-26 08:55:31 UTC (rev 56030)
+++ trunk/src/wp-includes/load.php 2023-06-26 10:15:04 UTC (rev 56031)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -73,14 +73,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( isset( $_SERVER['SCRIPT_FILENAME'] )
- && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) === strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 )
- ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && str_ends_with( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Fix for Dreamhost and other PHP as CGI hosts.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( isset( $_SERVER['SCRIPT_NAME'] ) && ( strpos( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) !== false ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( isset( $_SERVER['SCRIPT_NAME'] ) && str_contains( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> unset( $_SERVER['PATH_INFO'] );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludesmediaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/media.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/media.php 2023-06-26 08:55:31 UTC (rev 56030)
+++ trunk/src/wp-includes/media.php 2023-06-26 10:15:04 UTC (rev 56031)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4059,9 +4059,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * but iOS 7.x has a bug that prevents uploading of videos when enabled.
</span><span class="cx" style="display: block; padding: 0 10px"> * See #29602.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( wp_is_mobile() && strpos( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) !== false &&
- strpos( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' ) !== false ) {
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( wp_is_mobile()
+ && str_contains( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' )
+ && str_contains( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' )
+ ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $defaults['multi_selection'] = false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiclasswprestserverphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/rest-api/class-wp-rest-server.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/class-wp-rest-server.php 2023-06-26 08:55:31 UTC (rev 56030)
+++ trunk/src/wp-includes/rest-api/class-wp-rest-server.php 2023-06-26 10:15:04 UTC (rev 56031)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1538,7 +1538,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data['endpoints'][] = $endpoint_data;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // For non-variable routes, generate links.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $route, '{' ) === false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! str_contains( $route, '{' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $data['_links'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'self' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiendpointsclasswprestattachmentscontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php 2023-06-26 08:55:31 UTC (rev 56030)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php 2023-06-26 10:15:04 UTC (rev 56031)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1111,7 +1111,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $disposition_header as $value ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $value = trim( $value );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $value, ';' ) === false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! str_contains( $value, ';' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1121,7 +1121,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $attributes = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $attr_parts as $part ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $part, '=' ) === false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! str_contains( $part, '=' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre>
</div>
</div>
</body>
</html>