diff options
author | Matěj Suchánek <matejsuchanek97@gmail.com> | 2023-05-20 14:16:32 +0200 |
---|---|---|
committer | Matěj Suchánek <matejsuchanek97@gmail.com> | 2023-05-20 15:40:21 +0200 |
commit | 676fcf43792a1199619f95ecf836a8d84b58d26a (patch) | |
tree | 7ba674b17beae9aef8c11f27d6800c40b151ab3a /includes/Request/PathRouter.php | |
parent | 9c134e2283a50fd4e9cc7b08e26ec1274e2da4a4 (diff) | |
download | mediawikicore-676fcf43792a1199619f95ecf836a8d84b58d26a.tar.gz mediawikicore-676fcf43792a1199619f95ecf836a8d84b58d26a.zip |
Replace substr with cleaner string methods
Use str_starts_with, str_ends_with or string offset where appropriate.
This fixes a bug in MimeAnalyzer where the "UTF-16LE" header could not
be identified because of wrong constant. This is the exact type of bug
that the new functions can avoid.
Change-Id: I9f30881e7e895f011db29cf5dcbe43bc4f341062
Diffstat (limited to 'includes/Request/PathRouter.php')
-rw-r--r-- | includes/Request/PathRouter.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/includes/Request/PathRouter.php b/includes/Request/PathRouter.php index 1082fa9a7017..444aea7be0f7 100644 --- a/includes/Request/PathRouter.php +++ b/includes/Request/PathRouter.php @@ -101,7 +101,7 @@ class PathRouter { if ( !isset( $options['strict'] ) || !$options['strict'] ) { // Unless this is a strict path make sure that the path has a $1 if ( strpos( $path, '$1' ) === false ) { - if ( substr( $path, -1 ) !== '/' ) { + if ( $path[-1] !== '/' ) { $path .= '/'; } $path .= '$1'; |