diff --git a/src/aphront/sink/AphrontHTTPSink.php b/src/aphront/sink/AphrontHTTPSink.php --- a/src/aphront/sink/AphrontHTTPSink.php +++ b/src/aphront/sink/AphrontHTTPSink.php @@ -33,7 +33,7 @@ * @return void */ final public function writeHTTPStatus($code, $message = '') { - if (!preg_match('/^\d{3}$/', $code)) { + if (!preg_match('/^\d{3}$/', (string)$code)) { throw new Exception(pht("Malformed HTTP status code '%s'!", $code)); } diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php --- a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php +++ b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php @@ -392,7 +392,7 @@ "%s\n", pht('Starting Aphlict server in foreground...')); } else { - Filesystem::writeFile($this->getPIDPath(), getmypid()); + Filesystem::writeFile($this->getPIDPath(), (string)getmypid()); } $command = $this->getStartCommand($this->getServerArgv()); diff --git a/src/applications/auth/factor/PhabricatorTOTPAuthFactor.php b/src/applications/auth/factor/PhabricatorTOTPAuthFactor.php --- a/src/applications/auth/factor/PhabricatorTOTPAuthFactor.php +++ b/src/applications/auth/factor/PhabricatorTOTPAuthFactor.php @@ -403,7 +403,7 @@ ((ord($hash[$offset + 3]) ) ); $code = ($code % 1000000); - $code = str_pad($code, 6, '0', STR_PAD_LEFT); + $code = str_pad((string)$code, 6, '0', STR_PAD_LEFT); return $code; } diff --git a/src/applications/config/check/PhabricatorWebServerSetupCheck.php b/src/applications/config/check/PhabricatorWebServerSetupCheck.php --- a/src/applications/config/check/PhabricatorWebServerSetupCheck.php +++ b/src/applications/config/check/PhabricatorWebServerSetupCheck.php @@ -43,7 +43,7 @@ ->replaceQueryParam($expect_key, $expect_value); $self_future = id(new HTTPSFuture($base_uri)) - ->addHeader('X-Setup-SelfCheck', 1) + ->addHeader('X-Setup-SelfCheck', '1') ->addHeader('Accept-Encoding', 'gzip') ->setDisableContentDecoding(true) ->setHTTPBasicAuthCredentials( @@ -56,7 +56,7 @@ $gzip_compressed = gzencode($gzip_uncompressed); $gzip_future = id(new HTTPSFuture($base_uri)) - ->addHeader('X-Setup-SelfCheck', 1) + ->addHeader('X-Setup-SelfCheck', '1') ->addHeader('Content-Encoding', 'gzip') ->setMethod('POST') ->setTimeout(5) diff --git a/src/applications/differential/controller/DifferentialRevisionAffectedPathsController.php b/src/applications/differential/controller/DifferentialRevisionAffectedPathsController.php --- a/src/applications/differential/controller/DifferentialRevisionAffectedPathsController.php +++ b/src/applications/differential/controller/DifferentialRevisionAffectedPathsController.php @@ -87,7 +87,7 @@ } // Sort rows by path name. - $rows = isort($rows, 3); + $rows = isort($rows, '3'); $table_view = id(new AphrontTableView($rows)) ->setNoDataString(pht('This revision has no indexed affected paths.')) diff --git a/src/applications/feed/PhabricatorFeedStoryPublisher.php b/src/applications/feed/PhabricatorFeedStoryPublisher.php --- a/src/applications/feed/PhabricatorFeedStoryPublisher.php +++ b/src/applications/feed/PhabricatorFeedStoryPublisher.php @@ -321,7 +321,7 @@ // We're on a 32-bit machine. if (function_exists('bcadd')) { // Try to use the 'bc' extension. - return bcadd(bcmul($time, bcpow(2, 32)), $rand); + return bcadd(bcmul($time, bcpow('2', '32')), $rand); } else { // Do the math in MySQL. TODO: If we formalize a bc dependency, get // rid of this. diff --git a/src/applications/feed/storage/PhabricatorFeedStoryData.php b/src/applications/feed/storage/PhabricatorFeedStoryData.php --- a/src/applications/feed/storage/PhabricatorFeedStoryData.php +++ b/src/applications/feed/storage/PhabricatorFeedStoryData.php @@ -45,7 +45,7 @@ // We're on a 32-bit machine. if (function_exists('bcadd')) { // Try to use the 'bc' extension. - return bcdiv($this->chronologicalKey, bcpow(2, 32)); + return bcdiv($this->chronologicalKey, bcpow('2', '32')); } else { // Do the math in MySQL. TODO: If we formalize a bc dependency, get // rid of this. diff --git a/src/applications/files/engine/PhabricatorLocalDiskFileStorageEngine.php b/src/applications/files/engine/PhabricatorLocalDiskFileStorageEngine.php --- a/src/applications/files/engine/PhabricatorLocalDiskFileStorageEngine.php +++ b/src/applications/files/engine/PhabricatorLocalDiskFileStorageEngine.php @@ -47,7 +47,7 @@ // have one directory with a zillion files in it, since this is generally // bad news. do { - $name = md5(mt_rand()); + $name = md5((string)mt_rand()); $name = preg_replace('/^(..)(..)(.*)$/', '\\1/\\2/\\3', $name); if (!Filesystem::pathExists($root.'/'.$name)) { break; diff --git a/src/applications/metamta/controller/PhabricatorMetaMTAMailViewController.php b/src/applications/metamta/controller/PhabricatorMetaMTAMailViewController.php --- a/src/applications/metamta/controller/PhabricatorMetaMTAMailViewController.php +++ b/src/applications/metamta/controller/PhabricatorMetaMTAMailViewController.php @@ -194,7 +194,7 @@ } // Sort headers by name. - $headers = isort($headers, 0); + $headers = isort($headers, '0'); foreach ($headers as $header) { list($key, $value) = $header; diff --git a/src/applications/phrequent/storage/PhrequentTimeBlock.php b/src/applications/phrequent/storage/PhrequentTimeBlock.php --- a/src/applications/phrequent/storage/PhrequentTimeBlock.php +++ b/src/applications/phrequent/storage/PhrequentTimeBlock.php @@ -259,7 +259,7 @@ * @return list> Nonoverlapping time ranges. */ public static function mergeTimeRanges(array $ranges) { - $ranges = isort($ranges, 0); + $ranges = isort($ranges, '0'); $result = array(); diff --git a/src/applications/search/engine/PhabricatorSearchNgramEngine.php b/src/applications/search/engine/PhabricatorSearchNgramEngine.php --- a/src/applications/search/engine/PhabricatorSearchNgramEngine.php +++ b/src/applications/search/engine/PhabricatorSearchNgramEngine.php @@ -35,6 +35,7 @@ $ngrams = array(); foreach ($unique_tokens as $token => $ignored) { + $token = (string)$token; $token_v = phutil_utf8v($token); $length = count($token_v); diff --git a/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php --- a/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php @@ -120,7 +120,7 @@ } // Sort them, then put "Common" at the top. - $tag_groups = isort($tag_groups, 0); + $tag_groups = isort($tag_groups, '0'); if ($common_tags) { array_unshift($tag_groups, array(pht('Common'), $common_tags)); } diff --git a/src/applications/xhprof/view/PhabricatorXHProfProfileSymbolView.php b/src/applications/xhprof/view/PhabricatorXHProfProfileSymbolView.php --- a/src/applications/xhprof/view/PhabricatorXHProfProfileSymbolView.php +++ b/src/applications/xhprof/view/PhabricatorXHProfProfileSymbolView.php @@ -93,7 +93,7 @@ $data[$key]['wt'] / $flat[$symbol]['wt'], ); } - $child_rows = isort($child_rows, 2); + $child_rows = isort($child_rows, '2'); $child_rows = array_reverse($child_rows); $rows = array_merge( $rows, diff --git a/src/infrastructure/edges/query/PhabricatorEdgeQuery.php b/src/infrastructure/edges/query/PhabricatorEdgeQuery.php --- a/src/infrastructure/edges/query/PhabricatorEdgeQuery.php +++ b/src/infrastructure/edges/query/PhabricatorEdgeQuery.php @@ -122,7 +122,7 @@ * use case. * * @param string $src_phid Source PHID. - * @param string $edge_type Edge type constant. + * @param string $edge_type Edge type constant. * @return list List of destination PHIDs. */ public static function loadDestinationPHIDs($src_phid, $edge_type) {