Skip to content

Commit

Permalink
ucwords polyfill for php 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
lihsai0 committed Apr 17, 2023
1 parent b7a6473 commit 605f852
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Qiniu/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,13 @@ function explodeUpToken($upToken)
return array($accessKey, $bucket, null);
}

// polyfill ucwords for php version < 5.4.32
if (version_compare(phpversion(), "5.4.32") < 0) {
// polyfill ucwords for `php version < 5.4.32` or `5.5.0 <= php version < 5.5.16`
if (version_compare(phpversion(), "5.4.32") < 0 ||
(
version_compare(phpversion(), "5.5.0") >= 0 &&
version_compare(phpversion(), "5.5.16") < 0
)
) {
function ucwords($str, $delimiters = " \t\r\n\f\v")
{
$delims = preg_split('//u', $delimiters, -1, PREG_SPLIT_NO_EMPTY);
Expand Down

0 comments on commit 605f852

Please sign in to comment.