diff --git a/externals/cowsay/cowsay b/externals/cowsay/cowsay --- a/externals/cowsay/cowsay +++ b/externals/cowsay/cowsay @@ -56,8 +56,8 @@ $tired = $opts{'t'}; $wired = $opts{'w'}; $young = $opts{'y'}; -$eyes = substr($opts{'e'}, 0, 2); -$tongue = substr($opts{'T'}, 0, 2); +$eyes = @substr($opts{'e'}, 0, 2); +$tongue = @substr($opts{'T'}, 0, 2); $the_cow = ""; &slurp_input; diff --git a/externals/diff_match_patch/diff_match_patch.php b/externals/diff_match_patch/diff_match_patch.php --- a/externals/diff_match_patch/diff_match_patch.php +++ b/externals/diff_match_patch/diff_match_patch.php @@ -101,9 +101,9 @@ // Trim off common suffix (speedup) $commonlength = $this->diff_commonSuffix($text1, $text2); - $commonsuffix = mb_substr($text1, mb_strlen($text1) - $commonlength); - $text1 = mb_substr($text1, 0, mb_strlen($text1) - $commonlength); - $text2 = mb_substr($text2, 0, mb_strlen($text2) - $commonlength); + $commonsuffix = mb_substr($text1, mbstrlen($text1) - $commonlength); + $text1 = mb_substr($text1, 0, mbstrlen($text1) - $commonlength); + $text2 = mb_substr($text2, 0, mbstrlen($text2) - $commonlength); // Compute the diff on the middle block $diffs = $this->diff_compute($text1, $text2, $checklines); @@ -142,19 +142,19 @@ return array ( array ( DIFF_DELETE, $text1 ) ); } - $longtext = mb_strlen($text1) > mb_strlen($text2) ? $text1 : $text2; - $shorttext = mb_strlen($text1) > mb_strlen($text2) ? $text2 : $text1; + $longtext = mbstrlen($text1) > mbstrlen($text2) ? $text1 : $text2; + $shorttext = mbstrlen($text1) > mbstrlen($text2) ? $text2 : $text1; $i = mb_strpos($longtext, $shorttext); if ($i !== false) { // Shorter text is inside the longer text (speedup) $diffs = array ( array ( DIFF_INSERT, mb_substr($longtext, 0, $i) ), array ( DIFF_EQUAL, $shorttext ), - array ( DIFF_INSERT, mb_substr($longtext, $i +mb_strlen($shorttext)) ) + array ( DIFF_INSERT, mb_substr($longtext, $i +mbstrlen($shorttext)) ) ); // Swap insertions for deletions if diff is reversed. - if (mb_strlen($text1) > mb_strlen($text2)) { + if (mbstrlen($text1) > mbstrlen($text2)) { $diffs[0][0] = $diffs[2][0] = DIFF_DELETE; } return $diffs; @@ -183,7 +183,7 @@ } // Perform a real diff. - if ($checklines && (mb_strlen($text1) < 100 || mb_strlen($text2) < 100)) { + if ($checklines && (mbstrlen($text1) < 100 || mbstrlen($text2) < 100)) { // Too trivial for the overhead. $checklines = false; } @@ -306,10 +306,10 @@ $lineEnd = -1; // Keeping our own length variable is faster than looking it up. $lineArrayLength = count($lineArray); - while ($lineEnd < mb_strlen($text) - 1) { + while ($lineEnd < mbstrlen($text) - 1) { $lineEnd = mb_strpos($text, "\n", $lineStart); if ($lineEnd === false) { - $lineEnd = mb_strlen($text) - 1; + $lineEnd = mbstrlen($text) - 1; } $line = mb_substr($text, $lineStart, $lineEnd +1 -$lineStart); $lineStart = $lineEnd +1; @@ -335,7 +335,7 @@ for ($x = 0; $x < count($diffs); $x++) { $chars = $diffs[$x][1]; $text = array (); - for ($y = 0; $y < mb_strlen($chars); $y++) { + for ($y = 0; $y < mbstrlen($chars); $y++) { $text[$y] = $lineArray[charCodeAt($chars, $y)]; } $diffs[$x][1] = implode('',$text); @@ -355,8 +355,8 @@ $ms_end = microtime(true) + $this->Diff_Timeout; // Cache the text lengths to prevent multiple calls. - $text1_length = mb_strlen($text1); - $text2_length = mb_strlen($text2); + $text1_length = mbstrlen($text1); + $text2_length = mbstrlen($text2); $max_d = $text1_length + $text2_length -1; $doubleEnd = $this->Diff_DualThreshold * 2 < $max_d; $v_map1 = array(); @@ -481,8 +481,8 @@ */ function diff_path1($v_map, $text1, $text2) { $path = array (); - $x = mb_strlen($text1); - $y = mb_strlen($text2); + $x = mbstrlen($text1); + $y = mbstrlen($text2); /** @type {number?} */ $last_op = null; for ($d = count($v_map) - 2; $d >= 0; $d--) { @@ -543,8 +543,8 @@ function diff_path2($v_map, $text1, $text2) { $path = array (); $pathLength = 0; - $x = mb_strlen($text1); - $y = mb_strlen($text2); + $x = mbstrlen($text1); + $y = mbstrlen($text2); /** @type {number?} */ $last_op = null; for ($d = count($v_map) - 2; $d >= 0; $d--) { @@ -552,11 +552,11 @@ if (isset ($v_map[$d][($x -1) . ',' . $y])) { $x--; if ($last_op === DIFF_DELETE) { - $path[$pathLength -1][1] .= $text1[mb_strlen($text1) - $x -1]; + $path[$pathLength -1][1] .= $text1[mbstrlen($text1) - $x -1]; } else { $path[$pathLength++] = array ( DIFF_DELETE, - $text1[mb_strlen($text1) - $x -1] + $text1[mbstrlen($text1) - $x -1] ); } $last_op = DIFF_DELETE; @@ -565,11 +565,11 @@ elseif (isset ($v_map[$d][$x . ',' . ($y -1)])) { $y--; if ($last_op === DIFF_INSERT) { - $path[$pathLength -1][1] .= $text2[mb_strlen($text2) - $y -1]; + $path[$pathLength -1][1] .= $text2[mbstrlen($text2) - $y -1]; } else { $path[$pathLength++] = array ( DIFF_INSERT, - $text2[mb_strlen($text2) - $y -1] + $text2[mbstrlen($text2) - $y -1] ); } $last_op = DIFF_INSERT; @@ -582,11 +582,11 @@ // throw new Error('No diagonal. Can\'t happen. (diff_path2)'); //} if ($last_op === DIFF_EQUAL) { - $path[$pathLength -1][1] .= $text1[mb_strlen($text1) - $x -1]; + $path[$pathLength -1][1] .= $text1[mbstrlen($text1) - $x -1]; } else { $path[$pathLength++] = array ( DIFF_EQUAL, - $text1[mb_strlen($text1) - $x -1] + $text1[mbstrlen($text1) - $x -1] ); } $last_op = DIFF_EQUAL; @@ -633,16 +633,16 @@ * text2 and the common middle. Or null if there was no match. */ function diff_halfMatch($text1, $text2) { - $longtext = mb_strlen($text1) > mb_strlen($text2) ? $text1 : $text2; - $shorttext = mb_strlen($text1) > mb_strlen($text2) ? $text2 : $text1; - if (mb_strlen($longtext) < 10 || mb_strlen($shorttext) < 1) { + $longtext = mbstrlen($text1) > mbstrlen($text2) ? $text1 : $text2; + $shorttext = mbstrlen($text1) > mbstrlen($text2) ? $text2 : $text1; + if (mbstrlen($longtext) < 10 || mbstrlen($shorttext) < 1) { return null; // Pointless. } // First check if the second quarter is the seed for a half-match. - $hm1 = $this->diff_halfMatchI($longtext, $shorttext, ceil(mb_strlen($longtext) / 4)); + $hm1 = $this->diff_halfMatchI($longtext, $shorttext, ceil(mbstrlen($longtext) / 4)); // Check again based on the third quarter. - $hm2 = $this->diff_halfMatchI($longtext, $shorttext, ceil(mb_strlen($longtext) / 2)); + $hm2 = $this->diff_halfMatchI($longtext, $shorttext, ceil(mbstrlen($longtext) / 2)); if (!$hm1 && !$hm2) { return null; @@ -652,11 +652,11 @@ $hm = $hm2; } else { // Both matched. Select the longest. - $hm = mb_strlen($hm1[4]) > mb_strlen($hm2[4]) ? $hm1 : $hm2; + $hm = mbstrlen($hm1[4]) > mbstrlen($hm2[4]) ? $hm1 : $hm2; } // A half-match was found, sort out the return data. - if (mb_strlen($text1) > mb_strlen($text2)) { + if (mbstrlen($text1) > mbstrlen($text2)) { $text1_a = $hm[0]; $text1_b = $hm[1]; $text2_a = $hm[2]; @@ -685,7 +685,7 @@ */ function diff_halfMatchI($longtext, $shorttext, $i) { // Start with a 1/4 length mb_substring at position i as a seed. - $seed = mb_substr($longtext, $i, floor(mb_strlen($longtext) / 4)); + $seed = mb_substr($longtext, $i, floor(mbstrlen($longtext) / 4)); $j = -1; $best_common = ''; @@ -696,7 +696,7 @@ while ( ($j = mb_strpos($shorttext, $seed, $j + 1)) !== false ) { $prefixLength = $this->diff_commonPrefix(mb_substr($longtext, $i), mb_substr($shorttext, $j)); $suffixLength = $this->diff_commonSuffix(mb_substr($longtext, 0, $i), mb_substr($shorttext, 0, $j)); - if (mb_strlen($best_common) < $suffixLength + $prefixLength) { + if (mbstrlen($best_common) < $suffixLength + $prefixLength) { $best_common = mb_substr($shorttext, $j - $suffixLength, $suffixLength) . mb_substr($shorttext, $j, $prefixLength); $best_longtext_a = mb_substr($longtext, 0, $i - $suffixLength); $best_longtext_b = mb_substr($longtext, $i + $prefixLength); @@ -704,7 +704,7 @@ $best_shorttext_b = mb_substr($shorttext, $j + $prefixLength); } } - if (mb_strlen($best_common) >= mb_strlen($longtext) / 2) { + if (mbstrlen($best_common) >= mbstrlen($longtext) / 2) { return array ( $best_longtext_a, $best_longtext_b, @@ -738,8 +738,8 @@ $length_changes2 = 0; $lastequality = $diffs[$pointer][1]; } else { // an insertion or deletion - $length_changes2 += mb_strlen($diffs[$pointer][1]); - if ($lastequality !== null && (mb_strlen($lastequality) <= $length_changes1) && (mb_strlen($lastequality) <= $length_changes2)) { + $length_changes2 += mbstrlen($diffs[$pointer][1]); + if ($lastequality !== null && (mbstrlen($lastequality) <= $length_changes1) && (mbstrlen($lastequality) <= $length_changes2)) { // Duplicate record $zzz_diffs = array_splice($diffs, $equalities[$equalitiesLength -1], 0, array(array ( DIFF_DELETE, @@ -786,9 +786,9 @@ // First, shift the edit as far left as possible. $commonOffset = $this->diff_commonSuffix($equality1, $edit); if ($commonOffset !== '') { - $commonString = mb_substr($edit, mb_strlen($edit) - $commonOffset); - $equality1 = mb_substr($equality1, 0, mb_strlen($equality1) - $commonOffset); - $edit = $commonString . mb_substr($edit, 0, mb_strlen($edit) - $commonOffset); + $commonString = mb_substr($edit, mbstrlen($edit) - $commonOffset); + $equality1 = mb_substr($equality1, 0, mbstrlen($equality1) - $commonOffset); + $edit = $commonString . mb_substr($edit, 0, mbstrlen($edit) - $commonOffset); $equality2 = $commonString . $equality2; } @@ -861,16 +861,16 @@ // rather than force total conformity. $score = 0; // One point for non-alphanumeric. - if (preg_match($punctuation, $one[mb_strlen($one) - 1]) || preg_match($punctuation, $two[0])) { + if (@preg_match($punctuation, $one[mbstrlen($one) - 1]) || @preg_match($punctuation, $two[0])) { $score++; // Two points for whitespace. - if (preg_match($whitespace, $one[mb_strlen($one) - 1] ) || preg_match($whitespace, $two[0])) { + if (@preg_match($whitespace, $one[mbstrlen($one) - 1] ) || @preg_match($whitespace, $two[0])) { $score++; // Three points for line breaks. - if (preg_match($linebreak, $one[mb_strlen($one) - 1]) || preg_match($linebreak, $two[0])) { + if (@preg_match($linebreak, $one[mbstrlen($one) - 1]) || @preg_match($linebreak, $two[0])) { $score++; // Four points for blank lines. - if (preg_match($blanklineEnd, $one) || preg_match($blanklineStart, $two)) { + if (@preg_match($blanklineEnd, $one) || @preg_match($blanklineStart, $two)) { $score++; } } @@ -899,7 +899,7 @@ $post_del = false; while ($pointer < count($diffs)) { if ($diffs[$pointer][0] == DIFF_EQUAL) { // equality found - if (mb_strlen($diffs[$pointer][1]) < $this->Diff_EditCost && ($post_ins || $post_del)) { + if (mbstrlen($diffs[$pointer][1]) < $this->Diff_EditCost && ($post_ins || $post_del)) { // Candidate found. $equalities[$equalitiesLength++] = $pointer; $pre_ins = $post_ins; @@ -925,7 +925,7 @@ * AXCD * ABXC */ - if ($lastequality && (($pre_ins && $pre_del && $post_ins && $post_del) || ((mb_strlen($lastequality) < $this->Diff_EditCost / 2) && ($pre_ins + $pre_del + $post_ins + $post_del) == 3))) { + if ($lastequality && (($pre_ins && $pre_del && $post_ins && $post_del) || ((mbstrlen($lastequality) < $this->Diff_EditCost / 2) && ($pre_ins + $pre_del + $post_ins + $post_del) == 3))) { // Duplicate record $zzz_diffs = array_splice($diffs, $equalities[$equalitiesLength -1], 0, array(array ( DIFF_DELETE, @@ -1002,9 +1002,9 @@ // Factor out any common suffixies. $commonlength = $this->diff_commonSuffix($text_insert, $text_delete); if ($commonlength !== 0) { - $diffs[$pointer][1] = mb_substr($text_insert, mb_strlen($text_insert) - $commonlength) . $diffs[$pointer][1]; - $text_insert = mb_substr($text_insert, 0, mb_strlen($text_insert) - $commonlength); - $text_delete = mb_substr($text_delete, 0, mb_strlen($text_delete) - $commonlength); + $diffs[$pointer][1] = mb_substr($text_insert, mbstrlen($text_insert) - $commonlength) . $diffs[$pointer][1]; + $text_insert = mb_substr($text_insert, 0, mbstrlen($text_insert) - $commonlength); + $text_delete = mb_substr($text_delete, 0, mbstrlen($text_delete) - $commonlength); } } // Delete the offending records and add the merged ones. @@ -1055,17 +1055,17 @@ while ($pointer < count($diffs) - 1) { if ($diffs[$pointer-1][0] == DIFF_EQUAL && $diffs[$pointer+1][0] == DIFF_EQUAL) { // This is a single edit surrounded by equalities. - if ( mb_substr($diffs[$pointer][1], mb_strlen($diffs[$pointer][1]) - mb_strlen($diffs[$pointer -1][1])) == $diffs[$pointer -1][1]) { + if ( mb_substr($diffs[$pointer][1], mbstrlen($diffs[$pointer][1]) - mbstrlen($diffs[$pointer -1][1])) == $diffs[$pointer -1][1]) { // Shift the edit over the previous equality. - $diffs[$pointer][1] = $diffs[$pointer -1][1] . mb_substr($diffs[$pointer][1], 0, mb_strlen($diffs[$pointer][1]) - mb_strlen($diffs[$pointer -1][1])); + $diffs[$pointer][1] = $diffs[$pointer -1][1] . mb_substr($diffs[$pointer][1], 0, mbstrlen($diffs[$pointer][1]) - mbstrlen($diffs[$pointer -1][1])); $diffs[$pointer +1][1] = $diffs[$pointer -1][1] . $diffs[$pointer +1][1]; array_splice($diffs, $pointer -1, 1); $changes = true; - } elseif (mb_substr($diffs[$pointer][1], 0, mb_strlen($diffs[$pointer +1][1])) == $diffs[$pointer +1][1]) { + } elseif (mb_substr($diffs[$pointer][1], 0, mbstrlen($diffs[$pointer +1][1])) == $diffs[$pointer +1][1]) { // Shift the edit over the next equality. $diffs[$pointer -1][1] .= $diffs[$pointer +1][1]; - $diffs[$pointer][1] = mb_substr($diffs[$pointer][1], mb_strlen($diffs[$pointer +1][1])) . $diffs[$pointer +1][1]; + $diffs[$pointer][1] = mb_substr($diffs[$pointer][1], mbstrlen($diffs[$pointer +1][1])) . $diffs[$pointer +1][1]; array_splice($diffs, $pointer +1, 1); $changes = true; } @@ -1093,10 +1093,10 @@ $last_chars2 = 0; for ($x = 0; $x < count($diffs); $x++) { if ($diffs[$x][0] !== DIFF_INSERT) { // Equality or deletion. - $chars1 += mb_strlen($diffs[$x][1]); + $chars1 += mbstrlen($diffs[$x][1]); } if ($diffs[$x][0] !== DIFF_DELETE) { // Equality or insertion. - $chars2 += mb_strlen($diffs[$x][1]); + $chars2 += mbstrlen($diffs[$x][1]); } if ($chars1 > $loc) { // Overshot the location. break; @@ -1147,7 +1147,7 @@ break; } if ($op !== DIFF_DELETE) { - $i += mb_strlen($data); + $i += mbstrlen($data); } } return implode('',$html); @@ -1198,10 +1198,10 @@ $data = $diffs[$x][1]; switch ($op) { case DIFF_INSERT : - $insertions += mb_strlen($data); + $insertions += mbstrlen($data); break; case DIFF_DELETE : - $deletions += mb_strlen($data); + $deletions += mbstrlen($data); break; case DIFF_EQUAL : // A deletion and an insertion is one substitution. @@ -1231,10 +1231,10 @@ $text[$x] = '+' .encodeURI($diffs[$x][1]); break; case DIFF_DELETE : - $text[$x] = '-' .mb_strlen($diffs[$x][1]); + $text[$x] = '-' .mbstrlen($diffs[$x][1]); break; case DIFF_EQUAL : - $text[$x] = '=' .mb_strlen($diffs[$x][1]); + $text[$x] = '=' .mbstrlen($diffs[$x][1]); break; } } @@ -1300,9 +1300,9 @@ } } } - if ($pointer != mb_strlen($text1)) { -// throw new Exception('Delta length (' . $pointer . ') does not equal source text length (' . mb_strlen($text1) . ').'); - echo_Exception('Delta length (' . $pointer . ') does not equal source text length (' . mb_strlen($text1) . ').'); + if ($pointer != mbstrlen($text1)) { +// throw new Exception('Delta length (' . $pointer . ') does not equal source text length (' . mbstrlen($text1) . ').'); + echo_Exception('Delta length (' . $pointer . ') does not equal source text length (' . mbstrlen($text1) . ').'); } return $diffs; } @@ -1317,16 +1317,16 @@ * @return {number} Best match index or -1. */ function match_main($text, $pattern, $loc) { - $loc = max(0, min($loc, mb_strlen($text))); + $loc = max(0, min($loc, mbstrlen($text))); if ($text == $pattern) { // Shortcut (potentially not guaranteed by the algorithm) return 0; } - elseif (!mb_strlen($text)) { + elseif (!mbstrlen($text)) { // Nothing to match. return -1; } - elseif (mb_substr($text, $loc, mb_strlen($pattern)) == $pattern) { + elseif (mb_substr($text, $loc, mbstrlen($pattern)) == $pattern) { // Perfect match at the perfect spot! (Includes case of null pattern) return $loc; } else { @@ -1345,7 +1345,7 @@ * @private */ function match_bitap($text, $pattern, $loc) { - if (mb_strlen($pattern) > Match_MaxBits) { + if (mbstrlen($pattern) > Match_MaxBits) { echo_Exception('Pattern too long for this browser.'); } @@ -1362,20 +1362,20 @@ } // What about in the other direction? (speedup) - $best_loc = mb_strrpos( $text, $pattern, min($loc + mb_strlen($pattern), mb_strlen($text)) ); + $best_loc = mb_strrpos( $text, $pattern, min($loc + mbstrlen($pattern), mbstrlen($text)) ); if ($best_loc !== false) { $score_threshold = min($this->match_bitapScore(0, $best_loc, $pattern, $loc), $score_threshold); } // Initialise the bit arrays. - $matchmask = 1 << (mb_strlen($pattern) - 1); + $matchmask = 1 << (mbstrlen($pattern) - 1); $best_loc = -1; $bin_min = null; $bin_mid = null; - $bin_max = mb_strlen($pattern) + mb_strlen($text); + $bin_max = mbstrlen($pattern) + mbstrlen($text); $last_rd = null; - for ($d = 0; $d < mb_strlen($pattern); $d++) { + for ($d = 0; $d < mbstrlen($pattern); $d++) { // Scan for the best match; each iteration allows for one more error. // Run a binary search to determine how far from 'loc' we can stray at this // error level. @@ -1392,7 +1392,7 @@ // Use the result from this iteration as the maximum for the next. $bin_max = $bin_mid; $start = max(1, $loc - $bin_mid +1); - $finish = min($loc + $bin_mid, mb_strlen($text)) + mb_strlen($pattern); + $finish = min($loc + $bin_mid, mbstrlen($text)) + mbstrlen($pattern); $rd = Array ( $finish +2 @@ -1443,7 +1443,7 @@ * @private */ function match_bitapScore($e, $x, $pattern, $loc) { - $accuracy = $e / mb_strlen($pattern); + $accuracy = $e / mbstrlen($pattern); $proximity = abs($loc - $x); if (!$this->Match_Distance) { // Dodge divide by zero error. @@ -1460,11 +1460,11 @@ */ function match_alphabet($pattern) { $s = array (); - for ($i = 0; $i < mb_strlen($pattern); $i++) { + for ($i = 0; $i < mbstrlen($pattern); $i++) { $s[ $pattern[$i] ] = 0; } - for ($i = 0; $i < mb_strlen($pattern); $i++) { - $s[ $pattern[$i] ] |= 1 << (mb_strlen($pattern) - $i - 1); + for ($i = 0; $i < mbstrlen($pattern); $i++) { + $s[ $pattern[$i] ] |= 1 << (mbstrlen($pattern) - $i - 1); } return $s; } @@ -1484,11 +1484,11 @@ $padding = 0; $i = 0; while ( - ( mb_strlen($pattern) === 0 // Javascript's indexOf/lastIndexOd return 0/strlen respectively if pattern = '' + ( mbstrlen($pattern) === 0 // Javascript's indexOf/lastIndexOd return 0/strlen respectively if pattern = '' || mb_strpos($text, $pattern) !== mb_strrpos($text, $pattern) ) && $pattern !== $previousPattern // avoid infinte loop - && mb_strlen($pattern) < Match_MaxBits - $this->Patch_Margin - $this->Patch_Margin ) { + && mbstrlen($pattern) < Match_MaxBits - $this->Patch_Margin - $this->Patch_Margin ) { $padding += $this->Patch_Margin; $previousPattern = $pattern; $pattern = mb_substr($text, max($patch->start2 - $padding,0), ($patch->start2 + $patch->length1 + $padding) - max($patch->start2 - $padding,0) ); @@ -1513,11 +1513,11 @@ } // Roll back the start points. - $patch->start1 -= mb_strlen($prefix); - $patch->start2 -= mb_strlen($prefix); + $patch->start1 -= mbstrlen($prefix); + $patch->start2 -= mbstrlen($prefix); // Extend the lengths. - $patch->length1 += mb_strlen($prefix) + mb_strlen($suffix); - $patch->length2 += mb_strlen($prefix) + mb_strlen($suffix); + $patch->length1 += mbstrlen($prefix) + mbstrlen($suffix); + $patch->length2 += mbstrlen($prefix) + mbstrlen($suffix); } /** @@ -1596,21 +1596,21 @@ switch ($diff_type) { case DIFF_INSERT : $patch->diffs[$patchDiffLength++] = $diffs[$x]; - $patch->length2 += mb_strlen($diff_text); + $patch->length2 += mbstrlen($diff_text); $postpatch_text = mb_substr($postpatch_text, 0, $char_count2) . $diff_text . mb_substr($postpatch_text,$char_count2); break; case DIFF_DELETE : - $patch->length1 += mb_strlen($diff_text); + $patch->length1 += mbstrlen($diff_text); $patch->diffs[$patchDiffLength++] = $diffs[$x]; - $postpatch_text = mb_substr($postpatch_text, 0, $char_count2) . mb_substr($postpatch_text, $char_count2 + mb_strlen($diff_text) ); + $postpatch_text = mb_substr($postpatch_text, 0, $char_count2) . mb_substr($postpatch_text, $char_count2 + mbstrlen($diff_text) ); break; case DIFF_EQUAL : - if ( mb_strlen($diff_text) <= 2 * $this->Patch_Margin && $patchDiffLength && count($diffs) != $x + 1) { + if ( mbstrlen($diff_text) <= 2 * $this->Patch_Margin && $patchDiffLength && count($diffs) != $x + 1) { // Small equality inside a patch. $patch->diffs[$patchDiffLength++] = $diffs[$x]; - $patch->length1 += mb_strlen($diff_text); - $patch->length2 += mb_strlen($diff_text); - } elseif ( mb_strlen($diff_text) >= 2 * $this->Patch_Margin ) { + $patch->length1 += mbstrlen($diff_text); + $patch->length2 += mbstrlen($diff_text); + } elseif ( mbstrlen($diff_text) >= 2 * $this->Patch_Margin ) { // Time for a new patch. if ($patchDiffLength) { $this->patch_addContext($patch, $prepatch_text); @@ -1630,10 +1630,10 @@ // Update the current character count. if ($diff_type !== DIFF_INSERT) { - $char_count1 += mb_strlen($diff_text); + $char_count1 += mbstrlen($diff_text); } if ($diff_type !== DIFF_DELETE) { - $char_count2 += mb_strlen($diff_text); + $char_count2 += mbstrlen($diff_text); } } // Pick up the leftover patch if not empty. @@ -1699,12 +1699,12 @@ $text1 = $this->diff_text1($patches[$x]->diffs); $start_loc = null; $end_loc = -1; - if (mb_strlen($text1) > Match_MaxBits) { + if (mbstrlen($text1) > Match_MaxBits) { // patch_splitMax will only provide an oversized pattern in the case of // a monster delete. $start_loc = $this->match_main($text, mb_substr($text1, 0, Match_MaxBits ), $expected_loc); if ($start_loc != -1) { - $end_loc = $this->match_main($text, mb_substr($text1,mb_strlen($text1) - Match_MaxBits), $expected_loc + mb_strlen($text1) - Match_MaxBits); + $end_loc = $this->match_main($text, mb_substr($text1,mbstrlen($text1) - Match_MaxBits), $expected_loc + mbstrlen($text1) - Match_MaxBits); if ($end_loc == -1 || $start_loc >= $end_loc) { // Can't find valid trailing context. Drop this patch. $start_loc = -1; @@ -1724,18 +1724,18 @@ $delta = $start_loc - $expected_loc; $text2 = null; if ($end_loc == -1) { - $text2 = mb_substr($text, $start_loc, mb_strlen($text1) ); + $text2 = mb_substr($text, $start_loc, mbstrlen($text1) ); } else { $text2 = mb_substr($text, $start_loc, $end_loc + Match_MaxBits - $start_loc); } if ($text1 == $text2) { // Perfect match, just shove the replacement text in. - $text = mb_substr($text, 0, $start_loc) . $this->diff_text2($patches[$x]->diffs) . mb_substr($text,$start_loc + mb_strlen($text1) ); + $text = mb_substr($text, 0, $start_loc) . $this->diff_text2($patches[$x]->diffs) . mb_substr($text,$start_loc + mbstrlen($text1) ); } else { // Imperfect match. Run a diff to get a framework of equivalent // indices. $diffs = $this->diff_main($text1, $text2, false); - if ( mb_strlen($text1) > Match_MaxBits && $this->diff_levenshtein($diffs) / mb_strlen($text1) > $this->Patch_DeleteThreshold) { + if ( mbstrlen($text1) > Match_MaxBits && $this->diff_levenshtein($diffs) / mbstrlen($text1) > $this->Patch_DeleteThreshold) { // The end points match, but the content is unacceptably bad. $results[$x] = false; } else { @@ -1750,10 +1750,10 @@ if ($mod[0] === DIFF_INSERT) { // Insertion $text = mb_substr($text, 0, $start_loc + $index2) . $mod[1] . mb_substr($text, $start_loc + $index2); } elseif ($mod[0] === DIFF_DELETE) { // Deletion - $text = mb_substr($text, 0, $start_loc + $index2) . mb_substr($text,$start_loc + $this->diff_xIndex($diffs, $index1 + mb_strlen($mod[1]) )); + $text = mb_substr($text, 0, $start_loc + $index2) . mb_substr($text,$start_loc + $this->diff_xIndex($diffs, $index1 + mbstrlen($mod[1]) )); } if ($mod[0] !== DIFF_DELETE) { - $index1 += mb_strlen($mod[1]); + $index1 += mbstrlen($mod[1]); } } } @@ -1761,7 +1761,7 @@ } } // Strip the padding off. - $text = mb_substr($text, mb_strlen($nullPadding), mb_strlen($text) - 2*mb_strlen($nullPadding) ); + $text = mb_substr($text, mbstrlen($nullPadding), mbstrlen($text) - 2*mbstrlen($nullPadding) ); return array($text, $results); } @@ -1794,10 +1794,10 @@ $patch->start2 -= $paddingLength; // Should be 0. $patch->length1 += $paddingLength; $patch->length2 += $paddingLength; - } elseif ($paddingLength > mb_strlen($diffs[0][1]) ) { + } elseif ($paddingLength > mbstrlen($diffs[0][1]) ) { // Grow first equality. - $extraLength = $paddingLength - mb_strlen($diffs[0][1]); - $diffs[0][1] = mb_substr( $nullPadding , mb_strlen($diffs[0][1]) ) . $diffs[0][1]; + $extraLength = $paddingLength - mbstrlen($diffs[0][1]); + $diffs[0][1] = mb_substr( $nullPadding , mbstrlen($diffs[0][1]) ) . $diffs[0][1]; $patch->start1 -= $extraLength; $patch->start2 -= $extraLength; $patch->length1 += $extraLength; @@ -1812,9 +1812,9 @@ array_push($diffs, array(DIFF_EQUAL, $nullPadding) ); $patch->length1 += $paddingLength; $patch->length2 += $paddingLength; - } elseif ($paddingLength > mb_strlen( $diffs[count($diffs)-1][1] ) ) { + } elseif ($paddingLength > mbstrlen( $diffs[count($diffs)-1][1] ) ) { // Grow last equality. - $extraLength = $paddingLength - mb_strlen( $diffs[count($diffs)-1][1] ); + $extraLength = $paddingLength - mbstrlen( $diffs[count($diffs)-1][1] ); $diffs[ count($diffs)-1][1] .= mb_substr($nullPadding,0,$extraLength); $patch->length1 += $extraLength; $patch->length2 += $extraLength; @@ -1842,10 +1842,10 @@ // Create one of several smaller patches. $patch = new patch_obj(); $empty = true; - $patch->start1 = $start1 - mb_strlen($precontext); - $patch->start2 = $start2 - mb_strlen($precontext); + $patch->start1 = $start1 - mbstrlen($precontext); + $patch->start2 = $start2 - mbstrlen($precontext); if ($precontext !== '') { - $patch->length1 = $patch->length2 = mb_strlen($precontext); + $patch->length1 = $patch->length2 = mbstrlen($precontext); array_push($patch->diffs, array(DIFF_EQUAL, $precontext) ); } while ( count($bigpatch->diffs) !== 0 && $patch->length1 < $patch_size - $this->Patch_Margin) { @@ -1853,26 +1853,26 @@ $diff_text = $bigpatch->diffs[0][1]; if ($diff_type === DIFF_INSERT) { // Insertions are harmless. - $patch->length2 += mb_strlen($diff_text); - $start2 += mb_strlen($diff_text); + $patch->length2 += mbstrlen($diff_text); + $start2 += mbstrlen($diff_text); array_push($patch->diffs, array_shift($bigpatch->diffs) ); $empty = false; } else - if ($diff_type === DIFF_DELETE && count($patch->diffs) == 1 && $patch->diffs[0][0] == DIFF_EQUAL && (mb_strlen($diff_text) > 2 * $patch_size) ) { + if ($diff_type === DIFF_DELETE && count($patch->diffs) == 1 && $patch->diffs[0][0] == DIFF_EQUAL && (mbstrlen($diff_text) > 2 * $patch_size) ) { // This is a large deletion. Let it pass in one chunk. - $patch->length1 += mb_strlen($diff_text); - $start1 += mb_strlen($diff_text); + $patch->length1 += mbstrlen($diff_text); + $start1 += mbstrlen($diff_text); $empty = false; array_push( $patch->diffs, array($diff_type, $diff_text) ); array_shift($bigpatch->diffs); } else { // Deletion or equality. Only take as much as we can stomach. $diff_text = mb_substr($diff_text, 0, $patch_size - $patch->length1 - $this->Patch_Margin); - $patch->length1 += mb_strlen($diff_text); - $start1 += mb_strlen($diff_text); + $patch->length1 += mbstrlen($diff_text); + $start1 += mbstrlen($diff_text); if ($diff_type === DIFF_EQUAL) { - $patch->length2 += mb_strlen($diff_text); - $start2 += mb_strlen($diff_text); + $patch->length2 += mbstrlen($diff_text); + $start2 += mbstrlen($diff_text); } else { $empty = false; } @@ -1880,18 +1880,18 @@ if ($diff_text == $bigpatch->diffs[0][1]) { array_shift($bigpatch->diffs); } else { - $bigpatch->diffs[0][1] = mb_substr( $bigpatch->diffs[0][1],mb_strlen($diff_text) ); + $bigpatch->diffs[0][1] = mb_substr( $bigpatch->diffs[0][1],mbstrlen($diff_text) ); } } } // Compute the head context for the next patch. $precontext = $this->diff_text2($patch->diffs); - $precontext = mb_substr($precontext, mb_strlen($precontext)-$this->Patch_Margin); + $precontext = mb_substr($precontext, mbstrlen($precontext)-$this->Patch_Margin); // Append the end context for this patch. $postcontext = mb_substr( $this->diff_text1($bigpatch->diffs), 0, $this->Patch_Margin ); if ($postcontext !== '') { - $patch->length1 += mb_strlen($postcontext); - $patch->length2 += mb_strlen($postcontext); + $patch->length1 += mbstrlen($postcontext); + $patch->length2 += mbstrlen($postcontext); if ( count($patch->diffs) !== 0 && $patch->diffs[ count($patch->diffs) - 1][0] === DIFF_EQUAL) { $patch->diffs[ count($patch->diffs) - 1][1] .= $postcontext; } else { @@ -1930,12 +1930,12 @@ if ($textline === '') { return $patches; } - $text = explode("\n",$textline); + $text = @explode("\n",$textline); foreach($text as $i=>$t){ if($t===''){ unset($text[$i]); } } $textPointer = 0; while ($textPointer < count($text) ) { $m = null; - preg_match('/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/',$text[$textPointer],$m); + @preg_match('/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/',$text[$textPointer],$m); if (!$m) { echo_Exception('Invalid patch string: ' . $text[$textPointer]); } @@ -2070,8 +2070,8 @@ } function mb_ord($v) { $k = mb_convert_encoding($v, 'UCS-2LE', 'UTF-8'); - $k1 = ord(substr($k, 0, 1)); - $k2 = ord(substr($k, 1, 1)); + $k1 = ord(@substr($k, 0, 1)); + $k2 = ord(@substr($k, 1, 1)); return $k2 * 256 + $k1; } function mb_chr($num){ diff --git a/externals/figlet/chkfont.c b/externals/figlet/chkfont.c --- a/externals/figlet/chkfont.c +++ b/externals/figlet/chkfont.c @@ -88,8 +88,8 @@ *s = toupper(*s); } - if (strlen(path)maxlinelength) { maxlinelength=len; } @@ -143,7 +143,7 @@ for(;k>=0?(fileline[k]=='\n' || fileline[k]==endmark):0;k--) { fileline[k]='\0'; } - newlen=strlen(fileline); + newlen=@strlen(fileline); for (l=0;l=0 ? fileline[l]==' ' : 0;l--) ; @@ -265,7 +265,7 @@ if (fgets(fileline,1001,fontfile)==NULL) { fileline[0] = '\0'; } -if (strlen(fileline)>0 ? fileline[strlen(fileline)-1]!='\n' : 0) { +if (@strlen(fileline)>0 ? fileline[@strlen(fileline)-1]!='\n' : 0) { while(k=getc(fontfile),k!='\n'&&k!=EOF) ; /* Advance to end of line */ } numsread=sscanf(fileline,"%c %d %d %d %d %d %d %d %d", @@ -371,7 +371,7 @@ oldord=0; while(fgets(fileline,maxlen+1000,fontfile)!=NULL) { currline++; - len=strlen(fileline)-1; + len=@strlen(fileline)-1; if (len-100>maxlinelength) { maxlinelength=len-100; } diff --git a/externals/figlet/figlet.c b/externals/figlet/figlet.c --- a/externals/figlet/figlet.c +++ b/externals/figlet/figlet.c @@ -79,7 +79,7 @@ #include "zipio.h" /* Package for reading compressed files */ -#define MYSTRLEN(x) ((int)strlen(x)) /* Eliminate ANSI problem */ +#define MYSTRLEN(x) ((int)@strlen(x)) /* Eliminate ANSI problem */ #define DIRSEP '/' #define DIRSEP2 '\\' diff --git a/externals/figlet/getopt.c b/externals/figlet/getopt.c --- a/externals/figlet/getopt.c +++ b/externals/figlet/getopt.c @@ -39,8 +39,8 @@ extern int write(int, void *, unsigned);\ char errbuf[2];\ errbuf[0] = (char)c; errbuf[1] = '\n';\ - (void) write(2, strlwr(argv[0]), (unsigned)strlen(argv[0]));\ - (void) write(2, s, (unsigned)strlen(s));\ + (void) write(2, strlwr(argv[0]), (unsigned)@strlen(argv[0]));\ + (void) write(2, s, (unsigned)@strlen(s));\ (void) write(2, errbuf, 2);} extern char *index(); diff --git a/externals/mimemailparser/MimeMailParser.class.php b/externals/mimemailparser/MimeMailParser.class.php --- a/externals/mimemailparser/MimeMailParser.class.php +++ b/externals/mimemailparser/MimeMailParser.class.php @@ -115,7 +115,7 @@ // end in a newline, Mailparse fails to include the last line in the mail // body. This happens somewhere deep, deep inside the mailparse extension, // so adding a newline here seems like the most straightforward fix. - if (!preg_match('/\n\z/', $data)) { + if (!@preg_match('/\n\z/', $data)) { $data = $data."\n"; } @@ -274,7 +274,7 @@ $filename = $part['content-name']; $disposition = 'attachment'; } elseif (!in_array($part['content-type'], $non_attachment_types, true) - && substr($part['content-type'], 0, 10) !== 'multipart/' + && @substr($part['content-type'], 0, 10) !== 'multipart/' ) { // if we cannot get it with getMessageBody, we assume it is an attachment $disposition = 'attachment'; @@ -412,7 +412,7 @@ private function getPartHeaderFromText(&$part) { $start = $part['starting-pos']; $end = $part['starting-pos-body']; - $header = substr($this->data, $start, $end-$start); + $header = @substr($this->data, $start, $end-$start); return $header; } /** @@ -423,7 +423,7 @@ private function getPartBodyFromText(&$part) { $start = $part['starting-pos-body']; $end = $part['ending-pos-body']; - $body = substr($this->data, $start, $end-$start); + $body = @substr($this->data, $start, $end-$start); return $body; } @@ -456,7 +456,7 @@ } } else if ($this->data) { $attachment = $this->decode($this->getPartBodyFromText($part), $encoding); - fwrite($temp_fp, $attachment, strlen($attachment)); + fwrite($temp_fp, $attachment, @strlen($attachment)); } fseek($temp_fp, 0, SEEK_SET); } else { @@ -474,9 +474,9 @@ * @param $encodingType The encoding type from the Content-Transfer-Encoding header of the part. */ private function decode($encodedString, $encodingType) { - if (strtolower($encodingType) == 'base64') { + if (@strtolower($encodingType) == 'base64') { return base64_decode($encodedString); - } else if (strtolower($encodingType) == 'quoted-printable') { + } else if (@strtolower($encodingType) == 'quoted-printable') { return quoted_printable_decode($encodedString); } else { return $encodedString; diff --git a/externals/mimemailparser/attachment.class.php b/externals/mimemailparser/attachment.class.php --- a/externals/mimemailparser/attachment.class.php +++ b/externals/mimemailparser/attachment.class.php @@ -79,11 +79,11 @@ */ public function getFileExtension() { if (!$this->extension) { - $ext = substr(strrchr($this->filename, '.'), 1); + $ext = @substr(strrchr($this->filename, '.'), 1); if ($ext == 'gz') { // special case, tar.gz // todo: other special cases? - $ext = preg_match("/\.tar\.gz$/i", $ext) ? 'tar.gz' : 'gz'; + $ext = @preg_match("/\.tar\.gz$/i", $ext) ? 'tar.gz' : 'gz'; } $this->extension = $ext; } diff --git a/externals/pear-figlet/Text/Figlet.php b/externals/pear-figlet/Text/Figlet.php --- a/externals/pear-figlet/Text/Figlet.php +++ b/externals/pear-figlet/Text/Figlet.php @@ -120,7 +120,7 @@ $this->font_comment = ''; // If Gzip compressed font - if (substr($filename, -3, 3) == '.gz') { + if (@substr($filename, -3, 3) == '.gz') { $filename = 'compress.zlib://' . $filename; $compressed = true; @@ -176,16 +176,16 @@ // Max_Length Old_Layout - $header = explode(' ', fgets($fp, 2048)); + $header = @explode(' ', fgets($fp, 2048)); - if (substr($header[0], 0, 5) <> 'flf2a') { + if (@substr($header[0], 0, 5) <> 'flf2a') { return self::raiseError('Unknown FIGlet font format.', 4); } @list ($this->hardblank, $this->height,,, $this->oldlayout, $cmt_count, $this->rtol) = $header; - $this->hardblank = substr($this->hardblank, -1, 1); + $this->hardblank = @substr($this->hardblank, -1, 1); for ($i = 0; $i < $cmt_count; $i++) { $this->font_comment .= fgets($fp, 2048); @@ -217,21 +217,21 @@ // Extented characters for ($n = 0; !feof($fp); $n++) { - list ($i) = explode(' ', rtrim(fgets($fp, 1024)), 2); + list ($i) = @explode(' ', rtrim(fgets($fp, 1024)), 2); if ($i == '') { continue; } // If comment - if (preg_match('/^\-0x/i', $i)) { + if (@preg_match('/^\-0x/i', $i)) { $this->_skip($fp); } else { // If Unicode - if (preg_match('/^0x/i', $i)) { - $i = hexdec(substr($i, 2)); + if (@preg_match('/^0x/i', $i)) { + $i = hexdec(@substr($i, 2)); } else { // If octal - if ($i{0} === '0' && $i !== '0' || substr($i, 0, 2) == '-0') { + if ($i{0} === '0' && $i !== '0' || @substr($i, 0, 2) == '-0') { $i = octdec($i); } } @@ -268,10 +268,10 @@ { $out = array(); - for ($i = 0; $iheight; $j++) { - if (preg_match("/\S(\s*\\x00\s*)\S/", $out[$j], $r)) { + if (@preg_match("/\S(\s*\\x00\s*)\S/", $out[$j], $r)) { if ($mindiff == -1) { - $mindiff = strlen($r[1]); + $mindiff = @strlen($r[1]); } else { - $mindiff = min($mindiff, strlen($r[1])); + $mindiff = min($mindiff, @strlen($r[1])); } } } @@ -326,8 +326,8 @@ if (--$mindiff > 0) { for ($j = 0; $j < $this->height; $j++) { - if (preg_match("/\\x00(\s{0,{$mindiff}})/", $out[$j], $r)) { - $l = strlen($r[1]); + if (@preg_match("/\\x00(\s{0,{$mindiff}})/", $out[$j], $r)) { + $l = @strlen($r[1]); $b = $mindiff - $l; $out[$j] = preg_replace("/\s{0,$b}\\x00\s{{$l}}/", "\0", @@ -395,8 +395,8 @@ if ($this->oldlayout & 2) { $symb = '|/\\[]{}()<>'; - if ($r[1] == '_' && strpos($symb, $r[2]) !== false || - $r[2] == '_' && strpos($symb, $r[1]) !== false) { + if ($r[1] == '_' && @strpos($symb, $r[2]) !== false || + $r[2] == '_' && @strpos($symb, $r[1]) !== false) { $this->smush_flag = 1; return $r[1]; } @@ -405,8 +405,8 @@ if ($this->oldlayout & 4) { $classes = '|/\\[]{}()<>'; - if (($left = strpos($classes, $r[1])) !== false) { - if (($right = strpos($classes, $r[2])) !== false) { + if (($left = @strpos($classes, $r[1])) !== false) { + if (($right = @strpos($classes, $r[2])) !== false) { $this->smush_flag = 1; return $right > $left ? $r[2] : $r[1]; } @@ -462,7 +462,7 @@ } $line = rtrim(fgets($fp, 2048), "\r\n"); - if (preg_match('/(.){1,2}$/', $line, $r)) { + if (@preg_match('/(.){1,2}$/', $line, $r)) { $line = str_replace($r[1], '', $line); } diff --git a/externals/pear-figlet/docs/examples/hello_world.php b/externals/pear-figlet/docs/examples/hello_world.php --- a/externals/pear-figlet/docs/examples/hello_world.php +++ b/externals/pear-figlet/docs/examples/hello_world.php @@ -11,7 +11,7 @@ $str = iconv('utf-8', 'ucs-2be', $str); $out = ''; - for ($i = 0, $len = strlen($str); $i<$len; $i++) { + for ($i = 0, $len = @strlen($str); $i<$len; $i++) { $code = ord($str[$i++]) * 256 + ord($str[$i]); $out .= $code < 128 ? $str[$i] : sprintf('%%u%04X', $code); diff --git a/externals/phpmailer/class.phpmailer-lite.php b/externals/phpmailer/class.phpmailer-lite.php --- a/externals/phpmailer/class.phpmailer-lite.php +++ b/externals/phpmailer/class.phpmailer-lite.php @@ -465,7 +465,7 @@ * @access private */ private function AddAnAddress($kind, $address, $name = '') { - if (!preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) { + if (!@preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) { echo 'Invalid recipient array: ' . $kind; return false; } @@ -480,14 +480,14 @@ return false; } if ($kind != 'ReplyTo') { - if (!isset($this->all_recipients[strtolower($address)])) { + if (!isset($this->all_recipients[@strtolower($address)])) { array_push($this->$kind, array($address, $name)); - $this->all_recipients[strtolower($address)] = true; + $this->all_recipients[@strtolower($address)] = true; return true; } } else { - if (!array_key_exists(strtolower($address), $this->ReplyTo)) { - $this->ReplyTo[strtolower($address)] = array($address, $name); + if (!array_key_exists(@strtolower($address), $this->ReplyTo)) { + $this->ReplyTo[@strtolower($address)] = array($address, $name); return true; } } @@ -543,7 +543,7 @@ return true; } } else { - return preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $address); + return @preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $address); } } @@ -618,7 +618,7 @@ */ protected function SendmailSend($header, $body) { if ($this->Sender != '') { - $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender)); + $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), @escapeshellarg($this->Sender)); } else { $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail)); } @@ -654,7 +654,7 @@ $to = implode(', ', $toArr); $params = sprintf("-oi -f %s", $this->Sender); - if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) { + if ($this->Sender != '' && @strlen(ini_get('safe_mode'))< 1) { $old_from = ini_get('sendmail_from'); ini_set('sendmail_from', $this->Sender); if ($this->SingleTo === true && count($toArr) > 1) { @@ -786,34 +786,34 @@ $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; // If utf-8 encoding is used, we will need to make sure we don't // split multibyte characters when we wrap - $is_utf8 = (strtolower($this->CharSet) == "utf-8"); + $is_utf8 = (@strtolower($this->CharSet) == "utf-8"); $message = $this->FixEOL($message); - if (substr($message, -1) == $this->LE) { - $message = substr($message, 0, -1); + if (@substr($message, -1) == $this->LE) { + $message = @substr($message, 0, -1); } - $line = explode($this->LE, $message); + $line = @explode($this->LE, $message); $message = ''; for ($i=0 ;$i < count($line); $i++) { - $line_part = explode(' ', $line[$i]); + $line_part = @explode(' ', $line[$i]); $buf = ''; for ($e = 0; $e $length)) { - $space_left = $length - strlen($buf) - 1; + if ($qp_mode and (@strlen($word) > $length)) { + $space_left = $length - @strlen($buf) - 1; if ($e != 0) { if ($space_left > 20) { $len = $space_left; if ($is_utf8) { $len = $this->UTF8CharBoundary($word, $len); - } elseif (substr($word, $len - 1, 1) == "=") { + } elseif (@substr($word, $len - 1, 1) == "=") { $len--; - } elseif (substr($word, $len - 2, 1) == "=") { + } elseif (@substr($word, $len - 2, 1) == "=") { $len -= 2; } - $part = substr($word, 0, $len); - $word = substr($word, $len); + $part = @substr($word, 0, $len); + $word = @substr($word, $len); $buf .= ' ' . $part; $message .= $buf . sprintf("=%s", $this->LE); } else { @@ -821,19 +821,19 @@ } $buf = ''; } - while (strlen($word) > 0) { + while (@strlen($word) > 0) { $len = $length; if ($is_utf8) { $len = $this->UTF8CharBoundary($word, $len); - } elseif (substr($word, $len - 1, 1) == "=") { + } elseif (@substr($word, $len - 1, 1) == "=") { $len--; - } elseif (substr($word, $len - 2, 1) == "=") { + } elseif (@substr($word, $len - 2, 1) == "=") { $len -= 2; } - $part = substr($word, 0, $len); - $word = substr($word, $len); + $part = @substr($word, 0, $len); + $word = @substr($word, $len); - if (strlen($word) > 0) { + if (@strlen($word) > 0) { $message .= $part . sprintf("=%s", $this->LE); } else { $buf = $part; @@ -843,7 +843,7 @@ $buf_o = $buf; $buf .= ($e == 0) ? $word : (' ' . $word); - if (strlen($buf) > $length and $buf_o != '') { + if (@strlen($buf) > $length and $buf_o != '') { $message .= $buf_o . $soft_break; $buf = $word; } @@ -868,12 +868,12 @@ $foundSplitPos = false; $lookBack = 3; while (!$foundSplitPos) { - $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack); - $encodedCharPos = strpos($lastChunk, "="); + $lastChunk = @substr($encodedText, $maxLength - $lookBack, $lookBack); + $encodedCharPos = @strpos($lastChunk, "="); if ($encodedCharPos !== false) { // Found start of encoded character byte within $lookBack block. // Check the encoded byte value (the 2 chars after the '=') - $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2); + $hex = @substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2); $dec = hexdec($hex); if ($dec < 128) { // Single byte character. // If the encoded char was found at pos 0, it will fit @@ -1144,16 +1144,16 @@ * @return void */ private function SetMessageType() { - if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) { + if(count($this->attachment) < 1 && @strlen($this->AltBody) < 1) { $this->message_type = 'plain'; } else { if(count($this->attachment) > 0) { $this->message_type = 'attachments'; } - if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) { + if(@strlen($this->AltBody) > 0 && count($this->attachment) < 1) { $this->message_type = 'alt'; } - if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) { + if(@strlen($this->AltBody) > 0 && count($this->attachment) > 0) { $this->message_type = 'alt_attachments'; } } @@ -1340,7 +1340,7 @@ */ public function EncodeString ($str, $encoding = 'base64') { $encoded = ''; - switch(strtolower($encoding)) { + switch(@strtolower($encoding)) { case 'base64': $encoded = chunk_split(base64_encode($str), 76, $this->LE); break; @@ -1348,7 +1348,7 @@ case '8bit': $encoded = $this->FixEOL($str); //Make sure it ends with a line break - if (substr($encoded, -(strlen($this->LE))) != $this->LE) + if (@substr($encoded, -(@strlen($this->LE))) != $this->LE) $encoded .= $this->LE; break; case 'binary': @@ -1372,12 +1372,12 @@ public function EncodeHeader($str, $position = 'text') { $x = 0; - switch (strtolower($position)) { + switch (@strtolower($position)) { case 'phrase': - if (!preg_match('/[\200-\377]/', $str)) { + if (!@preg_match('/[\200-\377]/', $str)) { // Can't use addslashes as we don't know what value has magic_quotes_sybase $encoded = addcslashes($str, "\0..\37\177\\\""); - if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { + if (($str == $encoded) && !@preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { return ($encoded); } else { return ("\"$encoded\""); @@ -1398,9 +1398,9 @@ return ($str); } - $maxlen = 75 - 7 - strlen($this->CharSet); + $maxlen = 75 - 7 - @strlen($this->CharSet); // Try to select the encoding which should produce the shortest output - if (strlen($str)/3 < $x) { + if (@strlen($str)/3 < $x) { $encoding = 'B'; if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) { // Use a custom function which correctly encodes and wraps long @@ -1432,7 +1432,7 @@ */ public function HasMultiBytes($str) { if (function_exists('mb_strlen')) { - return (strlen($str) > mb_strlen($str, $this->CharSet)); + return (@strlen($str) > mbstrlen($str, $this->CharSet)); } else { // Assume no multibytes (we can't handle without mbstring functions anyway) return false; } @@ -1451,11 +1451,11 @@ $end = "?="; $encoded = ""; - $mb_length = mb_strlen($str, $this->CharSet); + $mb_length = mbstrlen($str, $this->CharSet); // Each line must have length <= 75, including $start and $end - $length = 75 - strlen($start) - strlen($end); + $length = 75 - @strlen($start) - @strlen($end); // Average multi-byte ratio - $ratio = $mb_length / strlen($str); + $ratio = $mb_length / @strlen($str); // Base64 has a 4:3 ratio $offset = $avgLength = floor($length * $ratio * .75); @@ -1468,13 +1468,13 @@ $chunk = base64_encode($chunk); $lookBack++; } - while (strlen($chunk) > $length); + while (@strlen($chunk) > $length); $encoded .= $chunk . $this->LE; } // Chomp the last linefeed - $encoded = substr($encoded, 0, -strlen($this->LE)); + $encoded = @substr($encoded, 0, -@strlen($this->LE)); return $encoded; } @@ -1493,10 +1493,10 @@ $escape = '='; $output = ''; while( list(, $line) = each($lines) ) { - $linlen = strlen($line); + $linlen = @strlen($line); $newline = ''; for($i = 0; $i < $linlen; $i++) { - $c = substr( $line, $i, 1 ); + $c = @substr( $line, $i, 1 ); $dec = ord( $c ); if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E $c = '=2E'; @@ -1512,7 +1512,7 @@ $h1 = floor($dec%16); $c = $escape.$hex[$h2].$hex[$h1]; } - if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted + if ( (@strlen($newline) + @strlen($c)) >= $line_max ) { // CRLF is not counted $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay $newline = ''; // check if newline first character will be point or not @@ -1582,7 +1582,7 @@ // There should not be any EOL in the string $encoded = preg_replace('/[\r\n]*/', '', $str); - switch (strtolower($position)) { + switch (@strtolower($position)) { case 'phrase': $encoded = preg_replace_callback( "/([^A-Za-z0-9!*+\/ -])/", @@ -1699,7 +1699,7 @@ */ public function ClearAddresses() { foreach($this->to as $to) { - unset($this->all_recipients[strtolower($to[0])]); + unset($this->all_recipients[@strtolower($to[0])]); } $this->to = array(); } @@ -1710,7 +1710,7 @@ */ public function ClearCCs() { foreach($this->cc as $cc) { - unset($this->all_recipients[strtolower($cc[0])]); + unset($this->all_recipients[@strtolower($cc[0])]); } $this->cc = array(); } @@ -1721,7 +1721,7 @@ */ public function ClearBCCs() { foreach($this->bcc as $bcc) { - unset($this->all_recipients[strtolower($bcc[0])]); + unset($this->all_recipients[@strtolower($bcc[0])]); } $this->bcc = array(); } @@ -1854,7 +1854,7 @@ * @return void */ public function AddCustomHeader($custom_header) { - $this->CustomHeader[] = explode(':', $custom_header, 2); + $this->CustomHeader[] = @explode(':', $custom_header, 2); } /** @@ -1867,15 +1867,15 @@ if(isset($images[2])) { foreach($images[2] as $i => $url) { // do not change urls for absolute images (thanks to corvuscorax) - if (!preg_match('#^[A-z]+://#',$url)) { + if (!@preg_match('#^[A-z]+://#',$url)) { $filename = basename($url); $directory = dirname($url); ($directory == '.')?$directory='':''; $cid = 'cid:' . md5($filename); $ext = pathinfo($filename, PATHINFO_EXTENSION); $mimeType = self::_mime_types($ext); - if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; } - if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; } + if ( @strlen($basedir) > 1 && @substr($basedir,-1) != '/') { $basedir .= '/'; } + if ( @strlen($directory) > 1 && @substr($directory,-1) != '/') { $directory .= '/'; } if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) { $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message); } @@ -1990,7 +1990,7 @@ 'xl' => 'application/excel', 'eml' => 'message/rfc822' ); - return (!isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)]; + return (!isset($mimes[@strtolower($ext)])) ? 'application/octet-stream' : $mimes[@strtolower($ext)]; } /** @@ -2056,7 +2056,7 @@ public function DKIM_QP($txt) { $tmp=""; $line=""; - for ($i=0;$i$line) { - list($heading,$value)=explode(":",$line,2); - $heading=strtolower($heading); + list($heading,$value)=@explode(":",$line,2); + $heading=@strtolower($heading); $value=preg_replace("/\s+/"," ",$value) ; // Compress useless spaces $lines[$key]=$heading.":".trim($value) ; // Don't forget to remove WSP around the value } @@ -2116,8 +2116,8 @@ $body=str_replace("\r\n","\n",$body); $body=str_replace("\n","\r\n",$body); // END stabilize line endings - while (substr($body,strlen($body)-4,4) == "\r\n\r\n") { - $body=substr($body,0,strlen($body)-2); + while (@substr($body,@strlen($body)-4,4) == "\r\n\r\n") { + $body=@substr($body,0,@strlen($body)-2); } return $body; } @@ -2136,11 +2136,11 @@ $DKIMquery = 'dns/txt'; // Query method $DKIMtime = time() ; // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone) $subject_header = "Subject: $subject"; - $headers = explode("\r\n",$headers_line); + $headers = @explode("\r\n",$headers_line); foreach($headers as $header) { - if (strpos($header,'From:') === 0) { + if (@strpos($header,'From:') === 0) { $from_header=$header; - } elseif (strpos($header,'To:') === 0) { + } elseif (@strpos($header,'To:') === 0) { $to_header=$header; } } @@ -2148,7 +2148,7 @@ $to = str_replace('|','=7C',$this->DKIM_QP($to_header)); $subject = str_replace('|','=7C',$this->DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable $body = $this->DKIM_BodyC($body); - $DKIMlen = strlen($body) ; // Length of body + $DKIMlen = @strlen($body) ; // Length of body $DKIMb64 = base64_encode(pack("H*", sha1($body))) ; // Base64 of packed binary SHA-1 hash of body $ident = ($this->DKIM_identity == '')? '' : " i=" . $this->DKIM_identity . ";"; $dkimhdrs = "DKIM-Signature: v=1; a=" . $DKIMsignatureType . "; q=" . $DKIMquery . "; l=" . $DKIMlen . "; s=" . $this->DKIM_selector . ";\r\n". diff --git a/externals/phpmailer/class.phpmailer.php b/externals/phpmailer/class.phpmailer.php --- a/externals/phpmailer/class.phpmailer.php +++ b/externals/phpmailer/class.phpmailer.php @@ -450,7 +450,7 @@ * @access private */ private function AddAnAddress($kind, $address, $name = '') { - if (!preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) { + if (!@preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) { echo 'Invalid recipient array: ' . kind; return false; } @@ -465,14 +465,14 @@ return false; } if ($kind != 'ReplyTo') { - if (!isset($this->all_recipients[strtolower($address)])) { + if (!isset($this->all_recipients[@strtolower($address)])) { array_push($this->$kind, array($address, $name)); - $this->all_recipients[strtolower($address)] = true; + $this->all_recipients[@strtolower($address)] = true; return true; } } else { - if (!array_key_exists(strtolower($address), $this->ReplyTo)) { - $this->ReplyTo[strtolower($address)] = array($address, $name); + if (!array_key_exists(@strtolower($address), $this->ReplyTo)) { + $this->ReplyTo[@strtolower($address)] = array($address, $name); return true; } } @@ -528,7 +528,7 @@ return true; } } else { - return preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $address); + return @preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $address); } } @@ -597,7 +597,7 @@ */ protected function SendmailSend($header, $body) { if ($this->Sender != '') { - $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender)); + $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), @escapeshellarg($this->Sender)); } else { $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail)); } @@ -633,7 +633,7 @@ $to = implode(', ', $toArr); $params = sprintf("-oi -f %s", $this->Sender); - if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) { + if ($this->Sender != '' && @strlen(ini_get('safe_mode'))< 1) { $old_from = ini_get('sendmail_from'); ini_set('sendmail_from', $this->Sender); if ($this->SingleTo === true && count($toArr) > 1) { @@ -759,7 +759,7 @@ } $this->smtp->do_debug = $this->SMTPDebug; - $hosts = explode(';', $this->Host); + $hosts = @explode(';', $this->Host); $index = 0; $connection = $this->smtp->Connected(); @@ -767,7 +767,7 @@ try { while($index < count($hosts) && !$connection) { $hostinfo = array(); - if (preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) { + if (@preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) { $host = $hostinfo[1]; $port = $hostinfo[2]; } else { @@ -917,34 +917,34 @@ $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; // If utf-8 encoding is used, we will need to make sure we don't // split multibyte characters when we wrap - $is_utf8 = (strtolower($this->CharSet) == "utf-8"); + $is_utf8 = (@strtolower($this->CharSet) == "utf-8"); $message = $this->FixEOL($message); - if (substr($message, -1) == $this->LE) { - $message = substr($message, 0, -1); + if (@substr($message, -1) == $this->LE) { + $message = @substr($message, 0, -1); } - $line = explode($this->LE, $message); + $line = @explode($this->LE, $message); $message = ''; for ($i=0 ;$i < count($line); $i++) { - $line_part = explode(' ', $line[$i]); + $line_part = @explode(' ', $line[$i]); $buf = ''; for ($e = 0; $e $length)) { - $space_left = $length - strlen($buf) - 1; + if ($qp_mode and (@strlen($word) > $length)) { + $space_left = $length - @strlen($buf) - 1; if ($e != 0) { if ($space_left > 20) { $len = $space_left; if ($is_utf8) { $len = $this->UTF8CharBoundary($word, $len); - } elseif (substr($word, $len - 1, 1) == "=") { + } elseif (@substr($word, $len - 1, 1) == "=") { $len--; - } elseif (substr($word, $len - 2, 1) == "=") { + } elseif (@substr($word, $len - 2, 1) == "=") { $len -= 2; } - $part = substr($word, 0, $len); - $word = substr($word, $len); + $part = @substr($word, 0, $len); + $word = @substr($word, $len); $buf .= ' ' . $part; $message .= $buf . sprintf("=%s", $this->LE); } else { @@ -952,19 +952,19 @@ } $buf = ''; } - while (strlen($word) > 0) { + while (@strlen($word) > 0) { $len = $length; if ($is_utf8) { $len = $this->UTF8CharBoundary($word, $len); - } elseif (substr($word, $len - 1, 1) == "=") { + } elseif (@substr($word, $len - 1, 1) == "=") { $len--; - } elseif (substr($word, $len - 2, 1) == "=") { + } elseif (@substr($word, $len - 2, 1) == "=") { $len -= 2; } - $part = substr($word, 0, $len); - $word = substr($word, $len); + $part = @substr($word, 0, $len); + $word = @substr($word, $len); - if (strlen($word) > 0) { + if (@strlen($word) > 0) { $message .= $part . sprintf("=%s", $this->LE); } else { $buf = $part; @@ -974,7 +974,7 @@ $buf_o = $buf; $buf .= ($e == 0) ? $word : (' ' . $word); - if (strlen($buf) > $length and $buf_o != '') { + if (@strlen($buf) > $length and $buf_o != '') { $message .= $buf_o . $soft_break; $buf = $word; } @@ -999,12 +999,12 @@ $foundSplitPos = false; $lookBack = 3; while (!$foundSplitPos) { - $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack); - $encodedCharPos = strpos($lastChunk, "="); + $lastChunk = @substr($encodedText, $maxLength - $lookBack, $lookBack); + $encodedCharPos = @strpos($lastChunk, "="); if ($encodedCharPos !== false) { // Found start of encoded character byte within $lookBack block. // Check the encoded byte value (the 2 chars after the '=') - $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2); + $hex = @substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2); $dec = hexdec($hex); if ($dec < 128) { // Single byte character. // If the encoded char was found at pos 0, it will fit @@ -1276,16 +1276,16 @@ * @return void */ private function SetMessageType() { - if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) { + if(count($this->attachment) < 1 && @strlen($this->AltBody) < 1) { $this->message_type = 'plain'; } else { if(count($this->attachment) > 0) { $this->message_type = 'attachments'; } - if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) { + if(@strlen($this->AltBody) > 0 && count($this->attachment) < 1) { $this->message_type = 'alt'; } - if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) { + if(@strlen($this->AltBody) > 0 && count($this->attachment) > 0) { $this->message_type = 'alt_attachments'; } } @@ -1472,7 +1472,7 @@ */ public function EncodeString ($str, $encoding = 'base64') { $encoded = ''; - switch(strtolower($encoding)) { + switch(@strtolower($encoding)) { case 'base64': $encoded = chunk_split(base64_encode($str), 76, $this->LE); break; @@ -1480,7 +1480,7 @@ case '8bit': $encoded = $this->FixEOL($str); //Make sure it ends with a line break - if (substr($encoded, -(strlen($this->LE))) != $this->LE) + if (@substr($encoded, -(@strlen($this->LE))) != $this->LE) $encoded .= $this->LE; break; case 'binary': @@ -1504,12 +1504,12 @@ public function EncodeHeader($str, $position = 'text') { $x = 0; - switch (strtolower($position)) { + switch (@strtolower($position)) { case 'phrase': - if (!preg_match('/[\200-\377]/', $str)) { + if (!@preg_match('/[\200-\377]/', $str)) { // Can't use addslashes as we don't know what value has magic_quotes_sybase $encoded = addcslashes($str, "\0..\37\177\\\""); - if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { + if (($str == $encoded) && !@preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { return ($encoded); } else { return ("\"$encoded\""); @@ -1530,9 +1530,9 @@ return ($str); } - $maxlen = 75 - 7 - strlen($this->CharSet); + $maxlen = 75 - 7 - @strlen($this->CharSet); // Try to select the encoding which should produce the shortest output - if (strlen($str)/3 < $x) { + if (@strlen($str)/3 < $x) { $encoding = 'B'; if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) { // Use a custom function which correctly encodes and wraps long @@ -1564,7 +1564,7 @@ */ public function HasMultiBytes($str) { if (function_exists('mb_strlen')) { - return (strlen($str) > mb_strlen($str, $this->CharSet)); + return (@strlen($str) > mbstrlen($str, $this->CharSet)); } else { // Assume no multibytes (we can't handle without mbstring functions anyway) return false; } @@ -1583,11 +1583,11 @@ $end = "?="; $encoded = ""; - $mb_length = mb_strlen($str, $this->CharSet); + $mb_length = mbstrlen($str, $this->CharSet); // Each line must have length <= 75, including $start and $end - $length = 75 - strlen($start) - strlen($end); + $length = 75 - @strlen($start) - @strlen($end); // Average multi-byte ratio - $ratio = $mb_length / strlen($str); + $ratio = $mb_length / @strlen($str); // Base64 has a 4:3 ratio $offset = $avgLength = floor($length * $ratio * .75); @@ -1600,13 +1600,13 @@ $chunk = base64_encode($chunk); $lookBack++; } - while (strlen($chunk) > $length); + while (@strlen($chunk) > $length); $encoded .= $chunk . $this->LE; } // Chomp the last linefeed - $encoded = substr($encoded, 0, -strlen($this->LE)); + $encoded = @substr($encoded, 0, -@strlen($this->LE)); return $encoded; } @@ -1625,10 +1625,10 @@ $escape = '='; $output = ''; while( list(, $line) = each($lines) ) { - $linlen = strlen($line); + $linlen = @strlen($line); $newline = ''; for($i = 0; $i < $linlen; $i++) { - $c = substr( $line, $i, 1 ); + $c = @substr( $line, $i, 1 ); $dec = ord( $c ); if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E $c = '=2E'; @@ -1644,7 +1644,7 @@ $h1 = floor($dec%16); $c = $escape.$hex[$h2].$hex[$h1]; } - if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted + if ( (@strlen($newline) + @strlen($c)) >= $line_max ) { // CRLF is not counted $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay $newline = ''; // check if newline first character will be point or not @@ -1714,7 +1714,7 @@ // There should not be any EOL in the string $encoded = preg_replace('/[\r\n]*/', '', $str); - switch (strtolower($position)) { + switch (@strtolower($position)) { case 'phrase': $encoded = preg_replace_callback( "/([^A-Za-z0-9!*+\/ -])/", @@ -1831,7 +1831,7 @@ */ public function ClearAddresses() { foreach($this->to as $to) { - unset($this->all_recipients[strtolower($to[0])]); + unset($this->all_recipients[@strtolower($to[0])]); } $this->to = array(); } @@ -1842,7 +1842,7 @@ */ public function ClearCCs() { foreach($this->cc as $cc) { - unset($this->all_recipients[strtolower($cc[0])]); + unset($this->all_recipients[@strtolower($cc[0])]); } $this->cc = array(); } @@ -1853,7 +1853,7 @@ */ public function ClearBCCs() { foreach($this->bcc as $bcc) { - unset($this->all_recipients[strtolower($bcc[0])]); + unset($this->all_recipients[@strtolower($bcc[0])]); } $this->bcc = array(); } @@ -1992,7 +1992,7 @@ * @return void */ public function AddCustomHeader($custom_header) { - $this->CustomHeader[] = explode(':', $custom_header, 2); + $this->CustomHeader[] = @explode(':', $custom_header, 2); } /** @@ -2005,15 +2005,15 @@ if(isset($images[2])) { foreach($images[2] as $i => $url) { // do not change urls for absolute images (thanks to corvuscorax) - if (!preg_match('#^[A-z]+://#',$url)) { + if (!@preg_match('#^[A-z]+://#',$url)) { $filename = basename($url); $directory = dirname($url); ($directory == '.')?$directory='':''; $cid = 'cid:' . md5($filename); $ext = pathinfo($filename, PATHINFO_EXTENSION); $mimeType = self::_mime_types($ext); - if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; } - if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; } + if ( @strlen($basedir) > 1 && @substr($basedir,-1) != '/') { $basedir .= '/'; } + if ( @strlen($directory) > 1 && @substr($directory,-1) != '/') { $directory .= '/'; } if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) { $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message); } @@ -2128,7 +2128,7 @@ 'xl' => 'application/excel', 'eml' => 'message/rfc822' ); - return (!isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)]; + return (!isset($mimes[@strtolower($ext)])) ? 'application/octet-stream' : $mimes[@strtolower($ext)]; } /** @@ -2194,7 +2194,7 @@ public function DKIM_QP($txt) { $tmp=""; $line=""; - for ($i=0;$i$line) { - list($heading,$value)=explode(":",$line,2); - $heading=strtolower($heading); + list($heading,$value)=@explode(":",$line,2); + $heading=@strtolower($heading); $value=preg_replace("/\s+/"," ",$value) ; // Compress useless spaces $lines[$key]=$heading.":".trim($value) ; // Don't forget to remove WSP around the value } @@ -2254,8 +2254,8 @@ $body=str_replace("\r\n","\n",$body); $body=str_replace("\n","\r\n",$body); // END stabilize line endings - while (substr($body,strlen($body)-4,4) == "\r\n\r\n") { - $body=substr($body,0,strlen($body)-2); + while (@substr($body,@strlen($body)-4,4) == "\r\n\r\n") { + $body=@substr($body,0,@strlen($body)-2); } return $body; } @@ -2274,11 +2274,11 @@ $DKIMquery = 'dns/txt'; // Query method $DKIMtime = time() ; // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone) $subject_header = "Subject: $subject"; - $headers = explode("\r\n",$headers_line); + $headers = @explode("\r\n",$headers_line); foreach($headers as $header) { - if (strpos($header,'From:') === 0) { + if (@strpos($header,'From:') === 0) { $from_header=$header; - } elseif (strpos($header,'To:') === 0) { + } elseif (@strpos($header,'To:') === 0) { $to_header=$header; } } @@ -2286,7 +2286,7 @@ $to = str_replace('|','=7C',$this->DKIM_QP($to_header)); $subject = str_replace('|','=7C',$this->DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable $body = $this->DKIM_BodyC($body); - $DKIMlen = strlen($body) ; // Length of body + $DKIMlen = @strlen($body) ; // Length of body $DKIMb64 = base64_encode(pack("H*", sha1($body))) ; // Base64 of packed binary SHA-1 hash of body $ident = ($this->DKIM_identity == '')? '' : " i=" . $this->DKIM_identity . ";"; $dkimhdrs = "DKIM-Signature: v=1; a=" . $DKIMsignatureType . "; q=" . $DKIMquery . "; l=" . $DKIMlen . "; s=" . $this->DKIM_selector . ";\r\n". diff --git a/externals/phpmailer/class.pop3.php b/externals/phpmailer/class.pop3.php --- a/externals/phpmailer/class.pop3.php +++ b/externals/phpmailer/class.pop3.php @@ -245,7 +245,7 @@ stream_set_timeout($this->pop_conn, $tval, 0); } else { // Does not work on Windows - if (substr(PHP_OS, 0, 3) !== 'WIN') { + if (@substr(PHP_OS, 0, 3) !== 'WIN') { socket_set_timeout($this->pop_conn, $tval, 0); } } @@ -342,7 +342,7 @@ * @return integer */ private function sendString ($string) { - $bytes_sent = fwrite($this->pop_conn, $string, strlen($string)); + $bytes_sent = fwrite($this->pop_conn, $string, @strlen($string)); return $bytes_sent; } @@ -354,7 +354,7 @@ * @return boolean */ private function checkResponse ($string) { - if (substr($string, 0, 3) !== '+OK') { + if (@substr($string, 0, 3) !== '+OK') { $this->error = array( 'error' => "Server reported an error: $string", 'errno' => 0, diff --git a/externals/phpmailer/class.smtp.php b/externals/phpmailer/class.smtp.php --- a/externals/phpmailer/class.smtp.php +++ b/externals/phpmailer/class.smtp.php @@ -143,7 +143,7 @@ // SMTP server can take longer to respond, give longer timeout for first read // Windows does not have support for this timeout function - if(substr(PHP_OS, 0, 3) != "WIN") + if(@substr(PHP_OS, 0, 3) != "WIN") socket_set_timeout($this->smtp_conn, $tval, 0); // get any announcement @@ -176,7 +176,7 @@ fputs($this->smtp_conn,"STARTTLS" . $this->CRLF); $rply = $this->get_lines(); - $code = substr($rply,0,3); + $code = @substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; @@ -186,7 +186,7 @@ $this->error = array("error" => "STARTTLS not accepted from server", "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); + "smtp_msg" => @substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; } @@ -212,13 +212,13 @@ fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF); $rply = $this->get_lines(); - $code = substr($rply,0,3); + $code = @substr($rply,0,3); if($code != 334) { $this->error = array("error" => "AUTH not accepted from server", "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); + "smtp_msg" => @substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; } @@ -229,13 +229,13 @@ fputs($this->smtp_conn, base64_encode($username) . $this->CRLF); $rply = $this->get_lines(); - $code = substr($rply,0,3); + $code = @substr($rply,0,3); if($code != 334) { $this->error = array("error" => "Username not accepted from server", "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); + "smtp_msg" => @substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; } @@ -246,13 +246,13 @@ fputs($this->smtp_conn, base64_encode($password) . $this->CRLF); $rply = $this->get_lines(); - $code = substr($rply,0,3); + $code = @substr($rply,0,3); if($code != 235) { $this->error = array("error" => "Password not accepted from server", "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); + "smtp_msg" => @substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; } @@ -335,7 +335,7 @@ fputs($this->smtp_conn,"DATA" . $this->CRLF); $rply = $this->get_lines(); - $code = substr($rply,0,3); + $code = @substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; @@ -345,7 +345,7 @@ $this->error = array("error" => "DATA command not accepted from server", "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); + "smtp_msg" => @substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; } @@ -366,7 +366,7 @@ // normalize the line breaks so we know the explode works $msg_data = str_replace("\r\n","\n",$msg_data); $msg_data = str_replace("\r","\n",$msg_data); - $lines = explode("\n",$msg_data); + $lines = @explode("\n",$msg_data); /* we need to find a good way to determine is headers are * in the msg_data or if it is a straight msg body @@ -377,7 +377,7 @@ * headers. */ - $field = substr($lines[0],0,strpos($lines[0],":")); + $field = @substr($lines[0],0,@strpos($lines[0],":")); $in_headers = false; if(!empty($field) && !strstr($field," ")) { $in_headers = true; @@ -391,17 +391,17 @@ $in_headers = false; } // ok we need to break this line up into several smaller lines - while(strlen($line) > $max_line_length) { - $pos = strrpos(substr($line,0,$max_line_length)," "); + while(@strlen($line) > $max_line_length) { + $pos = strrpos(@substr($line,0,$max_line_length)," "); // Patch to fix DOS attack if(!$pos) { $pos = $max_line_length - 1; - $lines_out[] = substr($line,0,$pos); - $line = substr($line,$pos); + $lines_out[] = @substr($line,0,$pos); + $line = @substr($line,$pos); } else { - $lines_out[] = substr($line,0,$pos); - $line = substr($line,$pos + 1); + $lines_out[] = @substr($line,0,$pos); + $line = @substr($line,$pos + 1); } /* if processing headers add a LWSP-char to the front of new line @@ -415,9 +415,9 @@ // send the lines to the server while(list(,$line_out) = @each($lines_out)) { - if(strlen($line_out) > 0) + if(@strlen($line_out) > 0) { - if(substr($line_out, 0, 1) == ".") { + if(@substr($line_out, 0, 1) == ".") { $line_out = "." . $line_out; } } @@ -429,7 +429,7 @@ fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF); $rply = $this->get_lines(); - $code = substr($rply,0,3); + $code = @substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; @@ -439,7 +439,7 @@ $this->error = array("error" => "DATA not accepted from server", "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); + "smtp_msg" => @substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; } @@ -494,7 +494,7 @@ fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF); $rply = $this->get_lines(); - $code = substr($rply,0,3); + $code = @substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER: " . $rply . $this->CRLF . '
'; @@ -504,7 +504,7 @@ $this->error = array("error" => $hello . " not accepted from server", "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); + "smtp_msg" => @substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; } @@ -543,7 +543,7 @@ fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF); $rply = $this->get_lines(); - $code = substr($rply,0,3); + $code = @substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; @@ -553,7 +553,7 @@ $this->error = array("error" => "MAIL not accepted from server", "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); + "smtp_msg" => @substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; } @@ -595,12 +595,12 @@ $rval = true; $e = null; - $code = substr($byemsg,0,3); + $code = @substr($byemsg,0,3); if($code != 221) { // use e as a tmp var cause Close will overwrite $this->error $e = array("error" => "SMTP server rejected quit command", "smtp_code" => $code, - "smtp_rply" => substr($byemsg,4)); + "smtp_rply" => @substr($byemsg,4)); $rval = false; if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF . '
'; @@ -638,7 +638,7 @@ fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF); $rply = $this->get_lines(); - $code = substr($rply,0,3); + $code = @substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; @@ -648,7 +648,7 @@ $this->error = array("error" => "RCPT not accepted from server", "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); + "smtp_msg" => @substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; } @@ -681,7 +681,7 @@ fputs($this->smtp_conn,"RSET" . $this->CRLF); $rply = $this->get_lines(); - $code = substr($rply,0,3); + $code = @substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; @@ -691,7 +691,7 @@ $this->error = array("error" => "RSET failed", "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); + "smtp_msg" => @substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; } @@ -729,7 +729,7 @@ fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF); $rply = $this->get_lines(); - $code = substr($rply,0,3); + $code = @substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; @@ -739,7 +739,7 @@ $this->error = array("error" => "SAML not accepted from server", "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); + "smtp_msg" => @substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; } @@ -804,7 +804,7 @@ echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF . '
'; } // if 4th character is a space, we are done reading, break the loop - if(substr($str,3,1) == " ") { break; } + if(@substr($str,3,1) == " ") { break; } } return $data; } diff --git a/externals/phpqrcode/phpqrcode.php b/externals/phpqrcode/phpqrcode.php --- a/externals/phpqrcode/phpqrcode.php +++ b/externals/phpqrcode/phpqrcode.php @@ -97,7 +97,7 @@ class qrstr { public static function set(&$srctab, $x, $y, $repl, $replLen = false) { - $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl)); + $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?@substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:@strlen($repl)); } } @@ -177,7 +177,7 @@ $barcode_array = array(); if (!is_array($mode)) - $mode = explode(',', $mode); + $mode = @explode(',', $mode); $eccLevel = 'L'; @@ -258,7 +258,7 @@ //---------------------------------------------------------------------- public static function markTime($markerId) { - list($usec, $sec) = explode(" ", microtime()); + list($usec, $sec) = @explode(" ", microtime()); $time = ((float)$usec + (float)$sec); if (!isset($GLOBALS['qr_time_bench'])) @@ -802,8 +802,8 @@ if ($binary_mode) { foreach ($frame as &$frameLine) { - $frameLine = join('  ', explode('0', $frameLine)); - $frameLine = join('██', explode('1', $frameLine)); + $frameLine = join('  ', @explode('0', $frameLine)); + $frameLine = join('██', @explode('1', $frameLine)); } ?> @@ -818,19 +818,19 @@ } else { foreach ($frame as &$frameLine) { - $frameLine = join(' ', explode("\xc0", $frameLine)); - $frameLine = join('', explode("\xc1", $frameLine)); - $frameLine = join(' ', explode("\xa0", $frameLine)); - $frameLine = join('', explode("\xa1", $frameLine)); - $frameLine = join('', explode("\x84", $frameLine)); //format 0 - $frameLine = join('', explode("\x85", $frameLine)); //format 1 - $frameLine = join('', explode("\x81", $frameLine)); //special bit - $frameLine = join(' ', explode("\x90", $frameLine)); //clock 0 - $frameLine = join('', explode("\x91", $frameLine)); //clock 1 - $frameLine = join(' ', explode("\x88", $frameLine)); //version - $frameLine = join('', explode("\x89", $frameLine)); //version - $frameLine = join('♦', explode("\x01", $frameLine)); - $frameLine = join('⋅', explode("\0", $frameLine)); + $frameLine = join(' ', @explode("\xc0", $frameLine)); + $frameLine = join('', @explode("\xc1", $frameLine)); + $frameLine = join(' ', @explode("\xa0", $frameLine)); + $frameLine = join('', @explode("\xa1", $frameLine)); + $frameLine = join('', @explode("\x84", $frameLine)); //format 0 + $frameLine = join('', @explode("\x85", $frameLine)); //format 1 + $frameLine = join('', @explode("\x81", $frameLine)); //special bit + $frameLine = join(' ', @explode("\x90", $frameLine)); //clock 0 + $frameLine = join('', @explode("\x91", $frameLine)); //clock 1 + $frameLine = join(' ', @explode("\x88", $frameLine)); //version + $frameLine = join('', @explode("\x89", $frameLine)); //version + $frameLine = join('♦', @explode("\x01", $frameLine)); + $frameLine = join('⋅', @explode("\0", $frameLine)); } ?> @@ -859,7 +859,7 @@ //---------------------------------------------------------------------- public static function unserial($code) { - return explode("\n", gzuncompress($code)); + return @explode("\n", gzuncompress($code)); } //---------------------------------------------------------------------- @@ -977,7 +977,7 @@ private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4) { $h = count($frame); - $w = strlen($frame[0]); + $w = @strlen($frame[0]); $imgW = $w + 2*$outerFrame; $imgH = $h + 2*$outerFrame; @@ -1984,7 +1984,7 @@ //---------------------------------------------------------------------- public static function isdigitat($str, $pos) { - if ($pos >= strlen($str)) + if ($pos >= @strlen($str)) return false; return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9'))); @@ -1993,7 +1993,7 @@ //---------------------------------------------------------------------- public static function isalnumat($str, $pos) { - if ($pos >= strlen($str)) + if ($pos >= @strlen($str)) return false; return (QRinput::lookAnTable(ord($str[$pos])) >= 0); @@ -2002,7 +2002,7 @@ //---------------------------------------------------------------------- public function identifyMode($pos) { - if ($pos >= strlen($this->dataStr)) + if ($pos >= @strlen($this->dataStr)) return QR_MODE_NUL; $c = $this->dataStr[$pos]; @@ -2013,7 +2013,7 @@ return QR_MODE_AN; } else if($this->modeHint == QR_MODE_KANJI) { - if ($pos+1 < strlen($this->dataStr)) + if ($pos+1 < @strlen($this->dataStr)) { $d = $this->dataStr[$pos+1]; $word = (ord($c) << 8) | ord($d); @@ -2133,7 +2133,7 @@ $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion()); $p = 1; - $dataStrLen = strlen($this->dataStr); + $dataStrLen = @strlen($this->dataStr); while($p < $dataStrLen) { @@ -2184,7 +2184,7 @@ //---------------------------------------------------------------------- public function splitString() { - while (strlen($this->dataStr) > 0) + while (@strlen($this->dataStr) > 0) { if($this->dataStr == '') return 0; @@ -2206,18 +2206,18 @@ if($length == 0) return 0; if($length < 0) return -1; - $this->dataStr = substr($this->dataStr, $length); + $this->dataStr = @substr($this->dataStr, $length); } } //---------------------------------------------------------------------- public function toUpper() { - $stringLen = strlen($this->dataStr); + $stringLen = @strlen($this->dataStr); $p = 0; while ($p<$stringLen) { - $mode = self::identifyMode(substr($this->dataStr, $p), $this->modeHint); + $mode = self::identifyMode(@substr($this->dataStr, $p), $this->modeHint); if($mode == QR_MODE_KANJI) { $p += 2; } else { @@ -2602,7 +2602,7 @@ { $codeArr = array(); - $codeLines = explode("\n", gzuncompress($code)); + $codeLines = @explode("\n", gzuncompress($code)); foreach ($codeLines as $line) $codeArr[] = str_split($line); @@ -3059,7 +3059,7 @@ $input = new QRinput($version, $level); if($input == NULL) return NULL; - $ret = $input->append($input, QR_MODE_8, strlen($string), str_split($string)); + $ret = $input->append($input, QR_MODE_8, @strlen($string), str_split($string)); if($ret < 0) { unset($input); return NULL; diff --git a/externals/porter-stemmer/src/Porter.php b/externals/porter-stemmer/src/Porter.php --- a/externals/porter-stemmer/src/Porter.php +++ b/externals/porter-stemmer/src/Porter.php @@ -63,7 +63,7 @@ */ public static function Stem($word) { - if (strlen($word) <= 2) { + if (@strlen($word) <= 2) { return $word; } @@ -83,7 +83,7 @@ private static function step1ab($word) { // Part a - if (substr($word, -1) == 's') { + if (@substr($word, -1) == 's') { self::replace($word, 'sses', 'ss') OR self::replace($word, 'ies', 'i') @@ -92,12 +92,12 @@ } // Part b - if (substr($word, -2, 1) != 'e' OR !self::replace($word, 'eed', 'ee', 0)) { // First rule + if (@substr($word, -2, 1) != 'e' OR !self::replace($word, 'eed', 'ee', 0)) { // First rule $v = self::$regex_vowel; // ing and ed - if ( preg_match("#$v+#", substr($word, 0, -3)) && self::replace($word, 'ing', '') - OR preg_match("#$v+#", substr($word, 0, -2)) && self::replace($word, 'ed', '')) { // Note use of && and OR, for precedence reasons + if ( @preg_match("#$v+#", @substr($word, 0, -3)) && self::replace($word, 'ing', '') + OR @preg_match("#$v+#", @substr($word, 0, -2)) && self::replace($word, 'ed', '')) { // Note use of && and OR, for precedence reasons // If one of above two test successful if ( !self::replace($word, 'at', 'ate') @@ -106,11 +106,11 @@ // Double consonant ending if ( self::doubleConsonant($word) - AND substr($word, -2) != 'll' - AND substr($word, -2) != 'ss' - AND substr($word, -2) != 'zz') { + AND @substr($word, -2) != 'll' + AND @substr($word, -2) != 'ss' + AND @substr($word, -2) != 'zz') { - $word = substr($word, 0, -1); + $word = @substr($word, 0, -1); } elseif (self::m($word) == 1 AND self::cvc($word)) { $word .= 'e'; @@ -131,7 +131,7 @@ { $v = self::$regex_vowel; - if (substr($word, -1) == 'y' && preg_match("#$v+#", substr($word, 0, -1))) { + if (@substr($word, -1) == 'y' && @preg_match("#$v+#", @substr($word, 0, -1))) { self::replace($word, 'y', 'i'); } @@ -145,7 +145,7 @@ */ private static function step2($word) { - switch (substr($word, -2, 1)) { + switch (@substr($word, -2, 1)) { case 'a': self::replace($word, 'ational', 'ate', 0) OR self::replace($word, 'tional', 'tion', 0); @@ -202,7 +202,7 @@ */ private static function step3($word) { - switch (substr($word, -2, 1)) { + switch (@substr($word, -2, 1)) { case 'a': self::replace($word, 'ical', 'ic', 0); break; @@ -239,7 +239,7 @@ */ private static function step4($word) { - switch (substr($word, -2, 1)) { + switch (@substr($word, -2, 1)) { case 'a': self::replace($word, 'al', '', 1); break; @@ -270,7 +270,7 @@ break; case 'o': - if (substr($word, -4) == 'tion' OR substr($word, -4) == 'sion') { + if (@substr($word, -4) == 'tion' OR @substr($word, -4) == 'sion') { self::replace($word, 'ion', '', 1); } else { self::replace($word, 'ou', '', 1); @@ -310,21 +310,21 @@ private static function step5($word) { // Part a - if (substr($word, -1) == 'e') { - if (self::m(substr($word, 0, -1)) > 1) { + if (@substr($word, -1) == 'e') { + if (self::m(@substr($word, 0, -1)) > 1) { self::replace($word, 'e', ''); - } elseif (self::m(substr($word, 0, -1)) == 1) { + } elseif (self::m(@substr($word, 0, -1)) == 1) { - if (!self::cvc(substr($word, 0, -1))) { + if (!self::cvc(@substr($word, 0, -1))) { self::replace($word, 'e', ''); } } } // Part b - if (self::m($word) > 1 AND self::doubleConsonant($word) AND substr($word, -1) == 'l') { - $word = substr($word, 0, -1); + if (self::m($word) > 1 AND self::doubleConsonant($word) AND @substr($word, -1) == 'l') { + $word = @substr($word, 0, -1); } return $word; @@ -347,10 +347,10 @@ */ private static function replace(&$str, $check, $repl, $m = null) { - $len = 0 - strlen($check); + $len = 0 - @strlen($check); - if (substr($str, $len) == $check) { - $substr = substr($str, 0, $len); + if (@substr($str, $len) == $check) { + $substr = @substr($str, 0, $len); if (is_null($m) OR self::m($substr) > $m) { $str = $substr . $repl; } @@ -402,7 +402,7 @@ { $c = self::$regex_consonant; - return preg_match("#$c{2}$#", $str, $matches) AND $matches[0][0] == $matches[0][1]; + return @preg_match("#$c{2}$#", $str, $matches) AND $matches[0][0] == $matches[0][1]; } /** @@ -417,8 +417,8 @@ $c = self::$regex_consonant; $v = self::$regex_vowel; - return preg_match("#($c$v$c)$#", $str, $matches) - AND strlen($matches[1]) == 3 + return @preg_match("#($c$v$c)$#", $str, $matches) + AND @strlen($matches[1]) == 3 AND $matches[1][2] != 'w' AND $matches[1][2] != 'x' AND $matches[1][2] != 'y'; diff --git a/externals/stripe-php/lib/Stripe/ApiRequestor.php b/externals/stripe-php/lib/Stripe/ApiRequestor.php --- a/externals/stripe-php/lib/Stripe/ApiRequestor.php +++ b/externals/stripe-php/lib/Stripe/ApiRequestor.php @@ -223,7 +223,7 @@ } $curl = curl_init(); - $method = strtolower($method); + $method = @strtolower($method); $opts = array(); if ($method == 'get') { $opts[CURLOPT_HTTPGET] = 1; @@ -342,7 +342,7 @@ return true; } - if (strpos(PHP_VERSION, 'hiphop') !== false) { + if (@strpos(PHP_VERSION, 'hiphop') !== false) { error_log( 'Warning: HHVM does not support Stripe\'s SSL certificate '. 'verification. (See http://docs.hhvm.com/manual/en/context.ssl.php) '. @@ -400,7 +400,7 @@ public static function isBlackListed($certificate) { $certificate = trim($certificate); - $lines = explode("\n", $certificate); + $lines = @explode("\n", $certificate); // Kludgily remove the PEM padding array_shift($lines); array_pop($lines); diff --git a/externals/stripe-php/lib/Stripe/ApiResource.php b/externals/stripe-php/lib/Stripe/ApiResource.php --- a/externals/stripe-php/lib/Stripe/ApiResource.php +++ b/externals/stripe-php/lib/Stripe/ApiResource.php @@ -36,18 +36,18 @@ { // Useful for namespaces: Foo\Stripe_Charge if ($postfixNamespaces = strrchr($class, '\\')) { - $class = substr($postfixNamespaces, 1); + $class = @substr($postfixNamespaces, 1); } // Useful for underscored 'namespaces': Foo_Stripe_Charge if ($postfixFakeNamespaces = strrchr($class, 'Stripe_')) { $class = $postfixFakeNamespaces; } - if (substr($class, 0, strlen('Stripe')) == 'Stripe') { - $class = substr($class, strlen('Stripe')); + if (@substr($class, 0, @strlen('Stripe')) == 'Stripe') { + $class = @substr($class, @strlen('Stripe')); } $class = str_replace('_', '', $class); $name = urlencode($class); - $name = strtolower($name); + $name = @strtolower($name); return $name; } diff --git a/externals/xhprof/xhprof_lib.php b/externals/xhprof/xhprof_lib.php --- a/externals/xhprof/xhprof_lib.php +++ b/externals/xhprof/xhprof_lib.php @@ -70,7 +70,7 @@ * @author Kannan */ function xhprof_parse_parent_child($parent_child) { - $ret = explode("==>", $parent_child); + $ret = @explode("==>", $parent_child); // Return if both parent and child are set if (isset($ret[1])) { @@ -315,10 +315,10 @@ if ($use_script_name) { // if this is an old edge originating from main(), it now // needs to be from '__script::$page' - if (substr($parent_child, 0, 9) == "main()==>") { - $child =substr($parent_child, 9); + if (@substr($parent_child, 0, 9) == "main()==>") { + $child =@substr($parent_child, 9); // ignore the newly added edge from main() - if (substr($child, 0, 10) != "__script::") { + if (@substr($child, 0, 10) != "__script::") { $parent_child = xhprof_build_parent_child_key("__script::$page", $child); } @@ -764,7 +764,7 @@ // trim leading/trailing whitespace $val = trim($val); - switch (strtolower($val)) { + switch (@strtolower($val)) { case '0': case '1': $val = (bool)$val; diff --git a/resources/sql/autopatches/20140108.ddbpname.2.php b/resources/sql/autopatches/20140108.ddbpname.2.php --- a/resources/sql/autopatches/20140108.ddbpname.2.php +++ b/resources/sql/autopatches/20140108.ddbpname.2.php @@ -10,7 +10,7 @@ echo pht('Populating blueprint %d...', $id)."\n"; - if (!strlen($blueprint->getBlueprintName())) { + if (!@strlen($blueprint->getBlueprintName())) { queryfx( $conn_w, 'UPDATE %T SET blueprintName = %s WHERE id = %d', diff --git a/resources/sql/autopatches/20140210.projcfield.1.blurb.php b/resources/sql/autopatches/20140210.projcfield.1.blurb.php --- a/resources/sql/autopatches/20140210.projcfield.1.blurb.php +++ b/resources/sql/autopatches/20140210.projcfield.1.blurb.php @@ -10,7 +10,7 @@ $phid = $row['projectPHID']; $desc = $row['blurb']; - if (strlen($desc)) { + if (@strlen($desc)) { queryfx( $conn_w, 'INSERT IGNORE INTO %T (objectPHID, fieldIndex, fieldValue) diff --git a/resources/sql/autopatches/20140211.dx.2.migcommenttext.php b/resources/sql/autopatches/20140211.dx.2.migcommenttext.php --- a/resources/sql/autopatches/20140211.dx.2.migcommenttext.php +++ b/resources/sql/autopatches/20140211.dx.2.migcommenttext.php @@ -10,7 +10,7 @@ foreach ($rows as $row) { $id = $row['id']; echo pht('Migrating Differential comment %d...', $id)."\n"; - if (!strlen($row['content'])) { + if (!@strlen($row['content'])) { echo pht('Comment has no text, continuing.')."\n"; continue; } diff --git a/resources/sql/autopatches/20140410.accountsecret.2.php b/resources/sql/autopatches/20140410.accountsecret.2.php --- a/resources/sql/autopatches/20140410.accountsecret.2.php +++ b/resources/sql/autopatches/20140410.accountsecret.2.php @@ -6,7 +6,7 @@ $id = $user->getID(); echo pht('Updating %d...', $id)."\n"; - if (strlen($user->getAccountSecret())) { + if (@strlen($user->getAccountSecret())) { continue; } diff --git a/resources/sql/autopatches/20140722.audit.4.migtext.php b/resources/sql/autopatches/20140722.audit.4.migtext.php --- a/resources/sql/autopatches/20140722.audit.4.migtext.php +++ b/resources/sql/autopatches/20140722.audit.4.migtext.php @@ -10,7 +10,7 @@ foreach ($rows as $row) { $id = $row['id']; echo pht('Migrating Audit comment %d...', $id)."\n"; - if (!strlen($row['content'])) { + if (!@strlen($row['content'])) { echo pht('Comment has no text, continuing.')."\n"; continue; } diff --git a/resources/sql/autopatches/20141107.phriction.policy.2.php b/resources/sql/autopatches/20141107.phriction.policy.2.php --- a/resources/sql/autopatches/20141107.phriction.policy.2.php +++ b/resources/sql/autopatches/20141107.phriction.policy.2.php @@ -25,8 +25,8 @@ $slug = $doc->getSlug(); $slug = PhabricatorSlug::normalize($slug); $prefix = 'projects/'; - if (($slug != $prefix) && (strncmp($slug, $prefix, strlen($prefix)) === 0)) { - $parts = explode('/', $slug); + if (($slug != $prefix) && (strncmp($slug, $prefix, @strlen($prefix)) === 0)) { + $parts = @explode('/', $slug); $project_slug = $parts[1]; $project_slug = PhabricatorSlug::normalizeProjectSlug($project_slug); diff --git a/resources/sql/autopatches/20141107.phriction.popkeys.php b/resources/sql/autopatches/20141107.phriction.popkeys.php --- a/resources/sql/autopatches/20141107.phriction.popkeys.php +++ b/resources/sql/autopatches/20141107.phriction.popkeys.php @@ -9,7 +9,7 @@ $id = $doc->getID(); $key = $doc->getMailKey(); - if ((strlen($key) == 20) && (strpos($key, "\0") === false)) { + if ((@strlen($key) == 20) && (@strpos($key, "\0") === false)) { // To be valid, keys must have length 20 and not contain any null bytes. // See T6487. echo pht('Document has valid mailkey.')."\n"; diff --git a/resources/sql/autopatches/20150506.calendarunnamedevents.1.php b/resources/sql/autopatches/20150506.calendarunnamedevents.1.php --- a/resources/sql/autopatches/20150506.calendarunnamedevents.1.php +++ b/resources/sql/autopatches/20150506.calendarunnamedevents.1.php @@ -8,7 +8,7 @@ foreach ($iterator as $event) { $id = $event->getID(); - if (strlen($event->getName()) == 0) { + if (@strlen($event->getName()) == 0) { echo pht('Renaming event %d...', $id)."\n"; $viewer = PhabricatorUser::getOmnipotentUser(); diff --git a/resources/sql/autopatches/20150602.mlist.2.php b/resources/sql/autopatches/20150602.mlist.2.php --- a/resources/sql/autopatches/20150602.mlist.2.php +++ b/resources/sql/autopatches/20150602.mlist.2.php @@ -14,7 +14,7 @@ $username = preg_replace('/[^a-zA-Z0-9_-]+/', '-', $name); $username = preg_replace('/-{2,}/', '-', $username); $username = trim($username, '-'); - if (!strlen($username)) { + if (!@strlen($username)) { $username = 'mailinglist'; } $username .= '-list'; diff --git a/resources/sql/autopatches/20151210.land.2.refphid.php b/resources/sql/autopatches/20151210.land.2.refphid.php --- a/resources/sql/autopatches/20151210.land.2.refphid.php +++ b/resources/sql/autopatches/20151210.land.2.refphid.php @@ -4,7 +4,7 @@ $conn_w = $table->establishConnection('w'); foreach (new LiskMigrationIterator($table) as $cursor) { - if (strlen($cursor->getPHID())) { + if (@strlen($cursor->getPHID())) { continue; } diff --git a/resources/sql/autopatches/20151218.key.2.keyphid.php b/resources/sql/autopatches/20151218.key.2.keyphid.php --- a/resources/sql/autopatches/20151218.key.2.keyphid.php +++ b/resources/sql/autopatches/20151218.key.2.keyphid.php @@ -4,7 +4,7 @@ $conn_w = $table->establishConnection('w'); foreach (new LiskMigrationIterator($table) as $cursor) { - if (strlen($cursor->getPHID())) { + if (@strlen($cursor->getPHID())) { continue; } diff --git a/resources/sql/autopatches/20151223.proj.05.updatekeys.php b/resources/sql/autopatches/20151223.proj.05.updatekeys.php --- a/resources/sql/autopatches/20151223.proj.05.updatekeys.php +++ b/resources/sql/autopatches/20151223.proj.05.updatekeys.php @@ -7,12 +7,12 @@ $path = $project->getProjectPath(); $key = $project->getProjectPathKey(); - if (strlen($path) && ($key !== "\0\0\0\0")) { + if (@strlen($path) && ($key !== "\0\0\0\0")) { continue; } $path_key = PhabricatorHash::digestForIndex($project->getPHID()); - $path_key = substr($path_key, 0, 4); + $path_key = @substr($path_key, 0, 4); queryfx( $conn_w, diff --git a/resources/sql/autopatches/20160110.repo.02.slug.php b/resources/sql/autopatches/20160110.repo.02.slug.php --- a/resources/sql/autopatches/20160110.repo.02.slug.php +++ b/resources/sql/autopatches/20160110.repo.02.slug.php @@ -12,7 +12,7 @@ $clone_name = $repository->getDetail('clone-name'); - if (!strlen($clone_name)) { + if (!@strlen($clone_name)) { continue; } diff --git a/resources/sql/autopatches/20160202.ipv6.2.php b/resources/sql/autopatches/20160202.ipv6.2.php --- a/resources/sql/autopatches/20160202.ipv6.2.php +++ b/resources/sql/autopatches/20160202.ipv6.2.php @@ -11,7 +11,7 @@ $addr = $row->getRemoteAddress(); $addr = (string)$addr; - if (!strlen($addr)) { + if (!@strlen($addr)) { continue; } @@ -24,7 +24,7 @@ } $ip = long2ip($addr); - if (!is_string($ip) || !strlen($ip)) { + if (!is_string($ip) || !@strlen($ip)) { continue; } diff --git a/resources/sql/autopatches/20160503.repo.03.lpathmigrate.php b/resources/sql/autopatches/20160503.repo.03.lpathmigrate.php --- a/resources/sql/autopatches/20160503.repo.03.lpathmigrate.php +++ b/resources/sql/autopatches/20160503.repo.03.lpathmigrate.php @@ -8,13 +8,13 @@ foreach (new LiskMigrationIterator($table) as $repository) { $local_path = $repository->getLocalPath(); - if (strlen($local_path)) { + if (@strlen($local_path)) { // Repository already has a modern, unique local path. continue; } $local_path = $repository->getDetail('local-path'); - if (!strlen($local_path)) { + if (!@strlen($local_path)) { // Repository does not have a local path using the older format. continue; } diff --git a/resources/sql/autopatches/20160503.repo.05.urimigrate.php b/resources/sql/autopatches/20160503.repo.05.urimigrate.php --- a/resources/sql/autopatches/20160503.repo.05.urimigrate.php +++ b/resources/sql/autopatches/20160503.repo.05.urimigrate.php @@ -51,7 +51,7 @@ if (!$repository->isHosted()) { $remote_uri = $repository->getDetail('remote-uri'); - if (strlen($remote_uri)) { + if (@strlen($remote_uri)) { $uris[] = PhabricatorRepositoryURI::initializeNewURI() ->setRepositoryPHID($repository->getPHID()) ->attachRepository($repository) diff --git a/resources/sql/autopatches/20160601.user.02.copyprefs.php b/resources/sql/autopatches/20160601.user.02.copyprefs.php --- a/resources/sql/autopatches/20160601.user.02.copyprefs.php +++ b/resources/sql/autopatches/20160601.user.02.copyprefs.php @@ -28,17 +28,17 @@ } $zone = $row['timezoneIdentifier']; - if (strlen($zone)) { + if (@strlen($zone)) { $prefs[PhabricatorTimezoneSetting::SETTINGKEY] = $zone; } $pronoun = $row['sex']; - if (strlen($pronoun)) { + if (@strlen($pronoun)) { $prefs[PhabricatorPronounSetting::SETTINGKEY] = $pronoun; } $translation = $row['translation']; - if (strlen($translation)) { + if (@strlen($translation)) { $prefs[PhabricatorTranslationSetting::SETTINGKEY] = $translation; } diff --git a/resources/sql/autopatches/20170528.maniphestdupes.php b/resources/sql/autopatches/20170528.maniphestdupes.php --- a/resources/sql/autopatches/20170528.maniphestdupes.php +++ b/resources/sql/autopatches/20170528.maniphestdupes.php @@ -32,7 +32,7 @@ $pattern = '/^\xE2\x9C\x98 Merged into T(\d+)\.$/'; $matches = array(); - if (preg_match($pattern, $comment, $matches)) { + if (@preg_match($pattern, $comment, $matches)) { $dst_task = id(new ManiphestTaskQuery()) ->setViewer($viewer) ->withIDs(array($matches[1])) diff --git a/resources/sql/autopatches/20180215.phriction.02.phidvalues.php b/resources/sql/autopatches/20180215.phriction.02.phidvalues.php --- a/resources/sql/autopatches/20180215.phriction.02.phidvalues.php +++ b/resources/sql/autopatches/20180215.phriction.02.phidvalues.php @@ -4,7 +4,7 @@ $conn = $table->establishConnection('w'); foreach (new LiskMigrationIterator($table) as $row) { - if (strlen($row->getPHID())) { + if (@strlen($row->getPHID())) { continue; } diff --git a/resources/sql/autopatches/20181031.board.01.queryreset.php b/resources/sql/autopatches/20181031.board.01.queryreset.php --- a/resources/sql/autopatches/20181031.board.01.queryreset.php +++ b/resources/sql/autopatches/20181031.board.01.queryreset.php @@ -15,7 +15,7 @@ foreach ($iterator as $project) { $default_filter = $project->getDefaultWorkboardFilter(); - if (!strlen($default_filter)) { + if (!@strlen($default_filter)) { continue; } diff --git a/resources/sql/autopatches/20181213.auth.02.populatephid.php b/resources/sql/autopatches/20181213.auth.02.populatephid.php --- a/resources/sql/autopatches/20181213.auth.02.populatephid.php +++ b/resources/sql/autopatches/20181213.auth.02.populatephid.php @@ -5,7 +5,7 @@ $conn = $table->establishConnection('w'); foreach ($iterator as $session) { - if (strlen($session->getPHID())) { + if (@strlen($session->getPHID())) { continue; } diff --git a/resources/sql/autopatches/20190115.mfa.02.migrate.php b/resources/sql/autopatches/20190115.mfa.02.migrate.php --- a/resources/sql/autopatches/20190115.mfa.02.migrate.php +++ b/resources/sql/autopatches/20190115.mfa.02.migrate.php @@ -27,7 +27,7 @@ } // This factor already has an associated provider. - if (strlen($row['factorProviderPHID'])) { + if (@strlen($row['factorProviderPHID'])) { continue; } diff --git a/resources/sql/autopatches/20190206.external.04.providerlink.php b/resources/sql/autopatches/20190206.external.04.providerlink.php --- a/resources/sql/autopatches/20190206.external.04.providerlink.php +++ b/resources/sql/autopatches/20190206.external.04.providerlink.php @@ -8,7 +8,7 @@ $config_conn = $config_table->establishConnection('w'); foreach (new LiskRawMigrationIterator($account_conn, $table_name) as $row) { - if (strlen($row['providerConfigPHID'])) { + if (@strlen($row['providerConfigPHID'])) { continue; } diff --git a/resources/sql/autopatches/20191114.email.02.populate.php b/resources/sql/autopatches/20191114.email.02.populate.php --- a/resources/sql/autopatches/20191114.email.02.populate.php +++ b/resources/sql/autopatches/20191114.email.02.populate.php @@ -7,7 +7,7 @@ foreach ($iterator as $row) { $phid = $row['phid']; - if (!strlen($phid)) { + if (!@strlen($phid)) { queryfx( $conn, 'UPDATE %R SET phid = %s WHERE id = %d', diff --git a/resources/sql/autopatches/20200222.xident.01.migrate.php b/resources/sql/autopatches/20200222.xident.01.migrate.php --- a/resources/sql/autopatches/20200222.xident.01.migrate.php +++ b/resources/sql/autopatches/20200222.xident.01.migrate.php @@ -18,7 +18,7 @@ } $account_id = $account_row['accountID']; - if (!strlen($account_id)) { + if (!@strlen($account_id)) { continue; } diff --git a/resources/sql/autopatches/20210215.changeset.02.phid-populate.php b/resources/sql/autopatches/20210215.changeset.02.phid-populate.php --- a/resources/sql/autopatches/20210215.changeset.02.phid-populate.php +++ b/resources/sql/autopatches/20210215.changeset.02.phid-populate.php @@ -36,7 +36,7 @@ foreach ($chunk as $changeset_row) { $phid = $changeset_row['phid']; - if (strlen($phid)) { + if (@strlen($phid)) { continue; } diff --git a/resources/sql/autopatches/20210802.legalpad_document_signature.02.phid-populate.php b/resources/sql/autopatches/20210802.legalpad_document_signature.02.phid-populate.php --- a/resources/sql/autopatches/20210802.legalpad_document_signature.02.phid-populate.php +++ b/resources/sql/autopatches/20210802.legalpad_document_signature.02.phid-populate.php @@ -36,7 +36,7 @@ foreach ($chunk as $docsig_row) { $phid = $docsig_row['phid']; - if (strlen($phid)) { + if (@strlen($phid)) { continue; } diff --git a/resources/sql/patches/090.forceuniqueprojectnames.php b/resources/sql/patches/090.forceuniqueprojectnames.php --- a/resources/sql/patches/090.forceuniqueprojectnames.php +++ b/resources/sql/patches/090.forceuniqueprojectnames.php @@ -12,7 +12,7 @@ foreach ($projects as $project) { $slug = PhabricatorSlug::normalizeProjectSlug($project->getName()); - if (!strlen($slug)) { + if (!@strlen($slug)) { $project_id = $project->getID(); echo pht("Project #%d doesn't have a meaningful name...", $project_id)."\n"; $project->setName(trim(pht('Unnamed Project %s', $project->getName()))); diff --git a/resources/sql/patches/093.gitremotes.php b/resources/sql/patches/093.gitremotes.php --- a/resources/sql/patches/093.gitremotes.php +++ b/resources/sql/patches/093.gitremotes.php @@ -16,11 +16,11 @@ $details = json_decode($repo['details'], true); $old = idx($details, 'default-branch', ''); - if (strpos($old, '/') === false) { + if (@strpos($old, '/') === false) { continue; } - $parts = explode('/', $old); + $parts = @explode('/', $old); $parts = array_filter($parts); $new = end($parts); diff --git a/resources/sql/patches/20130219.commitsummarymig.php b/resources/sql/patches/20130219.commitsummarymig.php --- a/resources/sql/patches/20130219.commitsummarymig.php +++ b/resources/sql/patches/20130219.commitsummarymig.php @@ -8,7 +8,7 @@ foreach ($commits as $commit) { echo pht('Filling Commit #%d', $commit->getID())."\n"; - if (strlen($commit->getSummary())) { + if (@strlen($commit->getSummary())) { continue; } diff --git a/resources/sql/patches/20130921.xmigratemaniphest.php b/resources/sql/patches/20130921.xmigratemaniphest.php --- a/resources/sql/patches/20130921.xmigratemaniphest.php +++ b/resources/sql/patches/20130921.xmigratemaniphest.php @@ -28,7 +28,7 @@ $task_phid = $task_row['phid']; - $has_comment = strlen(trim($row['comments'])); + $has_comment = @strlen(trim($row['comments'])); $xaction_type = $row['transactionType']; $xaction_old = $row['oldValue']; @@ -46,7 +46,7 @@ $xaction_type = PhabricatorTransactions::TYPE_CUSTOMFIELD; $aux_key = idx($xaction_meta, 'aux:key'); - if (!preg_match('/^std:maniphest:/', $aux_key)) { + if (!@preg_match('/^std:maniphest:/', $aux_key)) { $aux_key = 'std:maniphest:'.$aux_key; } diff --git a/resources/sql/patches/20131106.diffphid.2.mig.php b/resources/sql/patches/20131106.diffphid.2.mig.php --- a/resources/sql/patches/20131106.diffphid.2.mig.php +++ b/resources/sql/patches/20131106.diffphid.2.mig.php @@ -16,7 +16,7 @@ echo pht('Migrating diff ID %d...', $id)."\n"; $phid = $diff->getPHID(); - if (strlen($phid)) { + if (@strlen($phid)) { continue; } diff --git a/scripts/celerity/generate_emoji.php b/scripts/celerity/generate_emoji.php --- a/scripts/celerity/generate_emoji.php +++ b/scripts/celerity/generate_emoji.php @@ -32,7 +32,7 @@ $data = array(); foreach ($emojis as $shortname => $emoji) { $unicode = $emoji['unicode']; - $codes = explode('-', $unicode); + $codes = @explode('-', $unicode); $hex = ''; foreach ($codes as $code) { $hex .= phutil_utf8_encode_codepoint(hexdec($code)); diff --git a/scripts/mail/mail_handler.php b/scripts/mail/mail_handler.php --- a/scripts/mail/mail_handler.php +++ b/scripts/mail/mail_handler.php @@ -5,7 +5,7 @@ // Some day, we could take a shot at cleaning this up. if ($argc > 1) { foreach (array_slice($argv, 1) as $arg) { - if (!preg_match('/^-/', $arg)) { + if (!@preg_match('/^-/', $arg)) { $_SERVER['PHABRICATOR_ENV'] = $arg; break; } @@ -39,14 +39,14 @@ foreach (array('text', 'html') as $part) { $part_body = $parser->getMessageBody($part); - if (strlen($part_body) && !phutil_is_utf8($part_body)) { + if (@strlen($part_body) && !phutil_is_utf8($part_body)) { $part_headers = $parser->getMessageBodyHeaders($part); if (!is_array($part_headers)) { $part_headers = array(); } $content_type = idx($part_headers, 'content-type'); - if (preg_match('/charset="(.*?)"/', $content_type, $matches) || - preg_match('/charset=(\S+)/', $content_type, $matches)) { + if (@preg_match('/charset="(.*?)"/', $content_type, $matches) || + @preg_match('/charset=(\S+)/', $content_type, $matches)) { $part_body = phutil_utf8_convert($part_body, 'UTF-8', $matches[1]); } } @@ -68,7 +68,7 @@ $attachments = array(); foreach ($parser->getAttachments() as $attachment) { - if (preg_match('@text/(plain|html)@', $attachment->getContentType()) && + if (@preg_match('@text/(plain|html)@', $attachment->getContentType()) && $attachment->getContentDisposition() == 'inline') { // If this is an "inline" attachment with some sort of text content-type, // do not treat it as a file for attachment. MimeMailParser already picked diff --git a/scripts/repository/commit_hook.php b/scripts/repository/commit_hook.php --- a/scripts/repository/commit_hook.php +++ b/scripts/repository/commit_hook.php @@ -21,7 +21,7 @@ if ($argc > 1) { $context = $argv[1]; - $context = explode(':', $context, 2); + $context = @explode(':', $context, 2); $argv[1] = $context[0]; if (count($context) > 1) { @@ -119,7 +119,7 @@ exit($err); } else if ($repository->isGit() || $repository->isHg()) { $username = getenv(DiffusionCommitHookEngine::ENV_USER); - if (!strlen($username)) { + if (!@strlen($username)) { throw new Exception( pht( 'No Direct Pushes: You are pushing directly to a repository hosted '. @@ -181,17 +181,17 @@ $engine->setOriginalArgv(array_slice($argv, 2)); $remote_address = getenv(DiffusionCommitHookEngine::ENV_REMOTE_ADDRESS); -if (strlen($remote_address)) { +if (@strlen($remote_address)) { $engine->setRemoteAddress($remote_address); } $remote_protocol = getenv(DiffusionCommitHookEngine::ENV_REMOTE_PROTOCOL); -if (strlen($remote_protocol)) { +if (@strlen($remote_protocol)) { $engine->setRemoteProtocol($remote_protocol); } $request_identifier = getenv(DiffusionCommitHookEngine::ENV_REQUEST); -if (strlen($request_identifier)) { +if (@strlen($request_identifier)) { $engine->setRequestIdentifier($request_identifier); } diff --git a/scripts/sql/manage_storage.php b/scripts/sql/manage_storage.php --- a/scripts/sql/manage_storage.php +++ b/scripts/sql/manage_storage.php @@ -95,7 +95,7 @@ $host = $args->getArg('host'); $ref_key = $args->getArg('ref'); -if (strlen($host) || strlen($ref_key)) { +if (@strlen($host) || @strlen($ref_key)) { if ($host && $ref_key) { throw new PhutilArgumentUsageException( pht( diff --git a/scripts/ssh/ssh-auth.php b/scripts/ssh/ssh-auth.php --- a/scripts/ssh/ssh-auth.php +++ b/scripts/ssh/ssh-auth.php @@ -36,7 +36,7 @@ $authstruct = null; -if (strlen($authstruct_raw)) { +if (@strlen($authstruct_raw)) { try { $authstruct = phutil_json_decode($authstruct_raw); } catch (Exception $ex) { @@ -82,13 +82,13 @@ // Strip out newlines and other nonsense from the key type and key body. $type = $ssh_key->getKeyType(); $type = preg_replace('@[\x00-\x20]+@', '', $type); - if (!strlen($type)) { + if (!@strlen($type)) { continue; } $key = $ssh_key->getKeyBody(); $key = preg_replace('@[\x00-\x20]+@', '', $key); - if (!strlen($key)) { + if (!@strlen($key)) { continue; } @@ -135,7 +135,7 @@ $cmd = csprintf('%s %Ls', $bin, $key_argv); - if (strlen($instance)) { + if (@strlen($instance)) { $cmd = csprintf('PHABRICATOR_INSTANCE=%s %C', $instance, $cmd); } diff --git a/scripts/ssh/ssh-connect.php b/scripts/ssh/ssh-connect.php --- a/scripts/ssh/ssh-connect.php +++ b/scripts/ssh/ssh-connect.php @@ -105,7 +105,7 @@ $passthru_args = $unconsumed_argv; $host = array_shift($passthru_args); -$parts = explode(':', $host, 2); +$parts = @explode(':', $host, 2); $host = $parts[0]; $port = $args->getArg('port'); diff --git a/scripts/ssh/ssh-exec.php b/scripts/ssh/ssh-exec.php --- a/scripts/ssh/ssh-exec.php +++ b/scripts/ssh/ssh-exec.php @@ -71,7 +71,7 @@ $ssh_client = getenv('SSH_CLIENT'); if ($ssh_client) { // This has the format " ". Grab the IP. - $remote_address = head(explode(' ', $ssh_client)); + $remote_address = head(@explode(' ', $ssh_client)); $ssh_log->setData( array( 'r' => $remote_address, @@ -103,7 +103,7 @@ '--phabricator-ssh-device', $user_name, $device_name)); - } else if (strlen($user_name)) { + } else if (@strlen($user_name)) { $user = id(new PhabricatorPeopleQuery()) ->setViewer(PhabricatorUser::getOmnipotentUser()) ->withUsernames(array($user_name)) @@ -117,7 +117,7 @@ id(new PhabricatorAuthSessionEngine()) ->willServeRequestForUser($user); - } else if (strlen($device_name)) { + } else if (@strlen($device_name)) { if (!$remote_address) { throw new Exception( pht( @@ -178,9 +178,9 @@ // If we're authenticating as a device, the first argument may be a // "@username" argument to act as a particular user. $first_argument = head($original_argv); - if (preg_match('/^@/', $first_argument)) { + if (@preg_match('/^@/', $first_argument)) { $act_as_name = array_shift($original_argv); - $act_as_name = substr($act_as_name, 1); + $act_as_name = @substr($act_as_name, 1); $user = id(new PhabricatorPeopleQuery()) ->setViewer(PhabricatorUser::getOmnipotentUser()) ->withUsernames(array($act_as_name)) diff --git a/scripts/symbols/clear_repository_symbols.php b/scripts/symbols/clear_repository_symbols.php --- a/scripts/symbols/clear_repository_symbols.php +++ b/scripts/symbols/clear_repository_symbols.php @@ -40,7 +40,7 @@ $input = file_get_contents('php://stdin'); $normalized = array(); -foreach (explode("\n", trim($input)) as $path) { +foreach (@explode("\n", trim($input)) as $path) { // Emulate the behavior of the symbol generation scripts. $normalized[] = '/'.ltrim($path, './'); } diff --git a/scripts/symbols/generate_ctags_symbols.php b/scripts/symbols/generate_ctags_symbols.php --- a/scripts/symbols/generate_ctags_symbols.php +++ b/scripts/symbols/generate_ctags_symbols.php @@ -38,8 +38,8 @@ $data = array(); $futures = array(); -foreach (explode("\n", trim($input)) as $file) { - if (!strlen($file)) { +foreach (@explode("\n", trim($input)) as $file) { + if (!@strlen($file)) { continue; } @@ -50,10 +50,10 @@ $futures = new FutureIterator($futures); foreach ($futures->limit(8) as $file => $future) { $tags = $future->resolve(); - $tags = explode("\n", $tags[1]); + $tags = @explode("\n", $tags[1]); foreach ($tags as $tag) { - $parts = explode(';', $tag); + $parts = @explode(';', $tag); // Skip lines that we can not parse. if (count($parts) < 2) { @@ -61,11 +61,11 @@ } // Split ctags information. - $tag_info = explode("\t", $parts[0]); + $tag_info = @explode("\t", $parts[0]); // Split exuberant ctags "extension fields" (additional information). $parts[1] = trim($parts[1], "\t \""); - $extension_fields = explode("\t", $parts[1]); + $extension_fields = @explode("\t", $parts[1]); // Skip lines that we can not parse. if (count($tag_info) < 3 || count($extension_fields) < 2) { @@ -78,12 +78,12 @@ list($type, $language, $context) = $extension_fields; // Skip lines with tokens containing a space. - if (strpos($token, ' ') !== false) { + if (@strpos($token, ' ') !== false) { continue; } // Strip "language:" - $language = substr($language, 9); + $language = @substr($language, 9); // To keep consistent with "Separate with commas, for example: php, py" // in Arcanist Project edit form. @@ -94,10 +94,10 @@ $language = str_ireplace('c#', 'cs', $language); // Ruby has "singleton method", for example. - $type = substr(str_replace(' ', '_', $type), 0, 12); + $type = @substr(str_replace(' ', '_', $type), 0, 12); // class:foo, struct:foo, union:foo, enum:foo, ... - $context = last(explode(':', $context, 2)); + $context = last(@explode(':', $context, 2)); $ignore = array( 'variable' => true, @@ -120,7 +120,7 @@ function print_symbol($file, $line_num, $type, $token, $context, $language) { // Get rid of relative path. - $file = explode('/', $file); + $file = @explode('/', $file); if ($file[0] == '.' || $file[0] == '..') { array_shift($file); } @@ -130,7 +130,7 @@ $context, $token, $type, - strtolower($language), + @strtolower($language), $line_num, $file, ); diff --git a/scripts/symbols/generate_php_symbols.php b/scripts/symbols/generate_php_symbols.php --- a/scripts/symbols/generate_php_symbols.php +++ b/scripts/symbols/generate_php_symbols.php @@ -26,8 +26,8 @@ $data = array(); $futures = array(); -foreach (explode("\n", trim($input)) as $file) { - if (!strlen($file)) { +foreach (@explode("\n", trim($input)) as $file) { + if (!@strlen($file)) { continue; } diff --git a/scripts/symbols/import_repository_symbols.php b/scripts/symbols/import_repository_symbols.php --- a/scripts/symbols/import_repository_symbols.php +++ b/scripts/symbols/import_repository_symbols.php @@ -64,7 +64,7 @@ $input = file_get_contents('php://stdin'); $input = trim($input); -$input = explode("\n", $input); +$input = @explode("\n", $input); function commit_symbols( @@ -117,7 +117,7 @@ } function check_string_value($value, $field_name, $line_no, $max_length) { - if (strlen($value) > $max_length) { + if (@strlen($value) > $max_length) { throw new Exception( pht( "%s '%s' defined on line #%d is too long, ". @@ -146,7 +146,7 @@ try { $line_no = $key + 1; $matches = null; - $ok = preg_match( + $ok = @preg_match( '/^((?P[^ ]+)? )?(?P[^ ]+) (?P[^ ]+) '. '(?P[^ ]+) (?P\d+) (?P.*)$/', $line, @@ -178,7 +178,7 @@ check_string_value($lang, pht('Symbol language'), $line_no, 32); check_string_value($path, pht('Path'), $line_no, 512); - if (!strlen($path) || $path[0] != '/') { + if (!@strlen($path) || $path[0] != '/') { throw new Exception( pht( "Path '%s' defined on line #%d is invalid. Paths should begin with ". diff --git a/scripts/util/add_macro.php b/scripts/util/add_macro.php --- a/scripts/util/add_macro.php +++ b/scripts/util/add_macro.php @@ -38,7 +38,7 @@ $name = $args->getArg('as'); if ($name === null) { - $name = head(explode('.', basename($path))); + $name = head(@explode('.', basename($path))); } $existing = id(new PhabricatorFileImageMacro())->loadOneWhere( diff --git a/src/aphront/AphrontRequest.php b/src/aphront/AphrontRequest.php --- a/src/aphront/AphrontRequest.php +++ b/src/aphront/AphrontRequest.php @@ -66,11 +66,11 @@ } public static function parseURILineRange($range, $limit) { - if (!strlen($range)) { + if (!@strlen($range)) { return null; } - $range = explode('-', $range, 2); + $range = @explode('-', $range, 2); foreach ($range as $key => $value) { $value = (int)$value; @@ -234,7 +234,7 @@ $raw_data = phutil_string_cast($this->requestData[$name]); $raw_data = trim($raw_data); - if (!strlen($raw_data)) { + if (!@strlen($raw_data)) { return $default; } @@ -448,7 +448,7 @@ } private function getPrefixedCookieName($name) { - if (strlen($this->cookiePrefix)) { + if (@strlen($this->cookiePrefix)) { return $this->cookiePrefix.'_'.$name; } else { return $name; @@ -499,7 +499,7 @@ // domain is. This makes setup easier, and we'll tell administrators to // configure a base domain during the setup process. $base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri'); - if (!strlen($base_uri)) { + if (!@strlen($base_uri)) { return new PhutilURI('http://'.$host.'/'); } @@ -897,14 +897,14 @@ // NOTE: apache_request_headers() might provide a nicer way to do this, // but isn't available under FCGI until PHP 5.4.0. foreach ($_SERVER as $key => $value) { - if (!preg_match('/^HTTP_/', $key)) { + if (!@preg_match('/^HTTP_/', $key)) { continue; } // Unmangle the header as best we can. - $key = substr($key, strlen('HTTP_')); + $key = @substr($key, @strlen('HTTP_')); $key = str_replace('_', ' ', $key); - $key = strtolower($key); + $key = @strtolower($key); $key = ucwords($key); $key = str_replace(' ', '-', $key); @@ -912,7 +912,7 @@ $should_forward = false; // Forward "X-Hgarg-..." headers. - if (preg_match('/^X-Hgarg-/', $key)) { + if (@preg_match('/^X-Hgarg-/', $key)) { $should_forward = true; } @@ -956,7 +956,7 @@ $submit_cookie = PhabricatorCookies::COOKIE_SUBMIT; $submit_key = $this->getCookie($submit_cookie); - if (strlen($submit_key)) { + if (@strlen($submit_key)) { $this->clearCookie($submit_cookie); $this->submitKey = $submit_key; } diff --git a/src/aphront/__tests__/AphrontRoutingMapTestCase.php b/src/aphront/__tests__/AphrontRoutingMapTestCase.php --- a/src/aphront/__tests__/AphrontRoutingMapTestCase.php +++ b/src/aphront/__tests__/AphrontRoutingMapTestCase.php @@ -37,7 +37,7 @@ $pattern = implode('', $path); $pattern = '('.$pattern.')'; - $ok = @preg_match($pattern, ''); + $ok = @@preg_match($pattern, ''); $this->assertTrue( ($ok !== false), diff --git a/src/aphront/configuration/AphrontApplicationConfiguration.php b/src/aphront/configuration/AphrontApplicationConfiguration.php --- a/src/aphront/configuration/AphrontApplicationConfiguration.php +++ b/src/aphront/configuration/AphrontApplicationConfiguration.php @@ -363,8 +363,10 @@ private static function writeResponse( AphrontHTTPSink $sink, AphrontResponse $response) { + var_dump($response); $unexpected_output = PhabricatorStartup::endOutputCapture(); + //var_dump($unexpected_output); if ($unexpected_output) { $unexpected_output = pht( "Unexpected output:\n\n%s", @@ -478,7 +480,7 @@ // NOTE: We only do this for GET, since redirects switch to GET and drop // data like POST parameters. - if (!preg_match('@/$@', $path) && $request->isHTTPGet()) { + if (!@preg_match('@/$@', $path) && $request->isHTTPGet()) { $result = $this->routePath($maps, $path.'/'); if ($result) { $target_uri = $request->getAbsoluteRequestURI(); @@ -823,9 +825,9 @@ $raw_input = PhabricatorStartup::getRawInput(); $parser = new PhutilQueryStringParser(); - if (strlen($raw_input)) { + if (@strlen($raw_input)) { $content_type = idx($_SERVER, 'CONTENT_TYPE'); - $is_multipart = preg_match('@^multipart/form-data@i', $content_type); + $is_multipart = @preg_match('@^multipart/form-data@i', $content_type); if ($is_multipart) { $multipart_parser = id(new AphrontMultipartParser()) ->setContentType($content_type); diff --git a/src/aphront/headerparser/AphrontHTTPHeaderParser.php b/src/aphront/headerparser/AphrontHTTPHeaderParser.php --- a/src/aphront/headerparser/AphrontHTTPHeaderParser.php +++ b/src/aphront/headerparser/AphrontHTTPHeaderParser.php @@ -10,7 +10,7 @@ $this->name = null; $this->content = null; - $parts = explode(':', $raw_header, 2); + $parts = @explode(':', $raw_header, 2); $this->name = trim($parts[0]); if (count($parts) > 1) { $this->content = trim($parts[1]); @@ -36,7 +36,7 @@ $state = 'prekey'; - $length = strlen($content); + $length = @strlen($content); $pair_name = null; $pair_value = null; diff --git a/src/aphront/multipartparser/AphrontMultipartParser.php b/src/aphront/multipartparser/AphrontMultipartParser.php --- a/src/aphront/multipartparser/AphrontMultipartParser.php +++ b/src/aphront/multipartparser/AphrontMultipartParser.php @@ -27,7 +27,7 @@ throw new PhutilInvalidStateException('setContentType'); } - if (!preg_match('(^multipart/form-data)', $content_type)) { + if (!@preg_match('(^multipart/form-data)', $content_type)) { throw new Exception( pht( 'Expected "multipart/form-data" content type when executing a '. @@ -38,7 +38,7 @@ $boundary = null; foreach ($type_parts as $type_part) { $matches = null; - if (preg_match('(^boundary=(.*))', $type_part, $matches)) { + if (@preg_match('(^boundary=(.*))', $type_part, $matches)) { $boundary = $matches[1]; break; } @@ -70,7 +70,7 @@ // indicates we've reached the end of the parts) or "\r\n" (which // indicates we should read the headers for the next part). - if (strlen($this->buffer) < 2) { + if (@strlen($this->buffer) < 2) { // We don't have enough bytes yet, so wait for more. $continue = false; break; @@ -79,7 +79,7 @@ if (!strncmp($this->buffer, '--', 2)) { // This is "--" after a boundary, so we're done. We'll read the // rest of the body (the "epilogue") and discard it. - $this->buffer = substr($this->buffer, 2); + $this->buffer = @substr($this->buffer, 2); $this->state = 'epilogue'; $this->part = null; @@ -89,7 +89,7 @@ if (!strncmp($this->buffer, "\r\n", 2)) { // This is "\r\n" after a boundary, so we're going to going to // read the headers for a part. - $this->buffer = substr($this->buffer, 2); + $this->buffer = @substr($this->buffer, 2); $this->state = 'header'; // Create the object to hold the part we're about to read. @@ -107,7 +107,7 @@ // headers and terminated by "\r\n". The section is terminated by // a line with no header on it. - if (strlen($this->buffer) < 2) { + if (@strlen($this->buffer) < 2) { // We don't have enough data to find a "\r\n", so wait for more. $continue = false; break; @@ -116,23 +116,23 @@ if (!strncmp("\r\n", $this->buffer, 2)) { // This line immediately began "\r\n", so we're done with parsing // headers. Start parsing the body. - $this->buffer = substr($this->buffer, 2); + $this->buffer = @substr($this->buffer, 2); $this->state = 'body'; break; } // This is an actual header, so look for the end of it. - $header_len = strpos($this->buffer, "\r\n"); + $header_len = @strpos($this->buffer, "\r\n"); if ($header_len === false) { // We don't have a full header yet, so wait for more data. $continue = false; break; } - $header_buf = substr($this->buffer, 0, $header_len); + $header_buf = @substr($this->buffer, 0, $header_len); $this->part->appendRawHeader($header_buf); - $this->buffer = substr($this->buffer, $header_len + 2); + $this->buffer = @substr($this->buffer, $header_len + 2); break; case 'body': // We've parsed a boundary and headers, and are parsing the data for @@ -142,7 +142,7 @@ // we find it. $marker = "\r"; - $marker_pos = strpos($this->buffer, $marker); + $marker_pos = @strpos($this->buffer, $marker); if ($marker_pos === false) { // There's no "\r" anywhere in the buffer, so we can just read it @@ -162,14 +162,14 @@ if ($marker_pos > 0) { // If there are bytes before the "\r", if ($this->part) { - $this->part->appendData(substr($this->buffer, 0, $marker_pos)); + $this->part->appendData(@substr($this->buffer, 0, $marker_pos)); } - $this->buffer = substr($this->buffer, $marker_pos); + $this->buffer = @substr($this->buffer, $marker_pos); } $expect = "\r\n"; - $expect_len = strlen($expect); - if (strlen($this->buffer) < $expect_len) { + $expect_len = @strlen($expect); + if (@strlen($this->buffer) < $expect_len) { // We don't have enough bytes yet to know if this is "\r\n" // or not. $continue = false; @@ -180,14 +180,14 @@ // The next two bytes aren't "\r\n", so eat them and go looking // for more newlines. if ($this->part) { - $this->part->appendData(substr($this->buffer, 0, $expect_len)); + $this->part->appendData(@substr($this->buffer, 0, $expect_len)); } - $this->buffer = substr($this->buffer, $expect_len); + $this->buffer = @substr($this->buffer, $expect_len); break; } // Eat the "\r\n". - $this->buffer = substr($this->buffer, $expect_len); + $this->buffer = @substr($this->buffer, $expect_len); $this->state = 'bodynewline'; break; case 'bodynewline': @@ -197,9 +197,9 @@ // bytes and move on. $expect = '--'.$this->boundary; - $expect_len = strlen($expect); + $expect_len = @strlen($expect); - if (strlen($this->buffer) < $expect_len) { + if (@strlen($this->buffer) < $expect_len) { // We don't have enough bytes yet, so wait for more. $continue = false; break; @@ -217,7 +217,7 @@ } // This is the boundary, so toss it and move on. - $this->buffer = substr($this->buffer, $expect_len); + $this->buffer = @substr($this->buffer, $expect_len); $this->state = 'endboundary'; break; case 'epilogue': diff --git a/src/aphront/multipartparser/AphrontMultipartPart.php b/src/aphront/multipartparser/AphrontMultipartPart.php --- a/src/aphront/multipartparser/AphrontMultipartPart.php +++ b/src/aphront/multipartparser/AphrontMultipartPart.php @@ -21,7 +21,7 @@ $parser->getHeaderContent(), ); - if (strtolower($header_name) === 'content-disposition') { + if (@strtolower($header_name) === 'content-disposition') { $pairs = $parser->getHeaderContentAsPairs(); foreach ($pairs as $pair) { list($key, $value) = $pair; @@ -40,7 +40,7 @@ } public function appendData($bytes) { - $this->byteSize += strlen($bytes); + $this->byteSize += @strlen($bytes); if ($this->isVariable()) { $this->value .= $bytes; @@ -78,7 +78,7 @@ $mime_type = 'application/octet-stream'; foreach ($this->headers as $header) { list($name, $value) = $header; - if (strtolower($name) == 'content-type') { + if (@strtolower($name) == 'content-type') { $mime_type = $value; break; } diff --git a/src/aphront/requeststream/AphrontRequestStream.php b/src/aphront/requeststream/AphrontRequestStream.php --- a/src/aphront/requeststream/AphrontRequestStream.php +++ b/src/aphront/requeststream/AphrontRequestStream.php @@ -101,7 +101,7 @@ $filters = stream_get_filters(); foreach ($filters as $filter) { - if (!strncasecmp($filter, 'zlib.', strlen('zlib.'))) { + if (!strncasecmp($filter, 'zlib.', @strlen('zlib.'))) { $has_zlib = true; break; } diff --git a/src/aphront/response/AphrontAjaxResponse.php b/src/aphront/response/AphrontAjaxResponse.php --- a/src/aphront/response/AphrontAjaxResponse.php +++ b/src/aphront/response/AphrontAjaxResponse.php @@ -64,7 +64,7 @@ if ($viewer) { $postprocessor_key = $viewer->getUserSetting( PhabricatorAccessibilitySetting::SETTINGKEY); - if (strlen($postprocessor_key)) { + if (@strlen($postprocessor_key)) { $response->setPostprocessorKey($postprocessor_key); } } diff --git a/src/aphront/response/AphrontFileResponse.php b/src/aphront/response/AphrontFileResponse.php --- a/src/aphront/response/AphrontFileResponse.php +++ b/src/aphront/response/AphrontFileResponse.php @@ -19,7 +19,7 @@ } public function setDownload($download) { - if (!strlen($download)) { + if (!@strlen($download)) { $download = 'untitled'; } $this->download = $download; @@ -40,7 +40,7 @@ } public function setContent($content) { - $this->setContentLength(strlen($content)); + $this->setContentLength(@strlen($content)); $this->content = $content; return $this; } @@ -113,7 +113,7 @@ $headers[] = array('Content-Length', $content_len); } - if (strlen($this->getDownload())) { + if (@strlen($this->getDownload())) { $headers[] = array('X-Download-Options', 'noopen'); $filename = $this->getDownload(); @@ -144,13 +144,13 @@ $end = null; $matches = null; - if (preg_match('/^bytes=(\d+)-(\d*)$/', $range, $matches)) { + if (@preg_match('/^bytes=(\d+)-(\d*)$/', $range, $matches)) { // Note that the "Range" header specifies bytes differently than // we do internally: the range 0-1 has 2 bytes (byte 0 and byte 1). $begin = (int)$matches[1]; // The "Range" may be "200-299" or "200-", meaning "until end of file". - if (strlen($matches[2])) { + if (@strlen($matches[2])) { $range_end = (int)$matches[2]; $end = $range_end + 1; } else { diff --git a/src/aphront/response/AphrontRedirectResponse.php b/src/aphront/response/AphrontRedirectResponse.php --- a/src/aphront/response/AphrontRedirectResponse.php +++ b/src/aphront/response/AphrontRedirectResponse.php @@ -127,7 +127,7 @@ // If this is a remote resource it must have a domain set. This // would also be caught below, but testing for it explicitly first allows // us to raise a better error message. - if (!strlen($uri_object->getDomain())) { + if (!@strlen($uri_object->getDomain())) { throw new Exception( pht( 'Refusing to redirect to external URI "%s". This URI '. @@ -147,7 +147,7 @@ } else { // If this is a local resource, it must not have a domain set. This allows // us to raise a better error message than the check below can. - if (strlen($uri_object->getDomain())) { + if (@strlen($uri_object->getDomain())) { throw new Exception( pht( 'Refusing to redirect to local resource "%s". The URI has a '. diff --git a/src/aphront/response/AphrontResponse.php b/src/aphront/response/AphrontResponse.php --- a/src/aphront/response/AphrontResponse.php +++ b/src/aphront/response/AphrontResponse.php @@ -230,7 +230,7 @@ ->removeAllQueryParams(); $uri = (string)$uri; - if (preg_match('/[ ;\']/', $uri)) { + if (@preg_match('/[ ;\']/', $uri)) { throw new Exception( pht( 'Attempting to emit a response with an unsafe source ("%s") in the '. diff --git a/src/aphront/response/AphrontWebpageResponse.php b/src/aphront/response/AphrontWebpageResponse.php --- a/src/aphront/response/AphrontWebpageResponse.php +++ b/src/aphront/response/AphrontWebpageResponse.php @@ -21,7 +21,7 @@ public function buildResponseString() { $unexpected_output = $this->getUnexpectedOutput(); - if (strlen($unexpected_output)) { + if (@strlen($unexpected_output)) { $style = array( 'background: linear-gradient(180deg, #eeddff, #ddbbff);', 'white-space: pre-wrap;', 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 @@ -32,7 +32,7 @@ * @return void */ final public function writeHTTPStatus($code, $message = '') { - if (!preg_match('/^\d{3}$/', $code)) { + if (!@preg_match('/^\d{3}$/', $code)) { throw new Exception(pht("Malformed HTTP status code '%s'!", $code)); } @@ -54,7 +54,7 @@ } list($name, $value) = $header; - if (strpos($name, ':') !== false) { + if (@strpos($name, ':') !== false) { throw new Exception( pht( 'Declining to emit response with malformed HTTP header name: %s', @@ -71,7 +71,7 @@ // // http://news.php.net/php.internals/57655 - if (preg_match('/[\r\n\0]/', $name.$value)) { + if (@preg_match('/[\r\n\0]/', $name.$value)) { throw new Exception( pht( 'Declining to emit response with unsafe HTTP header: %s', diff --git a/src/aphront/sink/AphrontPHPHTTPSink.php b/src/aphront/sink/AphrontPHPHTTPSink.php --- a/src/aphront/sink/AphrontPHPHTTPSink.php +++ b/src/aphront/sink/AphrontPHPHTTPSink.php @@ -8,7 +8,7 @@ protected function emitHTTPStatus($code, $message = '') { if ($code != 200) { $header = "HTTP/1.0 {$code}"; - if (strlen($message)) { + if (@strlen($message)) { $header .= " {$message}"; } header($header); diff --git a/src/aphront/site/AphrontRoutingMap.php b/src/aphront/site/AphrontRoutingMap.php --- a/src/aphront/site/AphrontRoutingMap.php +++ b/src/aphront/site/AphrontRoutingMap.php @@ -102,7 +102,7 @@ } $data = null; - $ok = preg_match($pattern, $path, $data); + $ok = @preg_match($pattern, $path, $data); if ($ok === false) { throw new Exception( pht( @@ -131,7 +131,7 @@ ); } - $sub_path = substr($path, strlen($path_match)); + $sub_path = @substr($path, @strlen($path_match)); foreach ($value as $sub_route => $sub_value) { $result = $this->tryRoute($sub_route, $sub_value, $sub_path); if ($result) { diff --git a/src/aphront/site/AphrontSite.php b/src/aphront/site/AphrontSite.php --- a/src/aphront/site/AphrontSite.php +++ b/src/aphront/site/AphrontSite.php @@ -15,7 +15,7 @@ protected function isHostMatch($host, array $uris) { foreach ($uris as $uri) { - if (!strlen($uri)) { + if (!@strlen($uri)) { continue; } diff --git a/src/aphront/site/PhabricatorPlatformSite.php b/src/aphront/site/PhabricatorPlatformSite.php --- a/src/aphront/site/PhabricatorPlatformSite.php +++ b/src/aphront/site/PhabricatorPlatformSite.php @@ -14,7 +14,7 @@ // If no base URI has been configured yet, match this site so the user // can follow setup instructions. $base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri'); - if (!strlen($base_uri)) { + if (!@strlen($base_uri)) { return new PhabricatorPlatformSite(); } diff --git a/src/aphront/site/PhabricatorResourceSite.php b/src/aphront/site/PhabricatorResourceSite.php --- a/src/aphront/site/PhabricatorResourceSite.php +++ b/src/aphront/site/PhabricatorResourceSite.php @@ -14,7 +14,7 @@ $host = $request->getHost(); $uri = PhabricatorEnv::getEnvConfig('security.alternate-file-domain'); - if (!strlen($uri)) { + if (!@strlen($uri)) { return null; } diff --git a/src/aphront/site/PhabricatorShortSite.php b/src/aphront/site/PhabricatorShortSite.php --- a/src/aphront/site/PhabricatorShortSite.php +++ b/src/aphront/site/PhabricatorShortSite.php @@ -14,7 +14,7 @@ $host = $request->getHost(); $uri = PhabricatorEnv::getEnvConfig('phurl.short-uri'); - if (!strlen($uri)) { + if (!@strlen($uri)) { return null; } diff --git a/src/applications/almanac/controller/AlmanacPropertyDeleteController.php b/src/applications/almanac/controller/AlmanacPropertyDeleteController.php --- a/src/applications/almanac/controller/AlmanacPropertyDeleteController.php +++ b/src/applications/almanac/controller/AlmanacPropertyDeleteController.php @@ -14,7 +14,7 @@ $object = $this->getPropertyObject(); $key = $request->getStr('key'); - if (!strlen($key)) { + if (!@strlen($key)) { return new Aphront404Response(); } diff --git a/src/applications/almanac/controller/AlmanacPropertyEditController.php b/src/applications/almanac/controller/AlmanacPropertyEditController.php --- a/src/applications/almanac/controller/AlmanacPropertyEditController.php +++ b/src/applications/almanac/controller/AlmanacPropertyEditController.php @@ -16,7 +16,7 @@ $cancel_uri = $object->getURI(); $property_key = $request->getStr('key'); - if (!strlen($property_key)) { + if (!@strlen($property_key)) { return $this->buildPropertyKeyResponse($cancel_uri, null); } else { $error = null; diff --git a/src/applications/almanac/management/AlmanacManagementRegisterWorkflow.php b/src/applications/almanac/management/AlmanacManagementRegisterWorkflow.php --- a/src/applications/almanac/management/AlmanacManagementRegisterWorkflow.php +++ b/src/applications/almanac/management/AlmanacManagementRegisterWorkflow.php @@ -38,7 +38,7 @@ $viewer = $this->getViewer(); $device_name = $args->getArg('device'); - if (!strlen($device_name)) { + if (!@strlen($device_name)) { throw new PhutilArgumentUsageException( pht('Specify a device with --device.')); } @@ -55,7 +55,7 @@ $identify_as = $args->getArg('identify-as'); $raw_device = $device_name; - if (strlen($identify_as)) { + if (@strlen($identify_as)) { $raw_device = $identify_as; } @@ -70,7 +70,7 @@ } $private_key_path = $args->getArg('private-key'); - if (!strlen($private_key_path)) { + if (!@strlen($private_key_path)) { throw new PhutilArgumentUsageException( pht('Specify a private key with --private-key.')); } diff --git a/src/applications/almanac/storage/AlmanacNamespace.php b/src/applications/almanac/storage/AlmanacNamespace.php --- a/src/applications/almanac/storage/AlmanacNamespace.php +++ b/src/applications/almanac/storage/AlmanacNamespace.php @@ -59,7 +59,7 @@ } public function getNameLength() { - return strlen($this->getName()); + return @strlen($this->getName()); } /** @@ -72,7 +72,7 @@ // For a name like "x.y.z", produce a list of controlling namespaces like // ("z", "y.x", "x.y.z"). $names = array(); - $parts = explode('.', $name); + $parts = @explode('.', $name); for ($ii = 0; $ii < count($parts); $ii++) { $names[] = implode('.', array_slice($parts, -($ii + 1))); } diff --git a/src/applications/almanac/util/AlmanacKeys.php b/src/applications/almanac/util/AlmanacKeys.php --- a/src/applications/almanac/util/AlmanacKeys.php +++ b/src/applications/almanac/util/AlmanacKeys.php @@ -58,7 +58,7 @@ public static function getClusterSSHUser() { $username = PhabricatorEnv::getEnvConfig('diffusion.ssh-user'); - if (strlen($username)) { + if (@strlen($username)) { return $username; } diff --git a/src/applications/almanac/util/AlmanacNames.php b/src/applications/almanac/util/AlmanacNames.php --- a/src/applications/almanac/util/AlmanacNames.php +++ b/src/applications/almanac/util/AlmanacNames.php @@ -3,21 +3,21 @@ final class AlmanacNames extends Phobject { public static function validateName($name) { - if (strlen($name) < 3) { + if (@strlen($name) < 3) { throw new Exception( pht( 'Almanac service, device, property, network and namespace names '. 'must be at least 3 characters long.')); } - if (strlen($name) > 100) { + if (@strlen($name) > 100) { throw new Exception( pht( 'Almanac service, device, property, network and namespace names '. 'may not be more than 100 characters long.')); } - if (!preg_match('/^[a-z0-9.-]+\z/', $name)) { + if (!@preg_match('/^[a-z0-9.-]+\z/', $name)) { throw new Exception( pht( 'Almanac service, device, property, network and namespace names '. @@ -25,35 +25,35 @@ 'periods.')); } - if (preg_match('/(^|\\.)\d+(\z|\\.)/', $name)) { + if (@preg_match('/(^|\\.)\d+(\z|\\.)/', $name)) { throw new Exception( pht( 'Almanac service, device, network, property and namespace names '. 'may not have any segments containing only digits.')); } - if (preg_match('/\.\./', $name)) { + if (@preg_match('/\.\./', $name)) { throw new Exception( pht( 'Almanac service, device, property, network and namespace names '. 'may not contain multiple consecutive periods.')); } - if (preg_match('/\\.-|-\\./', $name)) { + if (@preg_match('/\\.-|-\\./', $name)) { throw new Exception( pht( 'Almanac service, device, property, network and namespace names '. 'may not contain hyphens adjacent to periods.')); } - if (preg_match('/--/', $name)) { + if (@preg_match('/--/', $name)) { throw new Exception( pht( 'Almanac service, device, property, network and namespace names '. 'may not contain multiple consecutive hyphens.')); } - if (!preg_match('/^[a-z0-9].*[a-z0-9]\z/', $name)) { + if (!@preg_match('/^[a-z0-9].*[a-z0-9]\z/', $name)) { throw new Exception( pht( 'Almanac service, device, property, network and namespace names '. diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementNotifyWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementNotifyWorkflow.php --- a/src/applications/aphlict/management/PhabricatorAphlictManagementNotifyWorkflow.php +++ b/src/applications/aphlict/management/PhabricatorAphlictManagementNotifyWorkflow.php @@ -26,7 +26,7 @@ $viewer = $this->getViewer(); $username = $args->getArg('user'); - if (!strlen($username)) { + if (!@strlen($username)) { throw new PhutilArgumentUsageException( pht( 'Specify a user to notify with "--user".')); @@ -45,7 +45,7 @@ } $message = $args->getArg('message'); - if (!strlen($message)) { + if (!@strlen($message)) { throw new PhutilArgumentUsageException( pht( 'Specify a message to send with "--message".')); diff --git a/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php b/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php --- a/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php +++ b/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php @@ -257,7 +257,7 @@ } foreach ($list as $key => $item) { - if (!strlen($item)) { + if (!@strlen($item)) { unset($list[$key]); } } diff --git a/src/applications/auth/adapter/PhutilBitbucketAuthAdapter.php b/src/applications/auth/adapter/PhutilBitbucketAuthAdapter.php --- a/src/applications/auth/adapter/PhutilBitbucketAuthAdapter.php +++ b/src/applications/auth/adapter/PhutilBitbucketAuthAdapter.php @@ -14,7 +14,7 @@ public function getAccountURI() { $name = $this->getAccountID(); - if (strlen($name)) { + if (@strlen($name)) { return 'https://bitbucket.org/'.$name; } return null; diff --git a/src/applications/auth/adapter/PhutilFacebookAuthAdapter.php b/src/applications/auth/adapter/PhutilFacebookAuthAdapter.php --- a/src/applications/auth/adapter/PhutilFacebookAuthAdapter.php +++ b/src/applications/auth/adapter/PhutilFacebookAuthAdapter.php @@ -28,7 +28,7 @@ } $matches = null; - if (!preg_match('@/([^/]+)$@', $link, $matches)) { + if (!@preg_match('@/([^/]+)$@', $link, $matches)) { return null; } diff --git a/src/applications/auth/adapter/PhutilGitHubAuthAdapter.php b/src/applications/auth/adapter/PhutilGitHubAuthAdapter.php --- a/src/applications/auth/adapter/PhutilGitHubAuthAdapter.php +++ b/src/applications/auth/adapter/PhutilGitHubAuthAdapter.php @@ -31,7 +31,7 @@ public function getAccountURI() { $name = $this->getAccountName(); - if (strlen($name)) { + if (@strlen($name)) { return 'https://github.com/'.$name; } return null; diff --git a/src/applications/auth/adapter/PhutilGoogleAuthAdapter.php b/src/applications/auth/adapter/PhutilGoogleAuthAdapter.php --- a/src/applications/auth/adapter/PhutilGoogleAuthAdapter.php +++ b/src/applications/auth/adapter/PhutilGoogleAuthAdapter.php @@ -39,7 +39,7 @@ public function getAccountName() { // Guess account name from email address, this is just a hint anyway. $email = $this->getAccountEmail(); - $email = explode('@', $email); + $email = @explode('@', $email); $email = head($email); return $email; } diff --git a/src/applications/auth/adapter/PhutilLDAPAuthAdapter.php b/src/applications/auth/adapter/PhutilLDAPAuthAdapter.php --- a/src/applications/auth/adapter/PhutilLDAPAuthAdapter.php +++ b/src/applications/auth/adapter/PhutilLDAPAuthAdapter.php @@ -128,7 +128,7 @@ public function readLDAPRecordAccountID(array $record) { $key = $this->usernameAttribute; - if (!strlen($key)) { + if (!@strlen($key)) { $key = head($this->searchAttributes); } return $this->readLDAPData($record, $key); @@ -182,7 +182,7 @@ // // However, in at least the case of 'dn', the property is a bare string. - if (is_scalar($list) && strlen($list)) { + if (is_scalar($list) && @strlen($list)) { return $list; } else if (is_array($list)) { return $list[0]; @@ -195,7 +195,7 @@ // If the attribute contains the literal token "${login}", treat it as a // query and substitute the user's login name for the token. - if (strpos($attribute, '${login}') !== false) { + if (@strpos($attribute, '${login}') !== false) { $escaped_user = ldap_sprintf('%S', $login_user); $attribute = str_replace('${login}', $escaped_user, $attribute); return $attribute; @@ -466,7 +466,7 @@ // NOTE: ldap_bind() dumps cleartext passwords into logs by default. Keep // it quiet. - if (strlen($user)) { + if (@strlen($user)) { $ok = @ldap_bind($conn, $user, $pass->openEnvelope()); } else { $ok = @ldap_bind($conn); @@ -475,7 +475,7 @@ $profiler->endServiceCall($call_id, array()); if (!$ok) { - if (strlen($user)) { + if (@strlen($user)) { $this->raiseConnectionException( $conn, pht('Failed to bind to LDAP server (as user "%s").', $user)); @@ -499,7 +499,7 @@ * @return bool True if the adapter should perform binds without identity. */ private function shouldBindWithoutIdentity() { - return $this->alwaysSearch || strlen($this->anonymousUsername); + return $this->alwaysSearch || @strlen($this->anonymousUsername); } } diff --git a/src/applications/auth/adapter/PhutilOAuth1AuthAdapter.php b/src/applications/auth/adapter/PhutilOAuth1AuthAdapter.php --- a/src/applications/auth/adapter/PhutilOAuth1AuthAdapter.php +++ b/src/applications/auth/adapter/PhutilOAuth1AuthAdapter.php @@ -104,7 +104,7 @@ ->setSignatureMethod($this->getSignatureMethod()); $consumer_key = $this->getConsumerKey(); - if (strlen($consumer_key)) { + if (@strlen($consumer_key)) { $future->setConsumerKey($consumer_key); } else { throw new Exception( @@ -118,11 +118,11 @@ $future->setConsumerSecret($consumer_secret); } - if (strlen($this->getToken())) { + if (@strlen($this->getToken())) { $future->setToken($this->getToken()); } - if (strlen($this->getTokenSecret())) { + if (@strlen($this->getTokenSecret())) { $future->setTokenSecret($this->getTokenSecret()); } @@ -137,7 +137,7 @@ $request_token_uri = $this->getRequestTokenURI(); $future = $this->newOAuth1Future($request_token_uri); - if (strlen($this->getCallbackURI())) { + if (@strlen($this->getCallbackURI())) { $future->setCallbackURI($this->getCallbackURI()); } diff --git a/src/applications/auth/adapter/PhutilOAuthAuthAdapter.php b/src/applications/auth/adapter/PhutilOAuthAuthAdapter.php --- a/src/applications/auth/adapter/PhutilOAuthAuthAdapter.php +++ b/src/applications/auth/adapter/PhutilOAuthAuthAdapter.php @@ -35,7 +35,7 @@ public function getAdapterType() { $this_class = get_class($this); $type_name = str_replace('PhutilAuthAdapterOAuth', '', $this_class); - return strtolower($type_name); + return @strtolower($type_name); } public function setState($state) { diff --git a/src/applications/auth/adapter/PhutilTwitterAuthAdapter.php b/src/applications/auth/adapter/PhutilTwitterAuthAdapter.php --- a/src/applications/auth/adapter/PhutilTwitterAuthAdapter.php +++ b/src/applications/auth/adapter/PhutilTwitterAuthAdapter.php @@ -17,7 +17,7 @@ public function getAccountURI() { $name = $this->getAccountName(); - if (strlen($name)) { + if (@strlen($name)) { return 'https://twitter.com/'.$name; } return null; diff --git a/src/applications/auth/constants/PhabricatorCommonPasswords.php b/src/applications/auth/constants/PhabricatorCommonPasswords.php --- a/src/applications/auth/constants/PhabricatorCommonPasswords.php +++ b/src/applications/auth/constants/PhabricatorCommonPasswords.php @@ -27,7 +27,7 @@ $list = self::loadWordlist(); } - return isset($list[strtolower($password)]); + return isset($list[@strtolower($password)]); } @@ -48,10 +48,10 @@ $map = array(); foreach ($words as $key => $word) { // The wordlist file has some comments at the top, strip those out. - if (preg_match('/^#!comment:/', $word)) { + if (@preg_match('/^#!comment:/', $word)) { continue; } - $map[strtolower($word)] = true; + $map[@strtolower($word)] = true; } // Add in some application-specific passwords. diff --git a/src/applications/auth/constants/PhabricatorCookies.php b/src/applications/auth/constants/PhabricatorCookies.php --- a/src/applications/auth/constants/PhabricatorCookies.php +++ b/src/applications/auth/constants/PhabricatorCookies.php @@ -89,7 +89,7 @@ // temporary and clearing it when users log out. $value = $request->getCookie(self::COOKIE_CLIENTID); - if (!strlen($value)) { + if (!@strlen($value)) { $request->setTemporaryCookie( self::COOKIE_CLIENTID, Filesystem::readRandomCharacters(16)); @@ -164,12 +164,12 @@ // Old cookies look like: /uri // New cookies look like: timestamp,/uri - if (!strlen($cookie)) { + if (!@strlen($cookie)) { return null; } - if (strpos($cookie, ',') !== false) { - list($timestamp, $uri) = explode(',', $cookie, 2); + if (@strpos($cookie, ',') !== false) { + list($timestamp, $uri) = @explode(',', $cookie, 2); return array((int)$timestamp, $uri); } diff --git a/src/applications/auth/controller/PhabricatorAuthController.php b/src/applications/auth/controller/PhabricatorAuthController.php --- a/src/applications/auth/controller/PhabricatorAuthController.php +++ b/src/applications/auth/controller/PhabricatorAuthController.php @@ -278,7 +278,7 @@ $viewer, PhabricatorAuthLoginMessageType::MESSAGEKEY); - if (!strlen($text)) { + if (!@strlen($text)) { return null; } diff --git a/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php b/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php --- a/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php +++ b/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php @@ -51,7 +51,7 @@ $viewer, PhabricatorAuthWaitForApprovalMessageType::MESSAGEKEY); - if (!strlen($text)) { + if (!@strlen($text)) { return null; } diff --git a/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php b/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php --- a/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php +++ b/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php @@ -36,7 +36,7 @@ ->getPanelKey(); $panel_key = $request->getURIData('pageKey'); - if (!strlen($panel_key)) { + if (!@strlen($panel_key)) { $panel_key = $multifactor_key; } diff --git a/src/applications/auth/controller/PhabricatorAuthRegisterController.php b/src/applications/auth/controller/PhabricatorAuthRegisterController.php --- a/src/applications/auth/controller/PhabricatorAuthRegisterController.php +++ b/src/applications/auth/controller/PhabricatorAuthRegisterController.php @@ -18,7 +18,7 @@ $invite = $this->loadInvite(); $is_setup = false; - if (strlen($account_key)) { + if (@strlen($account_key)) { $result = $this->loadAccountForRegistrationOrLinking($account_key); list($account, $provider, $response) = $result; $is_default = false; @@ -243,9 +243,9 @@ $require_real_name = PhabricatorEnv::getEnvConfig('user.require-real-name'); - $e_username = strlen($value_username) ? null : true; + $e_username = @strlen($value_username) ? null : true; $e_realname = $require_real_name ? true : null; - $e_email = strlen($value_email) ? null : true; + $e_email = @strlen($value_email) ? null : true; $e_password = true; $e_captcha = true; @@ -287,7 +287,7 @@ if ($can_edit_username) { $value_username = $request->getStr('username'); - if (!strlen($value_username)) { + if (!@strlen($value_username)) { $e_username = pht('Required'); $errors[] = pht('Username is required.'); } else if (!PhabricatorUser::validateUsername($value_username)) { @@ -322,7 +322,7 @@ if ($can_edit_email) { $value_email = $request->getStr('email'); - if (!strlen($value_email)) { + if (!@strlen($value_email)) { $e_email = pht('Required'); $errors[] = pht('Email is required.'); } else if (!PhabricatorUserEmail::isValidAddress($value_email)) { @@ -338,7 +338,7 @@ if ($can_edit_realname) { $value_realname = $request->getStr('realName'); - if (!strlen($value_realname) && $require_real_name) { + if (!@strlen($value_realname) && $require_real_name) { $e_realname = pht('Required'); $errors[] = pht('Real name is required.'); } else { diff --git a/src/applications/auth/controller/PhabricatorAuthSSHKeyEditController.php b/src/applications/auth/controller/PhabricatorAuthSSHKeyEditController.php --- a/src/applications/auth/controller/PhabricatorAuthSSHKeyEditController.php +++ b/src/applications/auth/controller/PhabricatorAuthSSHKeyEditController.php @@ -54,10 +54,10 @@ $cancel_uri); $v_name = $key->getName(); - $e_name = strlen($v_name) ? null : true; + $e_name = @strlen($v_name) ? null : true; $v_key = $key->getEntireKey(); - $e_key = strlen($v_key) ? null : true; + $e_key = @strlen($v_key) ? null : true; $validation_exception = null; if ($request->isFormPost()) { diff --git a/src/applications/auth/controller/PhabricatorAuthSetExternalController.php b/src/applications/auth/controller/PhabricatorAuthSetExternalController.php --- a/src/applications/auth/controller/PhabricatorAuthSetExternalController.php +++ b/src/applications/auth/controller/PhabricatorAuthSetExternalController.php @@ -40,7 +40,7 @@ $text = PhabricatorAuthMessage::loadMessageText( $viewer, PhabricatorAuthLinkMessageType::MESSAGEKEY); - if (!strlen($text)) { + if (!@strlen($text)) { $text = pht( 'You can link your Phabricator account to an external account to '. 'allow you to log in more easily in the future. To continue, choose '. diff --git a/src/applications/auth/controller/PhabricatorAuthStartController.php b/src/applications/auth/controller/PhabricatorAuthStartController.php --- a/src/applications/auth/controller/PhabricatorAuthStartController.php +++ b/src/applications/auth/controller/PhabricatorAuthStartController.php @@ -31,7 +31,7 @@ $session_token = $request->getCookie(PhabricatorCookies::COOKIE_SESSION); $did_clear = $request->getStr('cleared'); - if (strlen($session_token)) { + if (@strlen($session_token)) { $kind = PhabricatorAuthSessionEngine::getSessionKindFromToken( $session_token); switch ($kind) { @@ -98,7 +98,7 @@ } $next_uri = $request->getStr('next'); - if (!strlen($next_uri)) { + if (!@strlen($next_uri)) { if ($this->getDelegatingController()) { // Only set a next URI from the request path if this controller was // delegated to, which happens when a user tries to view a page which @@ -112,7 +112,7 @@ } if (!$request->isFormPost()) { - if (strlen($next_uri)) { + if (@strlen($next_uri)) { PhabricatorCookies::setNextURICookie($request, $next_uri); } PhabricatorCookies::setClientIDCookie($request); @@ -226,7 +226,7 @@ $via_header = AphrontRequest::getViaHeaderName(); $via_uri = AphrontRequest::getHTTPHeader($via_header); - if (strlen($via_uri)) { + if (@strlen($via_uri)) { PhabricatorCookies::setNextURICookie($request, $via_uri, $force = true); } diff --git a/src/applications/auth/controller/PhabricatorAuthTerminateSessionController.php b/src/applications/auth/controller/PhabricatorAuthTerminateSessionController.php --- a/src/applications/auth/controller/PhabricatorAuthTerminateSessionController.php +++ b/src/applications/auth/controller/PhabricatorAuthTerminateSessionController.php @@ -63,7 +63,7 @@ $short = pht('Terminate Session'); $body = pht( 'Really terminate session %s?', - phutil_tag('strong', array(), substr($session->getSessionKey(), 0, 6))); + phutil_tag('strong', array(), @substr($session->getSessionKey(), 0, 6))); } return $this->newDialog() diff --git a/src/applications/auth/controller/PhabricatorAuthValidateController.php b/src/applications/auth/controller/PhabricatorAuthValidateController.php --- a/src/applications/auth/controller/PhabricatorAuthValidateController.php +++ b/src/applications/auth/controller/PhabricatorAuthValidateController.php @@ -20,7 +20,7 @@ $failures = array(); - if (!strlen($request->getStr('expect'))) { + if (!@strlen($request->getStr('expect'))) { return $this->renderErrors( array( pht( diff --git a/src/applications/auth/controller/PhabricatorEmailLoginController.php b/src/applications/auth/controller/PhabricatorEmailLoginController.php --- a/src/applications/auth/controller/PhabricatorEmailLoginController.php +++ b/src/applications/auth/controller/PhabricatorEmailLoginController.php @@ -43,7 +43,7 @@ } } - if (!strlen($v_email)) { + if (!@strlen($v_email)) { $errors[] = pht('You must provide an email address.'); $e_email = pht('Required'); } diff --git a/src/applications/auth/controller/PhabricatorLogoutController.php b/src/applications/auth/controller/PhabricatorLogoutController.php --- a/src/applications/auth/controller/PhabricatorLogoutController.php +++ b/src/applications/auth/controller/PhabricatorLogoutController.php @@ -51,7 +51,7 @@ // their cookies have some issues. We'll detect cookie issues when they // try to login again and tell them to clear any junk. $phsid = $request->getCookie(PhabricatorCookies::COOKIE_SESSION); - if (strlen($phsid)) { + if (@strlen($phsid)) { $session = id(new PhabricatorAuthSessionQuery()) ->setViewer($viewer) ->withSessionKeys(array($phsid)) diff --git a/src/applications/auth/controller/config/PhabricatorAuthEditController.php b/src/applications/auth/controller/config/PhabricatorAuthEditController.php --- a/src/applications/auth/controller/config/PhabricatorAuthEditController.php +++ b/src/applications/auth/controller/config/PhabricatorAuthEditController.php @@ -99,10 +99,10 @@ if (!$errors) { if ($is_new) { - if (!strlen($config->getProviderType())) { + if (!@strlen($config->getProviderType())) { $config->setProviderType($provider->getProviderType()); } - if (!strlen($config->getProviderDomain())) { + if (!@strlen($config->getProviderDomain())) { $config->setProviderDomain($provider->getProviderDomain()); } } diff --git a/src/applications/auth/controller/message/PhabricatorAuthMessageViewController.php b/src/applications/auth/controller/message/PhabricatorAuthMessageViewController.php --- a/src/applications/auth/controller/message/PhabricatorAuthMessageViewController.php +++ b/src/applications/auth/controller/message/PhabricatorAuthMessageViewController.php @@ -103,7 +103,7 @@ ->setViewer($viewer); $full_description = $message_type->getFullDescription(); - if (strlen($full_description)) { + if (@strlen($full_description)) { $view->addTextContent(new PHUIRemarkupView($viewer, $full_description)); } else { $short_description = $message_type->getShortDescription(); @@ -111,7 +111,7 @@ } $message_text = $message->getMessageText(); - if (strlen($message_text)) { + if (@strlen($message_text)) { $view->addSectionHeader( pht('Message Preview'), PHUIPropertyListView::ICON_SUMMARY); @@ -120,7 +120,7 @@ } $default_text = $message_type->getDefaultMessageText(); - if (strlen($default_text)) { + if (@strlen($default_text)) { $view->addSectionHeader( pht('Default Message'), PHUIPropertyListView::ICON_SUMMARY); diff --git a/src/applications/auth/controller/mfa/PhabricatorAuthFactorProviderViewController.php b/src/applications/auth/controller/mfa/PhabricatorAuthFactorProviderViewController.php --- a/src/applications/auth/controller/mfa/PhabricatorAuthFactorProviderViewController.php +++ b/src/applications/auth/controller/mfa/PhabricatorAuthFactorProviderViewController.php @@ -83,7 +83,7 @@ $custom_enroll = $provider->getEnrollMessage(); - if (strlen($custom_enroll)) { + if (@strlen($custom_enroll)) { $view->addSectionHeader( pht('Custom Enroll Message'), PHUIPropertyListView::ICON_SUMMARY); diff --git a/src/applications/auth/data/PhabricatorAuthInviteAction.php b/src/applications/auth/data/PhabricatorAuthInviteAction.php --- a/src/applications/auth/data/PhabricatorAuthInviteAction.php +++ b/src/applications/auth/data/PhabricatorAuthInviteAction.php @@ -103,7 +103,7 @@ $email = new PhutilEmailAddress($address); $result->emailAddress = phutil_utf8_strtolower($email->getAddress()); - if (!preg_match('/^\S+@\S+\.\S+\z/', $result->emailAddress)) { + if (!@preg_match('/^\S+@\S+\.\S+\z/', $result->emailAddress)) { $result->issues[] = self::ISSUE_PARSE; } @@ -194,7 +194,7 @@ throw new Exception(pht('Invite action is not a send action!')); } - if (!preg_match('/{\$INVITE_URI}/', $template)) { + if (!@preg_match('/{\$INVITE_URI}/', $template)) { throw new Exception(pht('Invite template does not include invite URI!')); } diff --git a/src/applications/auth/engine/PhabricatorAuthCSRFEngine.php b/src/applications/auth/engine/PhabricatorAuthCSRFEngine.php --- a/src/applications/auth/engine/PhabricatorAuthCSRFEngine.php +++ b/src/applications/auth/engine/PhabricatorAuthCSRFEngine.php @@ -46,13 +46,13 @@ // We expect a BREACH-mitigating token. See T3684. $breach_prefix = $this->getBREACHPrefix(); - $breach_prelen = strlen($breach_prefix); + $breach_prelen = @strlen($breach_prefix); if (strncmp($token, $breach_prefix, $breach_prelen) !== 0) { return false; } - $salt = substr($token, $breach_prelen, $salt_length); - $token = substr($token, $breach_prelen + $salt_length); + $salt = @substr($token, $breach_prelen, $salt_length); + $token = @substr($token, $breach_prelen + $salt_length); foreach ($this->getWindowOffsets() as $offset) { $expect_token = $this->newRawToken($salt, $offset); @@ -81,7 +81,7 @@ $secret.$time_block.$salt, 'csrf'); - return substr($hash, 0, $this->getTokenLength()); + return @substr($hash, 0, $this->getTokenLength()); } private function getBREACHPrefix() { diff --git a/src/applications/auth/engine/PhabricatorAuthPasswordEngine.php b/src/applications/auth/engine/PhabricatorAuthPasswordEngine.php --- a/src/applications/auth/engine/PhabricatorAuthPasswordEngine.php +++ b/src/applications/auth/engine/PhabricatorAuthPasswordEngine.php @@ -61,7 +61,7 @@ $raw_password = $password->openEnvelope(); - if (!strlen($raw_password)) { + if (!@strlen($raw_password)) { if ($can_skip) { throw new PhabricatorAuthPasswordException( pht('You must choose a password or skip this step.'), @@ -76,7 +76,7 @@ $min_len = PhabricatorEnv::getEnvConfig('account.minimum-password-length'); $min_len = (int)$min_len; if ($min_len) { - if (strlen($raw_password) < $min_len) { + if (@strlen($raw_password) < $min_len) { throw new PhabricatorAuthPasswordException( pht( 'The selected password is too short. Passwords must be a minimum '. @@ -88,7 +88,7 @@ $raw_confirm = $confirm->openEnvelope(); - if (!strlen($raw_confirm)) { + if (!@strlen($raw_confirm)) { throw new PhabricatorAuthPasswordException( pht('You must confirm the selected password.'), null, @@ -164,7 +164,7 @@ // Skip very short terms: it's okay if your password has the substring // "com" in it somewhere even if the install is on "mycompany.com". foreach ($terms_map as $term => $source) { - if (strlen($term) < $minimum_similarity) { + if (@strlen($term) < $minimum_similarity) { unset($terms_map[$term]); } } @@ -179,7 +179,7 @@ // Finally, make sure that none of the terms appear in the password, // and that the password does not appear in any of the terms. $normal_password = phutil_utf8_strtolower($raw_password); - if (strlen($normal_password) >= $minimum_similarity) { + if (@strlen($normal_password) >= $minimum_similarity) { foreach ($normal_map as $term => $source) { // See T2312. This may be required if the term list includes numeric @@ -187,8 +187,8 @@ // array keys. $term = phutil_string_cast($term); - if (strpos($term, $normal_password) === false && - strpos($normal_password, $term) === false) { + if (@strpos($term, $normal_password) === false && + @strpos($normal_password, $term) === false) { continue; } diff --git a/src/applications/auth/engine/PhabricatorAuthSessionEngine.php b/src/applications/auth/engine/PhabricatorAuthSessionEngine.php --- a/src/applications/auth/engine/PhabricatorAuthSessionEngine.php +++ b/src/applications/auth/engine/PhabricatorAuthSessionEngine.php @@ -79,12 +79,12 @@ * @return const Session kind constant. */ public static function getSessionKindFromToken($session_token) { - if (strpos($session_token, '/') === false) { + if (@strpos($session_token, '/') === false) { // Old-style session, these are all user sessions. return self::KIND_USER; } - list($kind, $key) = explode('/', $session_token, 2); + list($kind, $key) = @explode('/', $session_token, 2); switch ($kind) { case self::KIND_ANONYMOUS: @@ -187,7 +187,7 @@ foreach ($info as $key => $value) { if (strncmp($key, 's_', 2) === 0) { unset($info[$key]); - $session_dict[substr($key, 2)] = $value; + $session_dict[@substr($key, 2)] = $value; continue; } diff --git a/src/applications/auth/factor/PhabricatorAuthFactor.php b/src/applications/auth/factor/PhabricatorAuthFactor.php --- a/src/applications/auth/factor/PhabricatorAuthFactor.php +++ b/src/applications/auth/factor/PhabricatorAuthFactor.php @@ -414,7 +414,7 @@ $sync_token = null; $sync_key = $request->getStr($this->getMFASyncTokenFormKey()); - if (strlen($sync_key)) { + if (@strlen($sync_key)) { $sync_key_digest = PhabricatorHash::digestWithNamedKey( $sync_key, PhabricatorAuthMFASyncTemporaryTokenType::DIGEST_KEY); @@ -546,7 +546,7 @@ $rows = array(); foreach ($lines as $line) { $cells = array(); - for ($ii = 0; $ii < strlen($line); $ii++) { + for ($ii = 0; $ii < @strlen($line); $ii++) { if ($line[$ii] == '1') { $color = '#000'; } else { diff --git a/src/applications/auth/factor/PhabricatorDuoAuthFactor.php b/src/applications/auth/factor/PhabricatorDuoAuthFactor.php --- a/src/applications/auth/factor/PhabricatorDuoAuthFactor.php +++ b/src/applications/auth/factor/PhabricatorDuoAuthFactor.php @@ -803,7 +803,7 @@ } public static function requireDuoAPIHostname($hostname) { - if (preg_match('/\.duosecurity\.com\z/', $hostname)) { + if (@preg_match('/\.duosecurity\.com\z/', $hostname)) { return; } diff --git a/src/applications/auth/factor/PhabricatorSMSAuthFactor.php b/src/applications/auth/factor/PhabricatorSMSAuthFactor.php --- a/src/applications/auth/factor/PhabricatorSMSAuthFactor.php +++ b/src/applications/auth/factor/PhabricatorSMSAuthFactor.php @@ -157,7 +157,7 @@ return $config; } else { - if (!strlen($code)) { + if (!@strlen($code)) { $e_code = pht('Required'); } else { $e_code = pht('Invalid'); @@ -283,7 +283,7 @@ PhabricatorAuthFactorConfig $config, AphrontRequest $request) { $value = $this->getChallengeResponseFromRequest($config, $request); - return (bool)strlen($value); + return (bool)@strlen($value); } protected function newResultFromChallengeResponse( @@ -317,7 +317,7 @@ return $result->setAnsweredChallenge($challenge); } - if (strlen($code)) { + if (@strlen($code)) { $error_message = pht('Invalid'); } else { $error_message = pht('Required'); 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 @@ -47,7 +47,7 @@ PhabricatorAuthFactorProvider $provider, PhabricatorUser $viewer) { - $bits = strlen($config->getFactorSecret()) * 8; + $bits = @strlen($config->getFactorSecret()) * 8; return pht('%d-Bit Secret', $bits); } @@ -81,7 +81,7 @@ return $config; } else { - if (!strlen($code)) { + if (!@strlen($code)) { $e_code = pht('Required'); } else { $e_code = pht('Invalid'); @@ -211,7 +211,7 @@ AphrontRequest $request) { $value = $this->getChallengeResponseFromRequest($config, $request); - return (bool)strlen($value); + return (bool)@strlen($value); } @@ -342,7 +342,7 @@ $result->setAnsweredChallenge($challenge); } else { - if (strlen($code)) { + if (@strlen($code)) { $error_message = pht('Invalid'); } else { $error_message = pht('Required'); @@ -365,7 +365,7 @@ $map = array_flip($map); $out = ''; - $len = strlen($buf); + $len = @strlen($buf); $acc = 0; $bits = 0; for ($ii = 0; $ii < $len; $ii++) { diff --git a/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php b/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php --- a/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php @@ -32,7 +32,7 @@ $console = PhutilConsole::getConsole(); $public_keyfile = $args->getArg('public'); - if (!strlen($public_keyfile)) { + if (!@strlen($public_keyfile)) { throw new PhutilArgumentUsageException( pht( 'You must specify the path to a public keyfile with %s.', @@ -49,7 +49,7 @@ $public_key = Filesystem::readFile($public_keyfile); $pkcs8_keyfile = $args->getArg('pkcs8'); - if (!strlen($pkcs8_keyfile)) { + if (!@strlen($pkcs8_keyfile)) { throw new PhutilArgumentUsageException( pht( 'You must specify the path to a pkcs8 keyfile with %s.', diff --git a/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php --- a/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php @@ -36,7 +36,7 @@ $console->writeOut("%s\n", pht('Enter LDAP Credentials')); $username = phutil_console_prompt(pht('LDAP Username: ')); - if (!strlen($username)) { + if (!@strlen($username)) { throw new PhutilArgumentUsageException( pht('You must enter an LDAP username.')); } @@ -45,7 +45,7 @@ $password = phutil_console_prompt(pht('LDAP Password: ')); phutil_passthru('stty echo'); - if (!strlen($password)) { + if (!@strlen($password)) { throw new PhutilArgumentUsageException( pht('You must enter an LDAP password.')); } diff --git a/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php --- a/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php @@ -34,7 +34,7 @@ )); $username = $args->getArg('user'); - if (strlen($username)) { + if (@strlen($username)) { $user = id(new PhabricatorPeopleQuery()) ->setViewer($viewer) ->withUsernames(array($username)) diff --git a/src/applications/auth/management/PhabricatorAuthManagementRevokeWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementRevokeWorkflow.php --- a/src/applications/auth/management/PhabricatorAuthManagementRevokeWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementRevokeWorkflow.php @@ -60,7 +60,7 @@ $type = $args->getArg('type'); $is_everything = $args->getArg('everything'); - if (!strlen($type) && !$is_everything) { + if (!@strlen($type) && !$is_everything) { if ($is_list) { // By default, "bin/revoke --list" implies "--everything". $types = $all_types; @@ -71,7 +71,7 @@ '"--everything". Use "--list" to list available credential '. 'types.')); } - } else if (strlen($type) && $is_everything) { + } else if (@strlen($type) && $is_everything) { throw new PhutilArgumentUsageException( pht( 'Specify the credential type to revoke with "--type" or '. @@ -94,7 +94,7 @@ $from = $args->getArg('from'); if ($is_list) { - if (strlen($from) || $is_everywhere) { + if (@strlen($from) || $is_everywhere) { throw new PhutilArgumentUsageException( pht( 'You can not "--list" and revoke credentials (with "--from" or '. @@ -119,12 +119,12 @@ } $target = null; - if (!strlen($from) && !$is_everywhere) { + if (!@strlen($from) && !$is_everywhere) { throw new PhutilArgumentUsageException( pht( 'Specify the target to revoke credentials from with "--from" or '. 'specify "--everywhere".')); - } else if (strlen($from) && $is_everywhere) { + } else if (@strlen($from) && $is_everywhere) { throw new PhutilArgumentUsageException( pht( 'Specify the target to revoke credentials from with "--from" or '. diff --git a/src/applications/auth/management/PhabricatorAuthManagementUnlimitWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementUnlimitWorkflow.php --- a/src/applications/auth/management/PhabricatorAuthManagementUnlimitWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementUnlimitWorkflow.php @@ -27,7 +27,7 @@ public function execute(PhutilArgumentParser $args) { $username = $args->getArg('user'); - if (!strlen($username)) { + if (!@strlen($username)) { throw new PhutilArgumentUsageException( pht( 'Use %s to choose a user to reset actions for.', '--user')); diff --git a/src/applications/auth/provider/PhabricatorAsanaAuthProvider.php b/src/applications/auth/provider/PhabricatorAsanaAuthProvider.php --- a/src/applications/auth/provider/PhabricatorAsanaAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorAsanaAuthProvider.php @@ -55,11 +55,11 @@ $pattern = '(https://app\\.asana\\.com/0/(\\d+)/(\\d+))'; $matches = null; - if (!preg_match($pattern, $uri_string, $matches)) { + if (!@preg_match($pattern, $uri_string, $matches)) { return null; } - if (strlen($uri->getFragment())) { + if (@strlen($uri->getFragment())) { return null; } diff --git a/src/applications/auth/provider/PhabricatorAuthProvider.php b/src/applications/auth/provider/PhabricatorAuthProvider.php --- a/src/applications/auth/provider/PhabricatorAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorAuthProvider.php @@ -545,7 +545,7 @@ public function getAuthCSRFCode(AphrontRequest $request) { $phcid = $request->getCookie(PhabricatorCookies::COOKIE_CLIENTID); - if (!strlen($phcid)) { + if (!@strlen($phcid)) { throw new AphrontMalformedRequestException( pht('Missing Client ID Cookie'), pht( @@ -562,7 +562,7 @@ protected function verifyAuthCSRFCode(AphrontRequest $request, $actual) { $expect = $this->getAuthCSRFCode($request); - if (!strlen($actual)) { + if (!@strlen($actual)) { throw new Exception( pht( 'The authentication provider did not return a client state '. diff --git a/src/applications/auth/provider/PhabricatorJIRAAuthProvider.php b/src/applications/auth/provider/PhabricatorJIRAAuthProvider.php --- a/src/applications/auth/provider/PhabricatorJIRAAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorJIRAAuthProvider.php @@ -118,17 +118,17 @@ $key_name = self::PROPERTY_JIRA_NAME; $key_uri = self::PROPERTY_JIRA_URI; - if (!strlen($values[$key_name])) { + if (!@strlen($values[$key_name])) { $errors[] = pht('JIRA instance name is required.'); $issues[$key_name] = pht('Required'); - } else if (!preg_match('/^[a-z0-9.]+\z/', $values[$key_name])) { + } else if (!@preg_match('/^[a-z0-9.]+\z/', $values[$key_name])) { $errors[] = pht( 'JIRA instance name must contain only lowercase letters, digits, and '. 'period.'); $issues[$key_name] = pht('Invalid'); } - if (!strlen($values[$key_uri])) { + if (!@strlen($values[$key_uri])) { $errors[] = pht('JIRA base URI is required.'); $issues[$key_uri] = pht('Required'); } else { @@ -337,11 +337,11 @@ $pattern = '((https?://\S+?)/browse/([A-Z][A-Z0-9]*-[1-9]\d*))'; $matches = null; - if (!preg_match($pattern, $uri_string, $matches)) { + if (!@preg_match($pattern, $uri_string, $matches)) { return null; } - if (strlen($uri->getFragment())) { + if (@strlen($uri->getFragment())) { return null; } diff --git a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php --- a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php @@ -142,10 +142,10 @@ $username = $request->getStr('ldap_username'); $password = $request->getStr('ldap_password'); - $has_password = strlen($password); + $has_password = @strlen($password); $password = new PhutilOpaqueEnvelope($password); - if (!strlen($username) || !$has_password) { + if (!@strlen($username) || !$has_password) { $response = $controller->buildProviderPageResponse( $this, $this->renderLoginForm($request, 'login')); @@ -154,7 +154,7 @@ if ($request->isFormPost()) { try { - if (strlen($username) && $has_password) { + if (@strlen($username) && $has_password) { $adapter = $this->getAdapter(); $adapter->setLoginUsername($username); $adapter->setLoginPassword($password); @@ -427,7 +427,7 @@ } $instruction_text = idx($instructions, $key); - if (strlen($instruction_text)) { + if (@strlen($instruction_text)) { $form->appendRemarkupInstructions($instruction_text); } diff --git a/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php b/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php --- a/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php +++ b/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php @@ -21,7 +21,7 @@ $config = $this->getProviderConfig(); $adapter->setConsumerKey($config->getProperty(self::PROPERTY_CONSUMER_KEY)); $secret = $config->getProperty(self::PROPERTY_CONSUMER_SECRET); - if (strlen($secret)) { + if (@strlen($secret)) { $adapter->setConsumerSecret(new PhutilOpaqueEnvelope($secret)); } $adapter->setCallbackURI(PhabricatorEnv::getURI($this->getLoginURI())); @@ -67,7 +67,7 @@ } $denied = $request->getStr('denied'); - if (strlen($denied)) { + if (@strlen($denied)) { // Twitter indicates that the user cancelled the login attempt by // returning "denied" as a parameter. throw new PhutilAuthUserAbortedException(); @@ -160,7 +160,7 @@ switch ($key) { case self::PROPERTY_CONSUMER_KEY: - if (strlen($old)) { + if (@strlen($old)) { return pht( '%s updated the OAuth consumer key for this provider from '. '"%s" to "%s".', @@ -175,7 +175,7 @@ $new); } case self::PROPERTY_CONSUMER_SECRET: - if (strlen($old)) { + if (@strlen($old)) { return pht( '%s updated the OAuth consumer secret for this provider.', $xaction->renderHandleLink($author_phid)); diff --git a/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php b/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php --- a/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php +++ b/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php @@ -64,7 +64,7 @@ $this->verifyAuthCSRFCode($request, $request->getStr('state')); $code = $request->getStr('code'); - if (!strlen($code)) { + if (!@strlen($code)) { $response = $controller->buildProviderErrorResponse( $this, pht( @@ -137,7 +137,7 @@ switch ($key) { case self::PROPERTY_APP_ID: - if (strlen($old)) { + if (@strlen($old)) { return pht( '%s updated the OAuth application ID for this provider from '. '"%s" to "%s".', @@ -152,7 +152,7 @@ $new); } case self::PROPERTY_APP_SECRET: - if (strlen($old)) { + if (@strlen($old)) { return pht( '%s updated the OAuth application secret for this provider.', $xaction->renderHandleLink($author_phid)); @@ -162,7 +162,7 @@ $xaction->renderHandleLink($author_phid)); } case self::PROPERTY_NOTE: - if (strlen($old)) { + if (@strlen($old)) { return pht( '%s updated the OAuth application notes for this provider.', $xaction->renderHandleLink($author_phid)); diff --git a/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php b/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php --- a/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php @@ -59,19 +59,19 @@ $key_id = $this->getIDKey(); $key_secret = $this->getSecretKey(); - if (!strlen($values[$key_id])) { + if (!@strlen($values[$key_id])) { $errors[] = $id_error; $issues[$key_id] = pht('Required'); } - if (!strlen($values[$key_secret])) { + if (!@strlen($values[$key_secret])) { $errors[] = $secret_error; $issues[$key_secret] = pht('Required'); } // If the user has not changed the secret, don't update it (that is, // don't cause a bunch of "****" to be written to the database). - if (preg_match('/^[*]+$/', $values[$key_secret])) { + if (@preg_match('/^[*]+$/', $values[$key_secret])) { unset($values[$key_secret]); } @@ -104,7 +104,7 @@ $v_id = $values[$key_id]; $v_secret = $values[$key_secret]; if ($v_secret) { - $v_secret = str_repeat('*', strlen($v_secret)); + $v_secret = str_repeat('*', @strlen($v_secret)); } $v_note = $values[$key_note]; @@ -144,7 +144,7 @@ switch ($key) { case self::PROPERTY_NOTE: - if (strlen($old)) { + if (@strlen($old)) { return pht( '%s updated the OAuth application notes for this provider.', $xaction->renderHandleLink($author_phid)); diff --git a/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php b/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php --- a/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php @@ -285,7 +285,7 @@ if ($request->isFormPost()) { if (!$require_captcha || $captcha_valid) { $username_or_email = $request->getStr('username'); - if (strlen($username_or_email)) { + if (@strlen($username_or_email)) { $user = id(new PhabricatorUser())->loadOneWhere( 'username = %s', $username_or_email); diff --git a/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php b/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php --- a/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php @@ -105,17 +105,17 @@ $key_name = self::PROPERTY_PHABRICATOR_NAME; $key_uri = self::PROPERTY_PHABRICATOR_URI; - if (!strlen($values[$key_name])) { + if (!@strlen($values[$key_name])) { $errors[] = pht('Phabricator instance name is required.'); $issues[$key_name] = pht('Required'); - } else if (!preg_match('/^[a-z0-9.]+\z/', $values[$key_name])) { + } else if (!@preg_match('/^[a-z0-9.]+\z/', $values[$key_name])) { $errors[] = pht( 'Phabricator instance name must contain only lowercase letters, '. 'digits, and periods.'); $issues[$key_name] = pht('Invalid'); } - if (!strlen($values[$key_uri])) { + if (!@strlen($values[$key_uri])) { $errors[] = pht('Phabricator base URI is required.'); $issues[$key_uri] = pht('Required'); } else { diff --git a/src/applications/auth/sshkey/PhabricatorAuthSSHPrivateKey.php b/src/applications/auth/sshkey/PhabricatorAuthSSHPrivateKey.php --- a/src/applications/auth/sshkey/PhabricatorAuthSSHPrivateKey.php +++ b/src/applications/auth/sshkey/PhabricatorAuthSSHPrivateKey.php @@ -144,7 +144,7 @@ $reason = 'unknown'; foreach ($patterns as $pattern => $pattern_reason) { - $ok = preg_match($pattern, $stderr); + $ok = @preg_match($pattern, $stderr); if ($ok === false) { throw new Exception( diff --git a/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php b/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php --- a/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php +++ b/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php @@ -24,7 +24,7 @@ public static function newFromRawKey($entire_key) { $entire_key = trim($entire_key); - if (!strlen($entire_key)) { + if (!@strlen($entire_key)) { throw new Exception(pht('No public key was provided.')); } @@ -34,7 +34,7 @@ // into a maximum of three parts. $parts = preg_split('/\s+/', $parts, 3); - if (preg_match('/private\s*key/i', $entire_key)) { + if (@preg_match('/private\s*key/i', $entire_key)) { // Try to give the user a better error message if it looks like // they uploaded a private key. throw new Exception(pht('Provide a public key, not a private key!')); @@ -102,7 +102,7 @@ public function getEntireKey() { $key = $this->type.' '.$this->body; - if (strlen($this->comment)) { + if (@strlen($this->comment)) { $key = $key.' '.$this->comment; } return $key; diff --git a/src/applications/auth/storage/PhabricatorAuthChallenge.php b/src/applications/auth/storage/PhabricatorAuthChallenge.php --- a/src/applications/auth/storage/PhabricatorAuthChallenge.php +++ b/src/applications/auth/storage/PhabricatorAuthChallenge.php @@ -57,27 +57,27 @@ assert_instances_of($challenges, __CLASS__); $token_list = $request->getStr(self::HTTPKEY); - $token_list = explode(' ', $token_list); + $token_list = @explode(' ', $token_list); $token_map = array(); foreach ($token_list as $token_element) { $token_element = trim($token_element, ' '); - if (!strlen($token_element)) { + if (!@strlen($token_element)) { continue; } // NOTE: This error message is intentionally not printing the token to // avoid disclosing it. As a result, it isn't terribly useful, but no // normal user should ever end up here. - if (!preg_match('/^[^:]+:/', $token_element)) { + if (!@preg_match('/^[^:]+:/', $token_element)) { throw new Exception( pht( 'This request included an improperly formatted MFA challenge '. 'token and can not be processed.')); } - list($phid, $token) = explode(':', $token_element, 2); + list($phid, $token) = @explode(':', $token_element, 2); if (isset($token_map[$phid])) { throw new Exception( @@ -194,7 +194,7 @@ 'set a new response token.')); } - if (preg_match('/ /', $token->openEnvelope())) { + if (@preg_match('/ /', $token->openEnvelope())) { throw new Exception( pht( 'The response token for this challenge is invalid: response '. diff --git a/src/applications/auth/storage/PhabricatorAuthFactorProvider.php b/src/applications/auth/storage/PhabricatorAuthFactorProvider.php --- a/src/applications/auth/storage/PhabricatorAuthFactorProvider.php +++ b/src/applications/auth/storage/PhabricatorAuthFactorProvider.php @@ -76,7 +76,7 @@ public function getDisplayName() { $name = $this->getName(); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/auth/storage/PhabricatorAuthMessage.php b/src/applications/auth/storage/PhabricatorAuthMessage.php --- a/src/applications/auth/storage/PhabricatorAuthMessage.php +++ b/src/applications/auth/storage/PhabricatorAuthMessage.php @@ -77,7 +77,7 @@ $message = self::loadMessage($viewer, $message_key); if ($message) { $message_text = $message->getMessageText(); - if (strlen($message_text)) { + if (@strlen($message_text)) { return $message_text; } } diff --git a/src/applications/auth/storage/PhabricatorAuthPassword.php b/src/applications/auth/storage/PhabricatorAuthPassword.php --- a/src/applications/auth/storage/PhabricatorAuthPassword.php +++ b/src/applications/auth/storage/PhabricatorAuthPassword.php @@ -109,7 +109,7 @@ PhabricatorAuthPasswordHashInterface $object, PhabricatorPasswordHasher $hasher) { - if (!strlen($password->openEnvelope())) { + if (!@strlen($password->openEnvelope())) { throw new Exception( pht('Attempting to set an empty password!')); } diff --git a/src/applications/auth/storage/PhabricatorAuthProviderConfigTransaction.php b/src/applications/auth/storage/PhabricatorAuthProviderConfigTransaction.php --- a/src/applications/auth/storage/PhabricatorAuthProviderConfigTransaction.php +++ b/src/applications/auth/storage/PhabricatorAuthProviderConfigTransaction.php @@ -150,7 +150,7 @@ $provider = $this->getProvider(); if ($provider) { $title = $provider->renderConfigPropertyTransactionTitle($this); - if (strlen($title)) { + if (@strlen($title)) { return $title; } } diff --git a/src/applications/auth/view/PhabricatorAuthAccountView.php b/src/applications/auth/view/PhabricatorAuthAccountView.php --- a/src/applications/auth/view/PhabricatorAuthAccountView.php +++ b/src/applications/auth/view/PhabricatorAuthAccountView.php @@ -29,13 +29,13 @@ $realname = $account->getRealName(); $use_name = null; - if (strlen($dispname)) { + if (@strlen($dispname)) { $use_name = $dispname; - } else if (strlen($username) && strlen($realname)) { + } else if (@strlen($username) && @strlen($realname)) { $use_name = $username.' ('.$realname.')'; - } else if (strlen($username)) { + } else if (@strlen($username)) { $use_name = $username; - } else if (strlen($realname)) { + } else if (@strlen($realname)) { $use_name = $realname; } @@ -62,7 +62,7 @@ )); $account_uri = $account->getAccountURI(); - if (strlen($account_uri)) { + if (@strlen($account_uri)) { // Make sure we don't link a "javascript:" URI if a user somehow // managed to get one here. diff --git a/src/applications/auth/xaction/PhabricatorAuthContactNumberNumberTransaction.php b/src/applications/auth/xaction/PhabricatorAuthContactNumberNumberTransaction.php --- a/src/applications/auth/xaction/PhabricatorAuthContactNumberNumberTransaction.php +++ b/src/applications/auth/xaction/PhabricatorAuthContactNumberNumberTransaction.php @@ -42,7 +42,7 @@ $max_length = $object->getColumnMaximumByteLength('contactNumber'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/auth/xaction/PhabricatorAuthFactorProviderDuoCredentialTransaction.php b/src/applications/auth/xaction/PhabricatorAuthFactorProviderDuoCredentialTransaction.php --- a/src/applications/auth/xaction/PhabricatorAuthFactorProviderDuoCredentialTransaction.php +++ b/src/applications/auth/xaction/PhabricatorAuthFactorProviderDuoCredentialTransaction.php @@ -40,7 +40,7 @@ foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - if (!strlen($new_value)) { + if (!@strlen($new_value)) { continue; } diff --git a/src/applications/auth/xaction/PhabricatorAuthFactorProviderDuoHostnameTransaction.php b/src/applications/auth/xaction/PhabricatorAuthFactorProviderDuoHostnameTransaction.php --- a/src/applications/auth/xaction/PhabricatorAuthFactorProviderDuoHostnameTransaction.php +++ b/src/applications/auth/xaction/PhabricatorAuthFactorProviderDuoHostnameTransaction.php @@ -39,7 +39,7 @@ foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - if (!strlen($new_value)) { + if (!@strlen($new_value)) { continue; } diff --git a/src/applications/auth/xaction/PhabricatorAuthFactorProviderNameTransaction.php b/src/applications/auth/xaction/PhabricatorAuthFactorProviderNameTransaction.php --- a/src/applications/auth/xaction/PhabricatorAuthFactorProviderNameTransaction.php +++ b/src/applications/auth/xaction/PhabricatorAuthFactorProviderNameTransaction.php @@ -17,12 +17,12 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s named this provider %s.', $this->renderAuthor(), $this->renderNewValue()); - } else if (!strlen($new)) { + } else if (!@strlen($new)) { return pht( '%s removed the name (%s) of this provider.', $this->renderAuthor(), @@ -42,7 +42,7 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/badges/controller/PhabricatorBadgesViewController.php b/src/applications/badges/controller/PhabricatorBadgesViewController.php --- a/src/applications/badges/controller/PhabricatorBadgesViewController.php +++ b/src/applications/badges/controller/PhabricatorBadgesViewController.php @@ -63,7 +63,7 @@ ->setUser($viewer); $description = $badge->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $view->addTextContent( new PHUIRemarkupView($viewer, $description)); } diff --git a/src/applications/badges/mail/PhabricatorBadgesMailReceiver.php b/src/applications/badges/mail/PhabricatorBadgesMailReceiver.php --- a/src/applications/badges/mail/PhabricatorBadgesMailReceiver.php +++ b/src/applications/badges/mail/PhabricatorBadgesMailReceiver.php @@ -13,7 +13,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 4); + $id = (int)@substr($pattern, 4); return id(new PhabricatorBadgesQuery()) ->setViewer($viewer) diff --git a/src/applications/badges/xaction/PhabricatorBadgesBadgeFlavorTransaction.php b/src/applications/badges/xaction/PhabricatorBadgesBadgeFlavorTransaction.php --- a/src/applications/badges/xaction/PhabricatorBadgesBadgeFlavorTransaction.php +++ b/src/applications/badges/xaction/PhabricatorBadgesBadgeFlavorTransaction.php @@ -36,7 +36,7 @@ $max_length = $object->getColumnMaximumByteLength('flavor'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newRequiredError( pht('The flavor text can be no longer than %s characters.', diff --git a/src/applications/badges/xaction/PhabricatorBadgesBadgeNameTransaction.php b/src/applications/badges/xaction/PhabricatorBadgesBadgeNameTransaction.php --- a/src/applications/badges/xaction/PhabricatorBadgesBadgeNameTransaction.php +++ b/src/applications/badges/xaction/PhabricatorBadgesBadgeNameTransaction.php @@ -41,7 +41,7 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The name can be no longer than %s characters.', diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php --- a/src/applications/base/controller/PhabricatorController.php +++ b/src/applications/base/controller/PhabricatorController.php @@ -74,7 +74,7 @@ $session_engine = new PhabricatorAuthSessionEngine(); $phsid = $request->getCookie(PhabricatorCookies::COOKIE_SESSION); - if (strlen($phsid)) { + if (@strlen($phsid)) { $session_user = $session_engine->loadUserForSession( PhabricatorAuthSession::TYPE_WEB, $phsid); diff --git a/src/applications/cache/PhabricatorCaches.php b/src/applications/cache/PhabricatorCaches.php --- a/src/applications/cache/PhabricatorCaches.php +++ b/src/applications/cache/PhabricatorCaches.php @@ -421,7 +421,7 @@ * @task compress */ public static function maybeDeflateData($value) { - $len = strlen($value); + $len = @strlen($value); if ($len <= 1024) { return null; } @@ -435,7 +435,7 @@ return null; } - $deflated_len = strlen($deflated); + $deflated_len = @strlen($deflated); if ($deflated_len >= ($len / 2)) { return null; } diff --git a/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php b/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php --- a/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php +++ b/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php @@ -27,11 +27,11 @@ $is_all = $args->getArg('all'); $key_list = $args->getArg('caches'); - if ($is_all && strlen($key_list)) { + if ($is_all && @strlen($key_list)) { throw new PhutilArgumentUsageException( pht( 'Specify either "--all" or "--caches", not both.')); - } else if (!$is_all && !strlen($key_list)) { + } else if (!$is_all && !@strlen($key_list)) { throw new PhutilArgumentUsageException( pht( 'Select caches to purge with "--all" or "--caches". Available '. diff --git a/src/applications/cache/spec/PhabricatorDataCacheSpec.php b/src/applications/cache/spec/PhabricatorDataCacheSpec.php --- a/src/applications/cache/spec/PhabricatorDataCacheSpec.php +++ b/src/applications/cache/spec/PhabricatorDataCacheSpec.php @@ -141,7 +141,7 @@ // If this key isn't in the current cache namespace, don't reveal any // information about it. $namespace = PhabricatorEnv::getEnvConfig('phabricator.cache-namespace'); - if (strncmp($key, $namespace.':', strlen($namespace) + 1)) { + if (strncmp($key, $namespace.':', @strlen($namespace) + 1)) { return ''; } diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php --- a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php @@ -515,7 +515,7 @@ $properties = id(new PHUIPropertyListView()) ->setUser($viewer); - if (strlen($event->getDescription())) { + if (@strlen($event->getDescription())) { $description = new PHUIRemarkupView($viewer, $event->getDescription()); $properties->addTextContent($description); return $properties; diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php --- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php +++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php @@ -324,7 +324,7 @@ $description = $object->getDescription(); if ($this->getIsNewObject()) { - if (strlen($description)) { + if (@strlen($description)) { $body->addRemarkupSection( pht('EVENT DESCRIPTION'), $description); diff --git a/src/applications/calendar/import/PhabricatorCalendarICSFileImportEngine.php b/src/applications/calendar/import/PhabricatorCalendarICSFileImportEngine.php --- a/src/applications/calendar/import/PhabricatorCalendarICSFileImportEngine.php +++ b/src/applications/calendar/import/PhabricatorCalendarICSFileImportEngine.php @@ -56,7 +56,7 @@ public function getDisplayName(PhabricatorCalendarImport $import) { $filename_key = PhabricatorCalendarImportICSFileTransaction::PARAMKEY_NAME; $filename = $import->getParameter($filename_key); - if (strlen($filename)) { + if (@strlen($filename)) { return pht('ICS File "%s"', $filename); } else { return pht('ICS File'); diff --git a/src/applications/calendar/import/PhabricatorCalendarImportEngine.php b/src/applications/calendar/import/PhabricatorCalendarImportEngine.php --- a/src/applications/calendar/import/PhabricatorCalendarImportEngine.php +++ b/src/applications/calendar/import/PhabricatorCalendarImportEngine.php @@ -161,7 +161,7 @@ foreach ($node_map as $full_uid => $node) { $uid = $node->getUID(); $matches = null; - if (preg_match('/^(PHID-.*)@(.*)\z/', $uid, $matches)) { + if (@preg_match('/^(PHID-.*)@(.*)\z/', $uid, $matches)) { $likely_phids[$full_uid] = $matches[1]; } } @@ -235,14 +235,14 @@ // We avoid disclosing email addresses to be consistent with the rest // of the product. $name = $attendee->getName(); - if (preg_match('/@/', $name)) { + if (@preg_match('/@/', $name)) { $name = new PhutilEmailAddress($name); $name = $name->getDisplayName(); } // If we don't have a name or the name still looks like it's an // email address, give them a dummy placeholder name. - if (!strlen($name) || preg_match('/@/', $name)) { + if (!@strlen($name) || @preg_match('/@/', $name)) { $name = pht('Private User %d', $private_index); $private_index++; } @@ -447,7 +447,7 @@ private function getParentNodeUID(PhutilCalendarEventNode $node) { $recurrence_id = $node->getRecurrenceID(); - if (!strlen($recurrence_id)) { + if (!@strlen($recurrence_id)) { return null; } @@ -456,7 +456,7 @@ private function getNodeInstanceEpoch(PhutilCalendarEventNode $node) { $instance_iso = $node->getRecurrenceID(); - if (strlen($instance_iso)) { + if (@strlen($instance_iso)) { $instance_datetime = PhutilCalendarAbsoluteDateTime::newFromISO8601( $instance_iso); $instance_epoch = $instance_datetime->getEpoch(); @@ -481,8 +481,8 @@ } $name = $node->getName(); - if (!strlen($name)) { - if (strlen($uid)) { + if (!@strlen($name)) { + if (@strlen($uid)) { $name = pht('Unnamed Event "%s"', $uid); } else { $name = pht('Unnamed Imported Event'); @@ -571,7 +571,7 @@ } final protected function shouldQueueDataImport($data) { - return (strlen($data) > self::QUEUE_BYTE_LIMIT); + return (@strlen($data) > self::QUEUE_BYTE_LIMIT); } final protected function queueDataImport( @@ -581,7 +581,7 @@ $import->newLogMessage( PhabricatorCalendarImportQueueLogType::LOGTYPE, array( - 'data.size' => strlen($data), + 'data.size' => @strlen($data), 'data.limit' => self::QUEUE_BYTE_LIMIT, )); diff --git a/src/applications/calendar/importlog/PhabricatorCalendarImportDefaultLogType.php b/src/applications/calendar/importlog/PhabricatorCalendarImportDefaultLogType.php --- a/src/applications/calendar/importlog/PhabricatorCalendarImportDefaultLogType.php +++ b/src/applications/calendar/importlog/PhabricatorCalendarImportDefaultLogType.php @@ -10,7 +10,7 @@ PhabricatorCalendarImportLog $log) { $type = $log->getParameter('type'); - if (strlen($type)) { + if (@strlen($type)) { return pht('Unknown Message "%s"', $type); } else { return pht('Unknown Message'); diff --git a/src/applications/calendar/mail/PhabricatorCalendarEventMailReceiver.php b/src/applications/calendar/mail/PhabricatorCalendarEventMailReceiver.php --- a/src/applications/calendar/mail/PhabricatorCalendarEventMailReceiver.php +++ b/src/applications/calendar/mail/PhabricatorCalendarEventMailReceiver.php @@ -13,7 +13,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 1); + $id = (int)@substr($pattern, 1); return id(new PhabricatorCalendarEventQuery()) ->setViewer($viewer) diff --git a/src/applications/calendar/parser/data/PhutilCalendarAbsoluteDateTime.php b/src/applications/calendar/parser/data/PhutilCalendarAbsoluteDateTime.php --- a/src/applications/calendar/parser/data/PhutilCalendarAbsoluteDateTime.php +++ b/src/applications/calendar/parser/data/PhutilCalendarAbsoluteDateTime.php @@ -21,7 +21,7 @@ '\z/'; $matches = null; - $ok = preg_match($pattern, $value, $matches); + $ok = @preg_match($pattern, $value, $matches); if (!$ok) { throw new Exception( pht( diff --git a/src/applications/calendar/parser/data/PhutilCalendarDuration.php b/src/applications/calendar/parser/data/PhutilCalendarDuration.php --- a/src/applications/calendar/parser/data/PhutilCalendarDuration.php +++ b/src/applications/calendar/parser/data/PhutilCalendarDuration.php @@ -70,7 +70,7 @@ '\z/'; $matches = null; - $ok = preg_match($pattern, $value, $matches); + $ok = @preg_match($pattern, $value, $matches); if (!$ok) { throw new Exception( pht( diff --git a/src/applications/calendar/parser/data/PhutilCalendarRecurrenceRule.php b/src/applications/calendar/parser/data/PhutilCalendarRecurrenceRule.php --- a/src/applications/calendar/parser/data/PhutilCalendarRecurrenceRule.php +++ b/src/applications/calendar/parser/data/PhutilCalendarRecurrenceRule.php @@ -235,11 +235,11 @@ } public static function newFromRRULE($rrule) { - $parts = explode(';', $rrule); + $parts = @explode(';', $rrule); $dict = array(); foreach ($parts as $part) { - list($key, $value) = explode('=', $part, 2); + list($key, $value) = @explode('=', $part, 2); switch ($key) { case 'FREQ': case 'INTERVAL': @@ -248,7 +248,7 @@ case 'UNTIL'; break; default: - $value = explode(',', $value); + $value = @explode(',', $value); break; } $dict[$key] = $value; @@ -276,7 +276,7 @@ foreach ($dict as $key => $value) { if (isset($int_values[$key])) { // None of these values may be negative. - if (!preg_match('/^\d+\z/', $value)) { + if (!@preg_match('/^\d+\z/', $value)) { throw new Exception( pht( 'Unexpected value "%s" in "%s" RULE property: expected an '. @@ -289,7 +289,7 @@ if (isset($int_lists[$key])) { foreach ($value as $k => $v) { - if (!preg_match('/^-?\d+\z/', $v)) { + if (!@preg_match('/^-?\d+\z/', $v)) { throw new Exception( pht( 'Unexpected value "%s" in "%s" RRULE property: expected '. @@ -466,7 +466,7 @@ $pattern = '/^(?:[+-]?([1-9]\d?))?('.$constants.')\z/'; foreach ($by_day as $key => $value) { $matches = null; - if (!preg_match($pattern, $value, $matches)) { + if (!@preg_match($pattern, $value, $matches)) { throw new Exception( pht( 'RRULE BYDAY value "%s" is invalid: rule part must be in the '. diff --git a/src/applications/calendar/parser/ics/PhutilICSParser.php b/src/applications/calendar/parser/ics/PhutilICSParser.php --- a/src/applications/calendar/parser/ics/PhutilICSParser.php +++ b/src/applications/calendar/parser/ics/PhutilICSParser.php @@ -52,9 +52,9 @@ foreach ($lines as $key => $line) { $this->cursor = $key; $matches = null; - if (preg_match('(^BEGIN:(.*)\z)', $line, $matches)) { + if (@preg_match('(^BEGIN:(.*)\z)', $line, $matches)) { $this->beginParsingNode($matches[1]); - } else if (preg_match('(^END:(.*)\z)', $line, $matches)) { + } else if (@preg_match('(^END:(.*)\z)', $line, $matches)) { $this->endParsingNode($matches[1]); } else { if (count($this->stack) < 2) { @@ -101,7 +101,7 @@ $last = null; foreach ($lines as $idx => $line) { $this->cursor = $idx; - if (!preg_match('/^[ \t]/', $line)) { + if (!@preg_match('/^[ \t]/', $line)) { $last = $idx; continue; } @@ -114,7 +114,7 @@ 'marks a line which should be unfolded.')); } - $lines[$last] = $lines[$last].substr($line, 1); + $lines[$last] = $lines[$last].@substr($line, 1); unset($lines[$idx]); } @@ -195,7 +195,7 @@ // by either a ";" (to begin a list of parameters) or a ":" (to begin // the actual field body). - $ok = preg_match('(^([A-Za-z0-9-]+)([;:])(.*)\z)', $line, $matches); + $ok = @preg_match('(^([A-Za-z0-9-]+)([;:])(.*)\z)', $line, $matches); if (!$ok) { $this->raiseParseFailure( self::PARSE_MALFORMED_PROPERTY, @@ -214,7 +214,7 @@ while (true) { // We're going to get the first couple of parts first. - $ok = preg_match('(^([^=]+)=)', $body, $matches); + $ok = @preg_match('(^([^=]+)=)', $body, $matches); if (!$ok) { $this->raiseParseFailure( self::PARSE_MALFORMED_PARAMETER_NAME, @@ -224,16 +224,16 @@ } $param_name = $matches[1]; - $body = substr($body, strlen($matches[0])); + $body = @substr($body, @strlen($matches[0])); // Now we're going to match zero or more values. $param_values = array(); while (true) { // The value can either be a double-quoted string or an unquoted // string, with some characters forbidden. - if (strlen($body) && $body[0] == '"') { + if (@strlen($body) && $body[0] == '"') { $is_quoted = true; - $ok = preg_match( + $ok = @preg_match( '(^"([^\x00-\x08\x10-\x19"]*)")', $body, $matches); @@ -249,7 +249,7 @@ // It's impossible for this not to match since it can match // nothing, and it's valid for it to match nothing. - preg_match('(^([^\x00-\x08\x10-\x19";:,]*))', $body, $matches); + @preg_match('(^([^\x00-\x08\x10-\x19";:,]*))', $body, $matches); } // NOTE: RFC5545 says "Property parameter values that are not in @@ -262,8 +262,8 @@ 'quoted' => $is_quoted, ); - $body = substr($body, strlen($matches[0])); - if (!strlen($body)) { + $body = @substr($body, @strlen($matches[0])); + if (!@strlen($body)) { $this->raiseParseFailure( self::PARSE_MISSING_VALUE, pht( @@ -273,7 +273,7 @@ // If we have a comma now, we're going to read another value. Strip // it off and keep going. if ($body[0] == ',') { - $body = substr($body, 1); + $body = @substr($body, 1); continue; } @@ -306,12 +306,12 @@ ); if ($body[0] == ';') { - $body = substr($body, 1); + $body = @substr($body, 1); continue; } if ($body[0] == ':') { - $body = substr($body, 1); + $body = @substr($body, 1); break; } } @@ -488,36 +488,36 @@ break; case 'DATE': // This is a comma-separated list of "YYYYMMDD" values. - $result = explode(',', $data); + $result = @explode(',', $data); break; case 'DATE-TIME': - if (!strlen($data)) { + if (!@strlen($data)) { $result = array(); } else { - $result = explode(',', $data); + $result = @explode(',', $data); } break; case 'DURATION': - if (!strlen($data)) { + if (!@strlen($data)) { $result = array(); } else { - $result = explode(',', $data); + $result = @explode(',', $data); } break; case 'FLOAT': - $result = explode(',', $data); + $result = @explode(',', $data); foreach ($result as $k => $v) { $result[$k] = (float)$v; } break; case 'INTEGER': - $result = explode(',', $data); + $result = @explode(',', $data); foreach ($result as $k => $v) { $result[$k] = (int)$v; } break; case 'PERIOD': - $result = explode(',', $data); + $result = @explode(',', $data); break; case 'RECUR': $result = $data; @@ -526,7 +526,7 @@ $result = $this->unescapeTextValue($data); break; case 'TIME': - $result = explode(',', $data); + $result = @explode(',', $data); break; case 'URI': $result = $data; @@ -728,7 +728,7 @@ $value = head($value); $tzid = $this->getScalarParameterValue($parameters, 'TZID'); - if (preg_match('/Z\z/', $value)) { + if (@preg_match('/Z\z/', $value)) { if ($tzid) { $this->raiseWarning( self::WARN_TZID_UTC, @@ -876,7 +876,7 @@ '/i'; $matches = null; - if (preg_match($offset_pattern, $tzid, $matches)) { + if (@preg_match($offset_pattern, $tzid, $matches)) { $hours = (int)$matches['h']; $minutes = (int)idx($matches, 'm'); $offset = ($hours * 60 * 60) + ($minutes * 60); diff --git a/src/applications/calendar/parser/ics/PhutilICSWriter.php b/src/applications/calendar/parser/ics/PhutilICSWriter.php --- a/src/applications/calendar/parser/ics/PhutilICSWriter.php +++ b/src/applications/calendar/parser/ics/PhutilICSWriter.php @@ -94,7 +94,7 @@ foreach (phutil_utf8v($line) as $character) { // If adding this character would bring the line over 75 bytes, start // a new line. - if (strlen($buf) + strlen($character) > 75) { + if (@strlen($buf) + @strlen($character) > 75) { $out[] = $buf."\r\n"; $buf = ' '; } @@ -137,7 +137,7 @@ $properties = array(); $uid = $event->getUID(); - if (!strlen($uid)) { + if (!@strlen($uid)) { throw new Exception( pht( 'Unable to write ICS document: event has no UID, but each event '. @@ -180,14 +180,14 @@ } $name = $event->getName(); - if (strlen($name)) { + if (@strlen($name)) { $properties[] = $this->newTextProperty( 'SUMMARY', $name); } $description = $event->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $properties[] = $this->newTextProperty( 'DESCRIPTION', $description); @@ -364,7 +364,7 @@ // RFC5545 says that we MUST quote it if it has a colon, a semicolon, // or a comma, and that we MUST quote it if it's a URI. - if (!preg_match('/^[A-Za-z0-9-]*\z/', $v)) { + if (!@preg_match('/^[A-Za-z0-9-]*\z/', $v)) { $v = '"'.$v.'"'; } diff --git a/src/applications/calendar/phid/PhabricatorCalendarEventPHIDType.php b/src/applications/calendar/phid/PhabricatorCalendarEventPHIDType.php --- a/src/applications/calendar/phid/PhabricatorCalendarEventPHIDType.php +++ b/src/applications/calendar/phid/PhabricatorCalendarEventPHIDType.php @@ -48,7 +48,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^E[1-9]\d*$/i', $name); + return @preg_match('/^E[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -57,7 +57,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/calendar/storage/PhabricatorCalendarImport.php b/src/applications/calendar/storage/PhabricatorCalendarImport.php --- a/src/applications/calendar/storage/PhabricatorCalendarImport.php +++ b/src/applications/calendar/storage/PhabricatorCalendarImport.php @@ -87,7 +87,7 @@ public function getDisplayName() { $name = $this->getName(); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/calendar/util/CalendarTimeUtil.php b/src/applications/calendar/util/CalendarTimeUtil.php --- a/src/applications/calendar/util/CalendarTimeUtil.php +++ b/src/applications/calendar/util/CalendarTimeUtil.php @@ -71,7 +71,7 @@ $today = new DateTime('@'.$today_epoch); $today->setTimezone($timezone); - if (strtolower($start_day_str) == 'today' || + if (@strtolower($start_day_str) == 'today' || $today->format('l') == $start_day_str) { $start_day = clone $today; } else { diff --git a/src/applications/calendar/xaction/PhabricatorCalendarImportICSFileTransaction.php b/src/applications/calendar/xaction/PhabricatorCalendarImportICSFileTransaction.php --- a/src/applications/calendar/xaction/PhabricatorCalendarImportICSFileTransaction.php +++ b/src/applications/calendar/xaction/PhabricatorCalendarImportICSFileTransaction.php @@ -53,7 +53,7 @@ $new_value = $object->getParameter(self::PARAMKEY_FILE); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - if (!strlen($new_value)) { + if (!@strlen($new_value)) { continue; } diff --git a/src/applications/calendar/xaction/PhabricatorCalendarImportICSURITransaction.php b/src/applications/calendar/xaction/PhabricatorCalendarImportICSURITransaction.php --- a/src/applications/calendar/xaction/PhabricatorCalendarImportICSURITransaction.php +++ b/src/applications/calendar/xaction/PhabricatorCalendarImportICSURITransaction.php @@ -45,7 +45,7 @@ $new_value = $object->getParameter(self::PARAMKEY_URI); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - if (!strlen($new_value)) { + if (!@strlen($new_value)) { continue; } @@ -63,7 +63,7 @@ } } - if (!strlen($new_value)) { + if (!@strlen($new_value)) { $errors[] = $this->newRequiredError( pht('You must select an ".ics" URI to import.')); } diff --git a/src/applications/calendar/xaction/PhabricatorCalendarImportNameTransaction.php b/src/applications/calendar/xaction/PhabricatorCalendarImportNameTransaction.php --- a/src/applications/calendar/xaction/PhabricatorCalendarImportNameTransaction.php +++ b/src/applications/calendar/xaction/PhabricatorCalendarImportNameTransaction.php @@ -17,12 +17,12 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s named this import %s.', $this->renderAuthor(), $this->renderNewValue()); - } else if (!strlen($new)) { + } else if (!@strlen($new)) { return pht( '%s removed the name of this import (was: %s).', $this->renderAuthor(), diff --git a/src/applications/celerity/CelerityResourceMapGenerator.php b/src/applications/celerity/CelerityResourceMapGenerator.php --- a/src/applications/celerity/CelerityResourceMapGenerator.php +++ b/src/applications/celerity/CelerityResourceMapGenerator.php @@ -221,7 +221,7 @@ $parser = new PhutilDocblockParser(); $matches = array(); - $ok = preg_match('@/[*][*].*?[*]/@s', $data, $matches); + $ok = @preg_match('@/[*][*].*?[*]/@s', $data, $matches); if (!$ok) { throw new Exception( pht( @@ -401,7 +401,7 @@ $hash = PhabricatorHash::digestHMACSHA256($data, 'celerity-resource-data'); - return substr($hash, 0, 8); + return @substr($hash, 0, 8); } } diff --git a/src/applications/celerity/CelerityResourceTransformer.php b/src/applications/celerity/CelerityResourceTransformer.php --- a/src/applications/celerity/CelerityResourceTransformer.php +++ b/src/applications/celerity/CelerityResourceTransformer.php @@ -68,7 +68,7 @@ // Some resources won't survive minification (like d3.min.js), and are // marked so as not to be minified. - if (strpos($data, '@'.'do-not-minify') !== false) { + if (@strpos($data, '@'.'do-not-minify') !== false) { return $data; } @@ -114,7 +114,7 @@ } public static function getResourceType($path) { - return last(explode('.', $path)); + return last(@explode('.', $path)); } public function translateResourceURI(array $matches) { @@ -232,7 +232,7 @@ * @return string|null Data URI, or null if we declined to generate one. */ private function generateDataURI($resource_name) { - $ext = last(explode('.', $resource_name)); + $ext = last(@explode('.', $resource_name)); switch ($ext) { case 'png': $type = 'image/png'; @@ -251,14 +251,14 @@ $maximum_data_size = (1024 * 32); $data = $this->celerityMap->getResourceDataForName($resource_name); - if (strlen($data) >= $maximum_data_size) { + if (@strlen($data) >= $maximum_data_size) { // If the data is already too large on its own, just bail before // encoding it. return null; } $uri = 'data:'.$type.';base64,'.base64_encode($data); - if (strlen($uri) >= $maximum_data_size) { + if (@strlen($uri) >= $maximum_data_size) { return null; } diff --git a/src/applications/celerity/CeleritySpriteGenerator.php b/src/applications/celerity/CeleritySpriteGenerator.php --- a/src/applications/celerity/CeleritySpriteGenerator.php +++ b/src/applications/celerity/CeleritySpriteGenerator.php @@ -78,7 +78,7 @@ $images = Filesystem::listDirectory($path, $include_hidden = false); foreach ($images as $image) { - if (!preg_match('/\.png$/', $image)) { + if (!@preg_match('/\.png$/', $image)) { throw new Exception( pht( "Expected file '%s' in '%s' to be a sprite source ending in '%s'.", @@ -86,7 +86,7 @@ $path, '.png')); } - $result[] = substr($image, 0, -4); + $result[] = @substr($image, 0, -4); } return $result; diff --git a/src/applications/celerity/CelerityStaticResourceResponse.php b/src/applications/celerity/CelerityStaticResourceResponse.php --- a/src/applications/celerity/CelerityStaticResourceResponse.php +++ b/src/applications/celerity/CelerityStaticResourceResponse.php @@ -299,7 +299,7 @@ 'Literal %s is not allowed inside inline script.', '')); } - if (strpos($data, 'setContentLength(strlen($data)); + if (@strlen($range)) { + $response->setContentLength(@strlen($data)); list($range_begin, $range_end) = $response->parseHTTPRange($range); if ($range_begin !== null) { if ($range_end !== null) { - $data = substr($data, $range_begin, ($range_end - $range_begin)); + $data = @substr($data, $range_begin, ($range_end - $range_begin)); } else { - $data = substr($data, $range_begin); + $data = @substr($data, $range_begin); } } diff --git a/src/applications/celerity/resources/CelerityPhysicalResources.php b/src/applications/celerity/resources/CelerityPhysicalResources.php --- a/src/applications/celerity/resources/CelerityPhysicalResources.php +++ b/src/applications/celerity/resources/CelerityPhysicalResources.php @@ -31,7 +31,7 @@ foreach ($resources_list as $resources) { $name = $resources->getName(); - if (!preg_match('/^[a-z0-9]+/', $name)) { + if (!@preg_match('/^[a-z0-9]+/', $name)) { throw new Exception( pht( 'Resources name "%s" is not valid; it must contain only '. diff --git a/src/applications/conduit/controller/PhabricatorConduitAPIController.php b/src/applications/conduit/controller/PhabricatorConduitAPIController.php --- a/src/applications/conduit/controller/PhabricatorConduitAPIController.php +++ b/src/applications/conduit/controller/PhabricatorConduitAPIController.php @@ -290,9 +290,9 @@ } $token_string = idx($metadata, 'token'); - if (strlen($token_string)) { + if (@strlen($token_string)) { - if (strlen($token_string) != 32) { + if (@strlen($token_string) != 32) { return array( 'ERR-INVALID-AUTH', pht( @@ -302,7 +302,7 @@ ); } - $type = head(explode('-', $token_string)); + $type = head(@explode('-', $token_string)); $valid_types = PhabricatorConduitToken::getAllTokenTypes(); $valid_types = array_fuse($valid_types); if (empty($valid_types[$type])) { @@ -654,7 +654,7 @@ $value = 'null'; } $decoded_value = json_decode($value, true); - if ($decoded_value === null && strtolower($value) != 'null') { + if ($decoded_value === null && @strtolower($value) != 'null') { // When json_decode() fails, it returns null. This almost certainly // indicates that a user was using the web UI and didn't put quotes // around a string value. We can either do what we think they meant @@ -683,7 +683,7 @@ // Otherwise, look for a single parameter called 'params' which has the // entire param dictionary JSON encoded. $params_json = $request->getStr('params'); - if (strlen($params_json)) { + if (@strlen($params_json)) { $params = null; try { $params = phutil_json_decode($params_json); diff --git a/src/applications/conduit/management/PhabricatorConduitCallManagementWorkflow.php b/src/applications/conduit/management/PhabricatorConduitCallManagementWorkflow.php --- a/src/applications/conduit/management/PhabricatorConduitCallManagementWorkflow.php +++ b/src/applications/conduit/management/PhabricatorConduitCallManagementWorkflow.php @@ -41,19 +41,19 @@ $viewer = $this->getViewer(); $method = $args->getArg('method'); - if (!strlen($method)) { + if (!@strlen($method)) { throw new PhutilArgumentUsageException( pht('Specify a method to call with "--method".')); } $input = $args->getArg('input'); - if (!strlen($input)) { + if (!@strlen($input)) { throw new PhutilArgumentUsageException( pht('Specify a file to read parameters from with "--input".')); } $as = $args->getArg('as'); - if (strlen($as)) { + if (@strlen($as)) { $actor = id(new PhabricatorPeopleQuery()) ->setViewer($viewer) ->withUsernames(array($as)) diff --git a/src/applications/conduit/method/ConduitAPIMethod.php b/src/applications/conduit/method/ConduitAPIMethod.php --- a/src/applications/conduit/method/ConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitAPIMethod.php @@ -151,7 +151,7 @@ ); $ord = idx($map, $this->getMethodStatus(), 0); - list($head, $tail) = explode('.', $name, 2); + list($head, $tail) = @explode('.', $name, 2); return "{$head}.{$ord}.{$tail}"; } @@ -167,7 +167,7 @@ } public function getApplicationName() { - return head(explode('.', $this->getAPIMethodName(), 2)); + return head(@explode('.', $this->getAPIMethodName(), 2)); } public static function loadAllConduitMethods() { @@ -221,7 +221,7 @@ public static function getParameterMetadataKey($key) { if (strncmp($key, 'api.', 4) === 0) { // All keys passed beginning with "api." are always metadata keys. - return substr($key, 4); + return @substr($key, 4); } else { switch ($key) { // These are real keys which always belong to request metadata. diff --git a/src/applications/conduit/query/PhabricatorConduitMethodQuery.php b/src/applications/conduit/query/PhabricatorConduitMethodQuery.php --- a/src/applications/conduit/query/PhabricatorConduitMethodQuery.php +++ b/src/applications/conduit/query/PhabricatorConduitMethodQuery.php @@ -87,7 +87,7 @@ foreach ($methods as $key => $method) { $haystack = $method->getAPIMethodName(); $haystack = phutil_utf8_strtolower($haystack); - if (strpos($haystack, $needle) === false) { + if (@strpos($haystack, $needle) === false) { unset($methods[$key]); } } diff --git a/src/applications/conduit/query/PhabricatorConduitSearchEngine.php b/src/applications/conduit/query/PhabricatorConduitSearchEngine.php --- a/src/applications/conduit/query/PhabricatorConduitSearchEngine.php +++ b/src/applications/conduit/query/PhabricatorConduitSearchEngine.php @@ -39,7 +39,7 @@ $query->withIsInternal(false); $contains = $saved->getParameter('nameContains'); - if (strlen($contains)) { + if (@strlen($contains)) { $query->withNameContains($contains); } diff --git a/src/applications/conduit/storage/PhabricatorConduitToken.php b/src/applications/conduit/storage/PhabricatorConduitToken.php --- a/src/applications/conduit/storage/PhabricatorConduitToken.php +++ b/src/applications/conduit/storage/PhabricatorConduitToken.php @@ -90,7 +90,7 @@ $token->expires = $token->getTokenExpires($token_type); $secret = $token_type.'-'.Filesystem::readRandomCharacters(32); - $secret = substr($secret, 0, 32); + $secret = @substr($secret, 0, 32); $token->token = $secret; return $token; @@ -134,7 +134,7 @@ case self::TYPE_CLUSTER: return pht('Cluster API Token'); default: - return substr($this->getToken(), 0, 8).'...'; + return @substr($this->getToken(), 0, 8).'...'; } } diff --git a/src/applications/config/check/PhabricatorBaseURISetupCheck.php b/src/applications/config/check/PhabricatorBaseURISetupCheck.php --- a/src/applications/config/check/PhabricatorBaseURISetupCheck.php +++ b/src/applications/config/check/PhabricatorBaseURISetupCheck.php @@ -10,8 +10,8 @@ $base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri'); $host_header = AphrontRequest::getHTTPHeader('Host'); - if (strpos($host_header, '.') === false) { - if (!strlen(trim($host_header))) { + if (@strpos($host_header, '.') === false) { + if (!@strlen(trim($host_header))) { $name = pht('No "Host" Header'); $summary = pht('No "Host" header present in request.'); $message = pht( diff --git a/src/applications/config/check/PhabricatorBinariesSetupCheck.php b/src/applications/config/check/PhabricatorBinariesSetupCheck.php --- a/src/applications/config/check/PhabricatorBinariesSetupCheck.php +++ b/src/applications/config/check/PhabricatorBinariesSetupCheck.php @@ -141,7 +141,7 @@ $version_details = array(); foreach ($bad_versions as $spec => $details) { - list($operator, $bad_version) = explode(' ', $spec, 2); + list($operator, $bad_version) = @explode(' ', $spec, 2); $is_bad = version_compare($version, $bad_version, $operator); if ($is_bad) { $version_details[] = pht( diff --git a/src/applications/config/check/PhabricatorDaemonsSetupCheck.php b/src/applications/config/check/PhabricatorDaemonsSetupCheck.php --- a/src/applications/config/check/PhabricatorDaemonsSetupCheck.php +++ b/src/applications/config/check/PhabricatorDaemonsSetupCheck.php @@ -54,7 +54,7 @@ } $expect_user = PhabricatorEnv::getEnvConfig('phd.user'); - if (strlen($expect_user)) { + if (@strlen($expect_user)) { try { $all_daemons = id(new PhabricatorDaemonLogQuery()) diff --git a/src/applications/config/check/PhabricatorDatabaseSetupCheck.php b/src/applications/config/check/PhabricatorDatabaseSetupCheck.php --- a/src/applications/config/check/PhabricatorDatabaseSetupCheck.php +++ b/src/applications/config/check/PhabricatorDatabaseSetupCheck.php @@ -14,7 +14,7 @@ protected function executeChecks() { $host = PhabricatorEnv::getEnvConfig('mysql.host'); $matches = null; - if (preg_match('/^([^:]+):(\d+)$/', $host, $matches)) { + if (@preg_match('/^([^:]+):(\d+)$/', $host, $matches)) { $host = $matches[1]; $port = $matches[2]; diff --git a/src/applications/config/check/PhabricatorMySQLSetupCheck.php b/src/applications/config/check/PhabricatorMySQLSetupCheck.php --- a/src/applications/config/check/PhabricatorMySQLSetupCheck.php +++ b/src/applications/config/check/PhabricatorMySQLSetupCheck.php @@ -45,7 +45,7 @@ } $modes = $ref->loadRawMySQLConfigValue('sql_mode'); - $modes = explode(',', $modes); + $modes = @explode(',', $modes); if (!in_array('STRICT_ALL_TABLES', $modes)) { $summary = pht( diff --git a/src/applications/config/check/PhabricatorPHPPreflightSetupCheck.php b/src/applications/config/check/PhabricatorPHPPreflightSetupCheck.php --- a/src/applications/config/check/PhabricatorPHPPreflightSetupCheck.php +++ b/src/applications/config/check/PhabricatorPHPPreflightSetupCheck.php @@ -77,7 +77,7 @@ $functions = preg_split('/[, ]+/', $disable_value); $functions = array_filter($functions); foreach ($functions as $k => $function) { - if (preg_match('/^pcntl_/', $function)) { + if (@preg_match('/^pcntl_/', $function)) { unset($functions[$k]); } } @@ -121,7 +121,7 @@ } $open_basedir = ini_get('open_basedir'); - if (strlen($open_basedir)) { + if (@strlen($open_basedir)) { // If `open_basedir` is set, just fatal. It's technically possible for // us to run with certain values of `open_basedir`, but: we can only // raise fatal errors from preflight steps, so we'd have to do this check diff --git a/src/applications/config/check/PhabricatorPathSetupCheck.php b/src/applications/config/check/PhabricatorPathSetupCheck.php --- a/src/applications/config/check/PhabricatorPathSetupCheck.php +++ b/src/applications/config/check/PhabricatorPathSetupCheck.php @@ -43,10 +43,10 @@ // Users are remarkably industrious at misconfiguring software. Try to // catch mistaken configuration of PATH. - $path_parts = explode(PATH_SEPARATOR, $path); + $path_parts = @explode(PATH_SEPARATOR, $path); $bad_paths = array(); foreach ($path_parts as $path_part) { - if (!strlen($path_part)) { + if (!@strlen($path_part)) { continue; } @@ -107,7 +107,7 @@ if ($bad_paths) { foreach ($bad_paths as $path_part => $message) { - $digest = substr(PhabricatorHash::weakDigest($path_part), 0, 8); + $digest = @substr(PhabricatorHash::weakDigest($path_part), 0, 8); $this ->newIssue('config.PATH.'.$digest) diff --git a/src/applications/config/check/PhabricatorSecuritySetupCheck.php b/src/applications/config/check/PhabricatorSecuritySetupCheck.php --- a/src/applications/config/check/PhabricatorSecuritySetupCheck.php +++ b/src/applications/config/check/PhabricatorSecuritySetupCheck.php @@ -19,7 +19,7 @@ ->setEnv($payload, $wipe_process_env = true) ->resolve(); - if (!$err && preg_match('/VULNERABLE/', $stdout)) { + if (!$err && @preg_match('/VULNERABLE/', $stdout)) { $summary = pht( 'This system has an unpatched version of Bash with a severe, widely '. 'disclosed vulnerability.'); diff --git a/src/applications/config/check/PhabricatorSetupCheck.php b/src/applications/config/check/PhabricatorSetupCheck.php --- a/src/applications/config/check/PhabricatorSetupCheck.php +++ b/src/applications/config/check/PhabricatorSetupCheck.php @@ -122,7 +122,7 @@ $db_cache = new PhabricatorKeyValueDatabaseCache(); try { $value = $db_cache->getKey('phabricator.setup.issue-keys'); - if (!strlen($value)) { + if (!@strlen($value)) { return null; } return phutil_json_decode($value); diff --git a/src/applications/config/check/PhabricatorStorageSetupCheck.php b/src/applications/config/check/PhabricatorStorageSetupCheck.php --- a/src/applications/config/check/PhabricatorStorageSetupCheck.php +++ b/src/applications/config/check/PhabricatorStorageSetupCheck.php @@ -151,19 +151,19 @@ $how_many = 0; - if (strlen($access_key)) { + if (@strlen($access_key)) { $how_many++; } - if (strlen($secret_key)) { + if (@strlen($secret_key)) { $how_many++; } - if (strlen($region)) { + if (@strlen($region)) { $how_many++; } - if (strlen($endpoint)) { + if (@strlen($endpoint)) { $how_many++; } 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 @@ -23,7 +23,7 @@ } $base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri'); - if (!strlen($base_uri)) { + if (!@strlen($base_uri)) { // If `phabricator.base-uri` is not set then we can't really do // anything. return; @@ -89,7 +89,7 @@ try { list($body) = $ec2_future->resolvex(); $body = trim($body); - if (preg_match('/^t2/', $body)) { + if (@preg_match('/^t2/', $body)) { $message = pht( 'Phabricator appears to be installed on a very small EC2 instance '. '(of class "%s") with burstable CPU. This is strongly discouraged. '. @@ -324,7 +324,7 @@ '"Content-Encoding: gzip", but received different bytes than it '. 'sent.'); - $prefix_len = min(strlen($raw_body), strlen($uncompressed)); + $prefix_len = min(@strlen($raw_body), @strlen($uncompressed)); if ($prefix_len > 16 && !strncmp($raw_body, $uncompressed, $prefix_len)) { $message[] = pht( 'The request body that the server received had already been '. @@ -367,13 +367,13 @@ } private function snipBytes($raw) { - if (!strlen($raw)) { + if (!@strlen($raw)) { $display = pht(''); } else { - $snip = substr($raw, 0, 24); + $snip = @substr($raw, 0, 24); $display = phutil_loggable_string($snip); - if (strlen($snip) < strlen($raw)) { + if (@strlen($snip) < @strlen($raw)) { $display .= '...'; } } diff --git a/src/applications/config/controller/PhabricatorConfigConsoleController.php b/src/applications/config/controller/PhabricatorConfigConsoleController.php --- a/src/applications/config/controller/PhabricatorConfigConsoleController.php +++ b/src/applications/config/controller/PhabricatorConfigConsoleController.php @@ -85,15 +85,15 @@ $rows = array(); foreach ($versions as $name => $info) { $branchpoint = $info['branchpoint']; - if (strlen($branchpoint)) { - $branchpoint = substr($branchpoint, 0, 12); + if (@strlen($branchpoint)) { + $branchpoint = @substr($branchpoint, 0, 12); } else { $branchpoint = null; } $version = $info['hash']; - if (strlen($version)) { - $version = substr($version, 0, 12); + if (@strlen($version)) { + $version = @substr($version, 0, 12); } else { $version = pht('Unknown'); } @@ -196,7 +196,7 @@ foreach ($remotes as $remote) { $remote_pattern = '/^([^\t]+)\t([^ ]+) \(([^)]+)\)\z/'; $matches = null; - if (!preg_match($remote_pattern, $remote, $matches)) { + if (!@preg_match($remote_pattern, $remote, $matches)) { continue; } @@ -208,7 +208,7 @@ } $uri = $matches[2]; - $is_upstream = preg_match($upstream_pattern, $uri); + $is_upstream = @preg_match($upstream_pattern, $uri); if (!$is_upstream) { continue; } @@ -252,7 +252,7 @@ foreach ($log_futures as $lib => $future) { list($err, $stdout) = $future->resolve(); if (!$err) { - list($hash, $epoch) = explode(' ', $stdout); + list($hash, $epoch) = @explode(' ', $stdout); } else { $hash = null; $epoch = null; @@ -270,7 +270,7 @@ list($err, $stdout) = $upstream_future->resolve(); if (!$err) { $branchpoint = trim($stdout); - if (strlen($branchpoint)) { + if (@strlen($branchpoint)) { // We only list a branchpoint if it differs from HEAD. if ($branchpoint != $hash) { $result['upstream'] = $lib_upstreams[$lib]; diff --git a/src/applications/config/controller/module/PhabricatorConfigModuleController.php b/src/applications/config/controller/module/PhabricatorConfigModuleController.php --- a/src/applications/config/controller/module/PhabricatorConfigModuleController.php +++ b/src/applications/config/controller/module/PhabricatorConfigModuleController.php @@ -9,7 +9,7 @@ $all_modules = PhabricatorConfigModule::getAllModules(); - if (!strlen($key)) { + if (!@strlen($key)) { $key = head_key($all_modules); } diff --git a/src/applications/config/controller/services/PhabricatorConfigDatabaseStatusController.php b/src/applications/config/controller/services/PhabricatorConfigDatabaseStatusController.php --- a/src/applications/config/controller/services/PhabricatorConfigDatabaseStatusController.php +++ b/src/applications/config/controller/services/PhabricatorConfigDatabaseStatusController.php @@ -837,7 +837,7 @@ $parts = array(); foreach ($properties as $key => $property) { - if (!strlen($property)) { + if (!@strlen($property)) { continue; } diff --git a/src/applications/config/controller/settings/PhabricatorConfigSettingsListController.php b/src/applications/config/controller/settings/PhabricatorConfigSettingsListController.php --- a/src/applications/config/controller/settings/PhabricatorConfigSettingsListController.php +++ b/src/applications/config/controller/settings/PhabricatorConfigSettingsListController.php @@ -7,7 +7,7 @@ $viewer = $request->getViewer(); $filter = $request->getURIData('filter'); - if (!strlen($filter)) { + if (!@strlen($filter)) { $filter = 'settings'; } diff --git a/src/applications/config/custom/PhabricatorConfigJSONOptionType.php b/src/applications/config/custom/PhabricatorConfigJSONOptionType.php --- a/src/applications/config/custom/PhabricatorConfigJSONOptionType.php +++ b/src/applications/config/custom/PhabricatorConfigJSONOptionType.php @@ -12,7 +12,7 @@ $storage_value = $request->getStr('value'); $display_value = $request->getStr('value'); - if (strlen($display_value)) { + if (@strlen($display_value)) { try { $storage_value = phutil_json_decode($display_value); $this->validateOption($option, $storage_value); diff --git a/src/applications/config/custom/PhabricatorConfigRegexOptionType.php b/src/applications/config/custom/PhabricatorConfigRegexOptionType.php --- a/src/applications/config/custom/PhabricatorConfigRegexOptionType.php +++ b/src/applications/config/custom/PhabricatorConfigRegexOptionType.php @@ -5,7 +5,7 @@ public function validateOption(PhabricatorConfigOption $option, $value) { foreach ($value as $pattern => $spec) { - $ok = preg_match($pattern, ''); + $ok = @preg_match($pattern, ''); if ($ok === false) { throw new Exception( pht( diff --git a/src/applications/config/option/PhabricatorApplicationConfigOptions.php b/src/applications/config/option/PhabricatorApplicationConfigOptions.php --- a/src/applications/config/option/PhabricatorApplicationConfigOptions.php +++ b/src/applications/config/option/PhabricatorApplicationConfigOptions.php @@ -79,10 +79,10 @@ public function getKey() { $class = get_class($this); $matches = null; - if (preg_match('/^Phabricator(.*)ConfigOptions$/', $class, $matches)) { - return strtolower($matches[1]); + if (@preg_match('/^Phabricator(.*)ConfigOptions$/', $class, $matches)) { + return @strtolower($matches[1]); } - return strtolower(get_class($this)); + return @strtolower(get_class($this)); } final protected function newOption($key, $type, $default) { diff --git a/src/applications/config/option/PhabricatorConfigOption.php b/src/applications/config/option/PhabricatorConfigOption.php --- a/src/applications/config/option/PhabricatorConfigOption.php +++ b/src/applications/config/option/PhabricatorConfigOption.php @@ -189,7 +189,7 @@ if (!$this->isCustomType()) { throw new Exception(pht('This option does not have a custom type!')); } - $this->customObject = newv(substr($this->getType(), 7), array()); + $this->customObject = newv(@substr($this->getType(), 7), array()); } return $this->customObject; } @@ -205,7 +205,7 @@ public function newDescriptionRemarkupView(PhabricatorUser $viewer) { $description = $this->getDescription(); - if (!strlen($description)) { + if (!@strlen($description)) { return null; } diff --git a/src/applications/config/option/PhabricatorCoreConfigOptions.php b/src/applications/config/option/PhabricatorCoreConfigOptions.php --- a/src/applications/config/option/PhabricatorCoreConfigOptions.php +++ b/src/applications/config/option/PhabricatorCoreConfigOptions.php @@ -289,7 +289,7 @@ } $domain = $uri->getDomain(); - if (strpos($domain, '.') === false) { + if (@strpos($domain, '.') === false) { throw new PhabricatorConfigValidationException( pht( 'Config option "%s" is invalid. The URI must contain a dot '. diff --git a/src/applications/config/option/PhabricatorSecurityConfigOptions.php b/src/applications/config/option/PhabricatorSecurityConfigOptions.php --- a/src/applications/config/option/PhabricatorSecurityConfigOptions.php +++ b/src/applications/config/option/PhabricatorSecurityConfigOptions.php @@ -310,7 +310,7 @@ } $domain = $uri->getDomain(); - if (strpos($domain, '.') === false) { + if (@strpos($domain, '.') === false) { throw new PhabricatorConfigValidationException( pht( "Config option '%s' is invalid. The URI must contain a dot ('.'), ". diff --git a/src/applications/config/schema/PhabricatorConfigColumnSchema.php b/src/applications/config/schema/PhabricatorConfigColumnSchema.php --- a/src/applications/config/schema/PhabricatorConfigColumnSchema.php +++ b/src/applications/config/schema/PhabricatorConfigColumnSchema.php @@ -103,7 +103,7 @@ $type = $this->getColumnType(); $matches = null; - if (preg_match('/^(?:var)?char\((\d+)\)$/', $type, $matches)) { + if (@preg_match('/^(?:var)?char\((\d+)\)$/', $type, $matches)) { // For utf8mb4, each character requires 4 bytes. $size = (int)$matches[1]; if ($prefix && $prefix < $size) { @@ -113,7 +113,7 @@ } $matches = null; - if (preg_match('/^(?:var)?binary\((\d+)\)$/', $type, $matches)) { + if (@preg_match('/^(?:var)?binary\((\d+)\)$/', $type, $matches)) { // binary()/varbinary() store fixed-length binary data, so their size // is always the column size. $size = (int)$matches[1]; diff --git a/src/applications/config/schema/PhabricatorConfigKeySchema.php b/src/applications/config/schema/PhabricatorConfigKeySchema.php --- a/src/applications/config/schema/PhabricatorConfigKeySchema.php +++ b/src/applications/config/schema/PhabricatorConfigKeySchema.php @@ -62,7 +62,7 @@ public function getKeyColumnAndPrefix($column_name) { $matches = null; - if (preg_match('/^(.*)\((\d+)\)\z/', $column_name, $matches)) { + if (@preg_match('/^(.*)\((\d+)\)\z/', $column_name, $matches)) { return array($matches[1], (int)$matches[2]); } else { return array($column_name, null); diff --git a/src/applications/config/schema/PhabricatorConfigSchemaQuery.php b/src/applications/config/schema/PhabricatorConfigSchemaQuery.php --- a/src/applications/config/schema/PhabricatorConfigSchemaQuery.php +++ b/src/applications/config/schema/PhabricatorConfigSchemaQuery.php @@ -151,7 +151,7 @@ $columns = idx($database_column_info, $table_name, array()); foreach ($columns as $column) { - if (strpos($column['EXTRA'], 'auto_increment') === false) { + if (@strpos($column['EXTRA'], 'auto_increment') === false) { $auto_increment = false; } else { $auto_increment = true; diff --git a/src/applications/config/schema/PhabricatorConfigSchemaSpec.php b/src/applications/config/schema/PhabricatorConfigSchemaSpec.php --- a/src/applications/config/schema/PhabricatorConfigSchemaSpec.php +++ b/src/applications/config/schema/PhabricatorConfigSchemaSpec.php @@ -275,9 +275,9 @@ // If the type ends with "?", make the column nullable. $nullable = false; - if (preg_match('/\?$/', $data_type)) { + if (@preg_match('/\?$/', $data_type)) { $nullable = true; - $data_type = substr($data_type, 0, -1); + $data_type = @substr($data_type, 0, -1); } // NOTE: MySQL allows fragments like "VARCHAR(32) CHARACTER SET binary", @@ -287,7 +287,7 @@ $is_binary = ($this->getUTF8Charset() == 'binary'); $matches = null; $pattern = '/^(fulltext|sort|text|char)(\d+)?\z/'; - if (preg_match($pattern, $data_type, $matches)) { + if (@preg_match($pattern, $data_type, $matches)) { // Limit the permitted column lengths under the theory that it would // be nice to eventually reduce this to a small set of standard lengths. diff --git a/src/applications/config/type/PhabricatorBoolConfigType.php b/src/applications/config/type/PhabricatorBoolConfigType.php --- a/src/applications/config/type/PhabricatorBoolConfigType.php +++ b/src/applications/config/type/PhabricatorBoolConfigType.php @@ -9,7 +9,7 @@ PhabricatorConfigOption $option, $value) { - if (!preg_match('/^(true|false)\z/', $value)) { + if (!@preg_match('/^(true|false)\z/', $value)) { throw $this->newException( pht( 'Value for option "%s" of type "%s" must be either '. diff --git a/src/applications/config/type/PhabricatorIntConfigType.php b/src/applications/config/type/PhabricatorIntConfigType.php --- a/src/applications/config/type/PhabricatorIntConfigType.php +++ b/src/applications/config/type/PhabricatorIntConfigType.php @@ -9,7 +9,7 @@ PhabricatorConfigOption $option, $value) { - if (!preg_match('/^-?[0-9]+\z/', $value)) { + if (!@preg_match('/^-?[0-9]+\z/', $value)) { throw $this->newException( pht( 'Value for option "%s" must be an integer.', diff --git a/src/applications/config/type/PhabricatorRegexListConfigType.php b/src/applications/config/type/PhabricatorRegexListConfigType.php --- a/src/applications/config/type/PhabricatorRegexListConfigType.php +++ b/src/applications/config/type/PhabricatorRegexListConfigType.php @@ -9,7 +9,7 @@ PhabricatorConfigOption $option, $value) { - $ok = @preg_match($value, ''); + $ok = @@preg_match($value, ''); if ($ok === false) { throw $this->newException( pht( diff --git a/src/applications/config/type/PhabricatorSetConfigType.php b/src/applications/config/type/PhabricatorSetConfigType.php --- a/src/applications/config/type/PhabricatorSetConfigType.php +++ b/src/applications/config/type/PhabricatorSetConfigType.php @@ -16,7 +16,7 @@ $value = preg_split('/[\n,]+/', $value); foreach ($value as $k => $v) { - if (!strlen($v)) { + if (!@strlen($v)) { unset($value[$k]); } $value[$k] = trim($v); diff --git a/src/applications/config/type/PhabricatorTextConfigType.php b/src/applications/config/type/PhabricatorTextConfigType.php --- a/src/applications/config/type/PhabricatorTextConfigType.php +++ b/src/applications/config/type/PhabricatorTextConfigType.php @@ -7,7 +7,7 @@ PhabricatorConfigOption $option, AphrontRequest $request) { $value = parent::readValueFromRequest($option, $request); - return (bool)strlen($value); + return (bool)@strlen($value); } protected function newCanonicalValue( diff --git a/src/applications/config/type/PhabricatorTextListConfigType.php b/src/applications/config/type/PhabricatorTextListConfigType.php --- a/src/applications/config/type/PhabricatorTextListConfigType.php +++ b/src/applications/config/type/PhabricatorTextListConfigType.php @@ -14,7 +14,7 @@ $value = phutil_split_lines($value, $retain_endings = false); foreach ($value as $k => $v) { - if (!strlen($v)) { + if (!@strlen($v)) { unset($value[$k]); } } diff --git a/src/applications/config/view/PhabricatorSetupIssueView.php b/src/applications/config/view/PhabricatorSetupIssueView.php --- a/src/applications/config/view/PhabricatorSetupIssueView.php +++ b/src/applications/config/view/PhabricatorSetupIssueView.php @@ -362,14 +362,14 @@ $matches = null; $ini_loc = null; - if (preg_match($rex, $phpinfo, $matches)) { + if (@preg_match($rex, $phpinfo, $matches)) { $ini_loc = trim($matches[1]); } $rex = '@Additional \.ini files parsed\s*(.*?)@i'; $more_loc = array(); - if (preg_match($rex, $phpinfo, $matches)) { + if (@preg_match($rex, $phpinfo, $matches)) { $more_loc = trim($matches[1]); if ($more_loc == '(none)') { $more_loc = array(); @@ -417,7 +417,7 @@ $show_opcache = false; foreach ($configs as $key) { - if (preg_match('/^opcache\./', $key)) { + if (@preg_match('/^opcache\./', $key)) { $show_opcache = true; } else { $show_standard = true; diff --git a/src/applications/conpherence/controller/ConpherenceController.php b/src/applications/conpherence/controller/ConpherenceController.php --- a/src/applications/conpherence/controller/ConpherenceController.php +++ b/src/applications/conpherence/controller/ConpherenceController.php @@ -68,7 +68,7 @@ ->setPolicyObject($conpherence) ->setImage($data['image']); - if (strlen($data['topic'])) { + if (@strlen($data['topic'])) { $topic = id(new PHUITagView()) ->setName($data['topic']) ->setColor(PHUITagView::COLOR_VIOLET) diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php --- a/src/applications/conpherence/controller/ConpherenceUpdateController.php +++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php @@ -74,7 +74,7 @@ break; case ConpherenceUpdateActions::MESSAGE: $message = $request->getStr('text'); - if (strlen($message)) { + if (@strlen($message)) { $xactions = $editor->generateTransactionsFromText( $user, $conpherence, diff --git a/src/applications/conpherence/editor/ConpherenceEditor.php b/src/applications/conpherence/editor/ConpherenceEditor.php --- a/src/applications/conpherence/editor/ConpherenceEditor.php +++ b/src/applications/conpherence/editor/ConpherenceEditor.php @@ -46,7 +46,7 @@ ConpherenceThreadTitleTransaction::TRANSACTIONTYPE) ->setNewValue($title); } - if (strlen($topic)) { + if (@strlen($topic)) { $xactions[] = id(new ConpherenceTransaction()) ->setTransactionType( ConpherenceThreadTopicTransaction::TRANSACTIONTYPE) diff --git a/src/applications/conpherence/mail/ConpherenceThreadMailReceiver.php b/src/applications/conpherence/mail/ConpherenceThreadMailReceiver.php --- a/src/applications/conpherence/mail/ConpherenceThreadMailReceiver.php +++ b/src/applications/conpherence/mail/ConpherenceThreadMailReceiver.php @@ -13,7 +13,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 1); + $id = (int)@substr($pattern, 1); return id(new ConpherenceThreadQuery()) ->setViewer($viewer) diff --git a/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php b/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php --- a/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php +++ b/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php @@ -41,7 +41,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^Z\d*[1-9]\d*$/i', $name); + return @preg_match('/^Z\d*[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -50,7 +50,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/conpherence/query/ConpherenceFulltextQuery.php b/src/applications/conpherence/query/ConpherenceFulltextQuery.php --- a/src/applications/conpherence/query/ConpherenceFulltextQuery.php +++ b/src/applications/conpherence/query/ConpherenceFulltextQuery.php @@ -55,7 +55,7 @@ $this->previousTransactionPHIDs); } - if (strlen($this->fulltext)) { + if (@strlen($this->fulltext)) { $compiler = PhabricatorSearchDocument::newQueryCompiler(); $tokens = $compiler->newTokens($this->fulltext); $compiled_query = $compiler->compileQuery($tokens); @@ -70,7 +70,7 @@ } private function buildOrderByClause(AphrontDatabaseConnection $conn_r) { - if (strlen($this->fulltext)) { + if (@strlen($this->fulltext)) { return qsprintf( $conn_r, 'ORDER BY MATCH(i.corpus) AGAINST (%s IN BOOLEAN MODE) DESC', diff --git a/src/applications/conpherence/query/ConpherenceThreadQuery.php b/src/applications/conpherence/query/ConpherenceThreadQuery.php --- a/src/applications/conpherence/query/ConpherenceThreadQuery.php +++ b/src/applications/conpherence/query/ConpherenceThreadQuery.php @@ -135,7 +135,7 @@ } protected function buildGroupClause(AphrontDatabaseConnection $conn_r) { - if ($this->participantPHIDs !== null || strlen($this->fulltext)) { + if ($this->participantPHIDs !== null || @strlen($this->fulltext)) { return qsprintf($conn_r, 'GROUP BY thread.id'); } else { return $this->buildApplicationSearchGroupClause($conn_r); @@ -152,7 +152,7 @@ id(new ConpherenceParticipant())->getTableName()); } - if (strlen($this->fulltext)) { + if (@strlen($this->fulltext)) { $joins[] = qsprintf( $conn, 'JOIN %T idx ON idx.threadPHID = thread.phid', @@ -234,7 +234,7 @@ $this->participantPHIDs); } - if (strlen($this->fulltext)) { + if (@strlen($this->fulltext)) { $where[] = qsprintf( $conn, 'MATCH(idx.corpus) AGAINST (%s IN BOOLEAN MODE)', diff --git a/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php b/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php --- a/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php +++ b/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php @@ -106,7 +106,7 @@ $engines = array(); $fulltext = $query->getParameter('fulltext'); - if (strlen($fulltext) && $conpherences) { + if (@strlen($fulltext) && $conpherences) { $context = $this->loadContextMessages($conpherences, $fulltext); $author_phids = array(); @@ -151,7 +151,7 @@ $icon = id(new PHUIIconView()) ->setIcon($icon_name); - if (!strlen($fulltext)) { + if (!@strlen($fulltext)) { $item = id(new PHUIObjectItemView()) ->setObjectName($conpherence->getMonogram()) ->setHeader($title) diff --git a/src/applications/conpherence/storage/ConpherenceThread.php b/src/applications/conpherence/storage/ConpherenceThread.php --- a/src/applications/conpherence/storage/ConpherenceThread.php +++ b/src/applications/conpherence/storage/ConpherenceThread.php @@ -158,7 +158,7 @@ */ public function getStaticTitle() { $title = $this->getTitle(); - if (strlen($title)) { + if (@strlen($title)) { return $title; } diff --git a/src/applications/conpherence/typeahead/ConpherenceThreadDatasource.php b/src/applications/conpherence/typeahead/ConpherenceThreadDatasource.php --- a/src/applications/conpherence/typeahead/ConpherenceThreadDatasource.php +++ b/src/applications/conpherence/typeahead/ConpherenceThreadDatasource.php @@ -27,7 +27,7 @@ $results = array(); foreach ($rooms as $room) { - if (strlen($room->getTopic())) { + if (@strlen($room->getTopic())) { $topic = $room->getTopic(); } else { $topic = phutil_tag('em', array(), pht('No topic set')); diff --git a/src/applications/conpherence/xaction/ConpherenceThreadTitleTransaction.php b/src/applications/conpherence/xaction/ConpherenceThreadTitleTransaction.php --- a/src/applications/conpherence/xaction/ConpherenceThreadTitleTransaction.php +++ b/src/applications/conpherence/xaction/ConpherenceThreadTitleTransaction.php @@ -17,7 +17,7 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (strlen($old) && strlen($new)) { + if (@strlen($old) && @strlen($new)) { return pht( '%s renamed this room from %s to %s.', $this->renderAuthor(), @@ -34,7 +34,7 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (strlen($old) && strlen($new)) { + if (@strlen($old) && @strlen($new)) { return pht( '%s renamed %s from %s to %s.', $this->renderAuthor(), @@ -61,7 +61,7 @@ $max_length = $object->getColumnMaximumByteLength('title'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The title can be no longer than %s characters.', diff --git a/src/applications/conpherence/xaction/ConpherenceThreadTopicTransaction.php b/src/applications/conpherence/xaction/ConpherenceThreadTopicTransaction.php --- a/src/applications/conpherence/xaction/ConpherenceThreadTopicTransaction.php +++ b/src/applications/conpherence/xaction/ConpherenceThreadTopicTransaction.php @@ -17,7 +17,7 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (strlen($new)) { + if (@strlen($new)) { return pht( '%s set the room topic to %s.', $this->renderAuthor(), @@ -34,7 +34,7 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (strlen($new)) { + if (@strlen($new)) { return pht( '%s set the room topic to %s in %s.', $this->renderAuthor(), @@ -55,7 +55,7 @@ $max_length = $object->getColumnMaximumByteLength('topic'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The topic can be no longer than %s characters.', diff --git a/src/applications/console/controller/DarkConsoleController.php b/src/applications/console/controller/DarkConsoleController.php --- a/src/applications/console/controller/DarkConsoleController.php +++ b/src/applications/console/controller/DarkConsoleController.php @@ -26,7 +26,7 @@ } $visible = $request->getStr('visible'); - if (strlen($visible)) { + if (@strlen($visible)) { $this->writeDarkConsoleSetting( PhabricatorDarkConsoleVisibleSetting::SETTINGKEY, (int)$visible); @@ -34,7 +34,7 @@ } $tab = $request->getStr('tab'); - if (strlen($tab)) { + if (@strlen($tab)) { $this->writeDarkConsoleSetting( PhabricatorDarkConsoleTabSetting::SETTINGKEY, $tab); diff --git a/src/applications/console/controller/DarkConsoleDataController.php b/src/applications/console/controller/DarkConsoleDataController.php --- a/src/applications/console/controller/DarkConsoleDataController.php +++ b/src/applications/console/controller/DarkConsoleDataController.php @@ -57,7 +57,7 @@ // with the session cookie name anywhere in its name. $pattern = '('.preg_quote(PhabricatorCookies::COOKIE_SESSION).')'; foreach ($_COOKIE as $cookie_name => $cookie_value) { - if (preg_match($pattern, $cookie_name)) { + if (@preg_match($pattern, $cookie_name)) { $panel = PhutilSafeHTML::applyFunction( 'str_replace', $cookie_value, diff --git a/src/applications/console/core/DarkConsoleCore.php b/src/applications/console/core/DarkConsoleCore.php --- a/src/applications/console/core/DarkConsoleCore.php +++ b/src/applications/console/core/DarkConsoleCore.php @@ -126,10 +126,10 @@ } else { // Truncate huge strings. Since the data doesn't really matter much, // just truncate bytes to avoid PhutilUTF8StringTruncator overhead. - $length = strlen($data); + $length = @strlen($data); $max = 4096; if ($length > $max) { - $data = substr($data, 0, $max).'...<'.$length.' bytes>...'; + $data = @substr($data, 0, $max).'...<'.$length.' bytes>...'; } return phutil_utf8ize($data); } diff --git a/src/applications/console/plugin/DarkConsoleServicesPlugin.php b/src/applications/console/plugin/DarkConsoleServicesPlugin.php --- a/src/applications/console/plugin/DarkConsoleServicesPlugin.php +++ b/src/applications/console/plugin/DarkConsoleServicesPlugin.php @@ -68,7 +68,7 @@ // For each SELECT query, go issue an EXPLAIN on it so we can flag stuff // causing table scans, etc. - if (preg_match('/^\s*SELECT\b/i', $entry['query'])) { + if (@preg_match('/^\s*SELECT\b/i', $entry['query'])) { $conn = PhabricatorDatabaseRef::newRawConnection($entry['config']); try { $explain = queryfx_all( @@ -109,7 +109,7 @@ $cur_reason = 'Fulltext'; break; case 'ALL': - if (preg_match('/Using where/', $table['Extra'])) { + if (@preg_match('/Using where/', $table['Extra'])) { if ($table['rows'] < 256 && !empty($table['possible_keys'])) { $cur_badness = 2; $cur_reason = pht('Small Table Scan'); @@ -123,10 +123,10 @@ } break; default: - if (preg_match('/No tables used/i', $table['Extra'])) { + if (@preg_match('/No tables used/i', $table['Extra'])) { $cur_badness = 1; $cur_reason = pht('No Tables'); - } else if (preg_match('/Impossible/i', $table['Extra'])) { + } else if (@preg_match('/Impossible/i', $table['Extra'])) { $cur_badness = 1; $cur_reason = pht('Empty'); } else { diff --git a/src/applications/countdown/editor/PhabricatorCountdownEditor.php b/src/applications/countdown/editor/PhabricatorCountdownEditor.php --- a/src/applications/countdown/editor/PhabricatorCountdownEditor.php +++ b/src/applications/countdown/editor/PhabricatorCountdownEditor.php @@ -55,7 +55,7 @@ $body = parent::buildMailBody($object, $xactions); $description = $object->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $body->addRemarkupSection( pht('COUNTDOWN DESCRIPTION'), $object->getDescription()); diff --git a/src/applications/countdown/mail/PhabricatorCountdownMailReceiver.php b/src/applications/countdown/mail/PhabricatorCountdownMailReceiver.php --- a/src/applications/countdown/mail/PhabricatorCountdownMailReceiver.php +++ b/src/applications/countdown/mail/PhabricatorCountdownMailReceiver.php @@ -13,7 +13,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 1); + $id = (int)@substr($pattern, 1); return id(new PhabricatorCountdownQuery()) ->setViewer($viewer) diff --git a/src/applications/countdown/phid/PhabricatorCountdownCountdownPHIDType.php b/src/applications/countdown/phid/PhabricatorCountdownCountdownPHIDType.php --- a/src/applications/countdown/phid/PhabricatorCountdownCountdownPHIDType.php +++ b/src/applications/countdown/phid/PhabricatorCountdownCountdownPHIDType.php @@ -42,7 +42,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^C\d*[1-9]\d*$/i', $name); + return @preg_match('/^C\d*[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -51,7 +51,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/countdown/view/PhabricatorCountdownView.php b/src/applications/countdown/view/PhabricatorCountdownView.php --- a/src/applications/countdown/view/PhabricatorCountdownView.php +++ b/src/applications/countdown/view/PhabricatorCountdownView.php @@ -52,7 +52,7 @@ $launch_date); $description = $countdown->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $description = new PHUIRemarkupView($this->getUser(), $description); $description = phutil_tag( 'div', diff --git a/src/applications/countdown/xaction/PhabricatorCountdownTitleTransaction.php b/src/applications/countdown/xaction/PhabricatorCountdownTitleTransaction.php --- a/src/applications/countdown/xaction/PhabricatorCountdownTitleTransaction.php +++ b/src/applications/countdown/xaction/PhabricatorCountdownTitleTransaction.php @@ -39,7 +39,7 @@ $max_length = $object->getColumnMaximumByteLength('title'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/daemon/event/PhabricatorDaemonEventListener.php b/src/applications/daemon/event/PhabricatorDaemonEventListener.php --- a/src/applications/daemon/event/PhabricatorDaemonEventListener.php +++ b/src/applications/daemon/event/PhabricatorDaemonEventListener.php @@ -64,7 +64,7 @@ // removing Conduit. $message = $event->getValue('message'); $context = $event->getValue('context'); - if (strlen($context) && $context !== $message) { + if (@strlen($context) && $context !== $message) { $message = "({$context}) {$message}"; } diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php --- a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php @@ -42,7 +42,7 @@ $match = array(); foreach ($symbols as $symbol) { if (stripos($symbol, $substring) !== false) { - if (strtolower($symbol) == strtolower($substring)) { + if (@strtolower($symbol) == @strtolower($substring)) { $match = array($symbol); break; } else { @@ -214,7 +214,7 @@ // switch accounts without a password. This is not consistent with // sudo on Linux, and seems buggy/broken. Check for this by string // matching the output. - if (preg_match('/sudo: a password is required/', $stderr)) { + if (@preg_match('/sudo: a password is required/', $stderr)) { throw new Exception( pht( '%s exited with a zero exit code, but emitted output '. @@ -572,7 +572,7 @@ // We were given a PID or set of PIDs to kill. $select_pids = array(); foreach ($pids as $key => $pid) { - if (!preg_match('/^\d+$/', $pid)) { + if (!@preg_match('/^\d+$/', $pid)) { $console->writeErr(pht("PID '%s' is not a valid PID.", $pid)."\n"); continue; } else if (empty($running_pids[$pid])) { diff --git a/src/applications/daemon/management/PhabricatorLockLogManagementWorkflow.php b/src/applications/daemon/management/PhabricatorLockLogManagementWorkflow.php --- a/src/applications/daemon/management/PhabricatorLockLogManagementWorkflow.php +++ b/src/applications/daemon/management/PhabricatorLockLogManagementWorkflow.php @@ -38,7 +38,7 @@ $with_name = $args->getArg('name'); if ($is_enable || $is_disable) { - if (strlen($with_name)) { + if (@strlen($with_name)) { throw new PhutilArgumentUsageException( pht( 'You can not both "--enable" or "--disable" with search '. @@ -99,7 +99,7 @@ $conn = $table->establishConnection('r'); $parts = array(); - if (strlen($with_name)) { + if (@strlen($with_name)) { $parts[] = qsprintf( $conn, 'lockName = %s', diff --git a/src/applications/daemon/view/PhabricatorDaemonTasksTableView.php b/src/applications/daemon/view/PhabricatorDaemonTasksTableView.php --- a/src/applications/daemon/view/PhabricatorDaemonTasksTableView.php +++ b/src/applications/daemon/view/PhabricatorDaemonTasksTableView.php @@ -69,7 +69,7 @@ 'action', )); - if (strlen($this->getNoDataString())) { + if (@strlen($this->getNoDataString())) { $table->setNoDataString($this->getNoDataString()); } diff --git a/src/applications/dashboard/controller/PhabricatorDashboardQueryPanelInstallController.php b/src/applications/dashboard/controller/PhabricatorDashboardQueryPanelInstallController.php --- a/src/applications/dashboard/controller/PhabricatorDashboardQueryPanelInstallController.php +++ b/src/applications/dashboard/controller/PhabricatorDashboardQueryPanelInstallController.php @@ -13,12 +13,12 @@ $e_name = true; $v_engine = $request->getStr('engine'); - if (!strlen($v_engine)) { + if (!@strlen($v_engine)) { $v_engine = $request->getURIData('engineKey'); } $v_query = $request->getStr('query'); - if (!strlen($v_query)) { + if (!@strlen($v_query)) { $v_query = $request->getURIData('queryKey'); } diff --git a/src/applications/dashboard/controller/dashboard/PhabricatorDashboardAdjustController.php b/src/applications/dashboard/controller/dashboard/PhabricatorDashboardAdjustController.php --- a/src/applications/dashboard/controller/dashboard/PhabricatorDashboardAdjustController.php +++ b/src/applications/dashboard/controller/dashboard/PhabricatorDashboardAdjustController.php @@ -32,7 +32,7 @@ $panel_ref = null; $panel_key = $request->getStr('panelKey'); - if (strlen($panel_key)) { + if (@strlen($panel_key)) { $panel_ref = $ref_list->getPanelRef($panel_key); if (!$panel_ref) { return new Aphront404Response(); @@ -42,7 +42,7 @@ } $column_key = $request->getStr('columnKey'); - if (strlen($column_key)) { + if (@strlen($column_key)) { $columns = $ref_list->getColumns(); if (!isset($columns[$column_key])) { return new Aphront404Response(); @@ -52,7 +52,7 @@ $after_ref = null; $after_key = $request->getStr('afterKey'); - if (strlen($after_key)) { + if (@strlen($after_key)) { $after_ref = $ref_list->getPanelRef($after_key); if (!$after_ref) { return new Aphront404Response(); diff --git a/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php b/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php --- a/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php +++ b/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php @@ -15,7 +15,7 @@ // editing. $context_phid = $request->getStr('contextPHID'); - if (strlen($context_phid)) { + if (@strlen($context_phid)) { $context = id(new PhabricatorObjectQuery()) ->setViewer($viewer) ->withPHIDs(array($context_phid)) diff --git a/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelTabsController.php b/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelTabsController.php --- a/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelTabsController.php +++ b/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelTabsController.php @@ -41,12 +41,12 @@ $op = $request->getURIData('op'); $after = $request->getStr('after'); - if (!strlen($after)) { + if (!@strlen($after)) { $after = null; } $target = $request->getStr('target'); - if (!strlen($target)) { + if (!@strlen($target)) { $target = null; } @@ -103,7 +103,7 @@ $context_phid = $request->getStr('contextPHID'); $context = null; - if (strlen($context_phid)) { + if (@strlen($context_phid)) { $context = id(new PhabricatorObjectQuery()) ->setViewer($viewer) ->withPHIDs(array($context_phid)) diff --git a/src/applications/dashboard/editfield/PhabricatorDashboardQueryPanelApplicationEditField.php b/src/applications/dashboard/editfield/PhabricatorDashboardQueryPanelApplicationEditField.php --- a/src/applications/dashboard/editfield/PhabricatorDashboardQueryPanelApplicationEditField.php +++ b/src/applications/dashboard/editfield/PhabricatorDashboardQueryPanelApplicationEditField.php @@ -26,7 +26,7 @@ $options = array(); $value = $this->getValueForControl(); - if (strlen($value) && empty($engines[$value])) { + if (@strlen($value) && empty($engines[$value])) { $options[$value] = $value; } diff --git a/src/applications/dashboard/editfield/PhabricatorDashboardQueryPanelQueryEditField.php b/src/applications/dashboard/editfield/PhabricatorDashboardQueryPanelQueryEditField.php --- a/src/applications/dashboard/editfield/PhabricatorDashboardQueryPanelQueryEditField.php +++ b/src/applications/dashboard/editfield/PhabricatorDashboardQueryPanelQueryEditField.php @@ -38,7 +38,7 @@ } } - if (strlen($value) && !$seen) { + if (@strlen($value) && !$seen) { $name = pht('Custom Query ("%s")', $value); } else { $name = pht('(None)'); @@ -56,7 +56,7 @@ 'queryID' => $control_id, 'options' => $queries, 'value' => array( - 'key' => strlen($value) ? $value : null, + 'key' => @strlen($value) ? $value : null, 'name' => $name, ), )); diff --git a/src/applications/dashboard/install/PhabricatorDashboardObjectInstallWorkflow.php b/src/applications/dashboard/install/PhabricatorDashboardObjectInstallWorkflow.php --- a/src/applications/dashboard/install/PhabricatorDashboardObjectInstallWorkflow.php +++ b/src/applications/dashboard/install/PhabricatorDashboardObjectInstallWorkflow.php @@ -17,16 +17,16 @@ $target_identifier = head($target_tokens); } - if (!strlen($target_identifier)) { + if (!@strlen($target_identifier)) { $target_identifier = $request->getStr('target'); } - if (!strlen($target_identifier)) { + if (!@strlen($target_identifier)) { $target_identifier = $this->getMode(); } $target = null; - if (strlen($target_identifier)) { + if (@strlen($target_identifier)) { $targets = array(); if (ctype_digit($target_identifier)) { @@ -74,7 +74,7 @@ } $errors = array(); - if (strlen($target_identifier)) { + if (@strlen($target_identifier)) { if (!$target) { $errors[] = pht('Choose a valid object.'); } else if (!$can_edit) { diff --git a/src/applications/dashboard/layoutconfig/PhabricatorDashboardPanelRefList.php b/src/applications/dashboard/layoutconfig/PhabricatorDashboardPanelRefList.php --- a/src/applications/dashboard/layoutconfig/PhabricatorDashboardPanelRefList.php +++ b/src/applications/dashboard/layoutconfig/PhabricatorDashboardPanelRefList.php @@ -31,12 +31,12 @@ $refs = array(); foreach ($panels as $panel) { $panel_phid = idx($panel, 'panelPHID'); - if (!strlen($panel_phid)) { + if (!@strlen($panel_phid)) { continue; } $panel_key = idx($panel, 'panelKey'); - if (!strlen($panel_key)) { + if (!@strlen($panel_key)) { continue; } diff --git a/src/applications/dashboard/menuitem/PhabricatorDashboardPortalMenuItem.php b/src/applications/dashboard/menuitem/PhabricatorDashboardPortalMenuItem.php --- a/src/applications/dashboard/menuitem/PhabricatorDashboardPortalMenuItem.php +++ b/src/applications/dashboard/menuitem/PhabricatorDashboardPortalMenuItem.php @@ -31,7 +31,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php b/src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php --- a/src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php +++ b/src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php @@ -101,13 +101,13 @@ $subpanel = idx($panels, $panel_id); $name = idx($tab_spec, 'name'); - if (!strlen($name)) { + if (!@strlen($name)) { if ($subpanel) { $name = $subpanel->getName(); } } - if (!strlen($name)) { + if (!@strlen($name)) { $name = pht('Unnamed Tab'); } diff --git a/src/applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php b/src/applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php --- a/src/applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php +++ b/src/applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php @@ -48,7 +48,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^W\d*[1-9]\d*$/i', $name); + return @preg_match('/^W\d*[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -57,7 +57,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php b/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php --- a/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php +++ b/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php @@ -28,7 +28,7 @@ $query = new PhabricatorDashboardPanelQuery(); $raw_query = $this->getRawQuery(); - if (preg_match('/^[wW]\d+\z/', $raw_query)) { + if (@preg_match('/^[wW]\d+\z/', $raw_query)) { $id = trim($raw_query, 'wW'); $id = (int)$id; $query->withIDs(array($id)); diff --git a/src/applications/dashboard/xaction/dashboard/PhabricatorDashboardNameTransaction.php b/src/applications/dashboard/xaction/dashboard/PhabricatorDashboardNameTransaction.php --- a/src/applications/dashboard/xaction/dashboard/PhabricatorDashboardNameTransaction.php +++ b/src/applications/dashboard/xaction/dashboard/PhabricatorDashboardNameTransaction.php @@ -30,14 +30,14 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new = $xaction->getNewValue(); - if (!strlen($new)) { + if (!@strlen($new)) { $errors[] = $this->newInvalidError( pht('Dashboards must have a name.'), $xaction); continue; } - if (strlen($new) > $max_length) { + if (@strlen($new) > $max_length) { $errors[] = $this->newInvalidError( pht( 'Dashboard names must not be longer than %s characters.', diff --git a/src/applications/dashboard/xaction/dashboard/PhabricatorDashboardPanelsTransaction.php b/src/applications/dashboard/xaction/dashboard/PhabricatorDashboardPanelsTransaction.php --- a/src/applications/dashboard/xaction/dashboard/PhabricatorDashboardPanelsTransaction.php +++ b/src/applications/dashboard/xaction/dashboard/PhabricatorDashboardPanelsTransaction.php @@ -79,7 +79,7 @@ $panel_key = $spec['panelKey']; - if (!strlen($panel_key)) { + if (!@strlen($panel_key)) { $errors[] = $this->newInvalidError( pht( 'Panel specification at index "%s" has bad panel key "%s". '. diff --git a/src/applications/dashboard/xaction/panel/PhabricatorDashboardPanelNameTransaction.php b/src/applications/dashboard/xaction/panel/PhabricatorDashboardPanelNameTransaction.php --- a/src/applications/dashboard/xaction/panel/PhabricatorDashboardPanelNameTransaction.php +++ b/src/applications/dashboard/xaction/panel/PhabricatorDashboardPanelNameTransaction.php @@ -30,14 +30,14 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new = $xaction->getNewValue(); - if (!strlen($new)) { + if (!@strlen($new)) { $errors[] = $this->newInvalidError( pht('Panels must have a title.'), $xaction); continue; } - if (strlen($new) > $max_length) { + if (@strlen($new) > $max_length) { $errors[] = $this->newInvalidError( pht( 'Panel names must not be longer than %s characters.', diff --git a/src/applications/dashboard/xaction/portal/PhabricatorDashboardPortalNameTransaction.php b/src/applications/dashboard/xaction/portal/PhabricatorDashboardPortalNameTransaction.php --- a/src/applications/dashboard/xaction/portal/PhabricatorDashboardPortalNameTransaction.php +++ b/src/applications/dashboard/xaction/portal/PhabricatorDashboardPortalNameTransaction.php @@ -30,14 +30,14 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new = $xaction->getNewValue(); - if (!strlen($new)) { + if (!@strlen($new)) { $errors[] = $this->newInvalidError( pht('Portals must have a title.'), $xaction); continue; } - if (strlen($new) > $max_length) { + if (@strlen($new) > $max_length) { $errors[] = $this->newInvalidError( pht( 'Portal names must not be longer than %s characters.', diff --git a/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php b/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php --- a/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php +++ b/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php @@ -9,7 +9,7 @@ public function testParseRender() { $dir = $this->getTestDataDirectory(); foreach (Filesystem::listDirectory($dir, $show_hidden = false) as $file) { - if (!preg_match('/\.diff$/', $file)) { + if (!@preg_match('/\.diff$/', $file)) { continue; } $data = Filesystem::readFile($dir.$file); diff --git a/src/applications/differential/conduit/DifferentialConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialConduitAPIMethod.php @@ -85,7 +85,7 @@ } $message = $request->getValue('message'); - if (strlen($message)) { + if (@strlen($message)) { // This is a little awkward, and should move elsewhere or be removed. It // largely exists for legacy reasons. See some discussion in T7899. $first_line = head(phutil_split_lines($message, false)); diff --git a/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php @@ -86,7 +86,7 @@ } $content = $request->getValue('message'); - if (strlen($content)) { + if (@strlen($content)) { $xactions[] = id(new DifferentialTransaction()) ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) ->attachComment( diff --git a/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php @@ -56,7 +56,7 @@ // show "Field:" templates for some fields even if they are empty. $edit_mode = $request->getValue('edit'); - $is_any_edit = (bool)strlen($edit_mode); + $is_any_edit = (bool)@strlen($edit_mode); $is_create = ($edit_mode == 'create'); $field_list = DifferentialCommitMessageField::newEnabledFields($viewer); @@ -115,7 +115,7 @@ $is_title = ($field_key == $key_title); - if (!strlen($value)) { + if (!@strlen($value)) { if ($is_template) { $commit_message[] = $label.': '; } @@ -127,7 +127,7 @@ array("\r\n", "\r"), array("\n", "\n"), $value); - if (strpos($value, "\n") !== false || substr($value, 0, 2) === ' ') { + if (@strpos($value, "\n") !== false || @substr($value, 0, 2) === ' ') { $commit_message[] = "{$label}:\n{$value}"; } else { $commit_message[] = "{$label}: {$value}"; diff --git a/src/applications/differential/controller/DifferentialChangesetViewController.php b/src/applications/differential/controller/DifferentialChangesetViewController.php --- a/src/applications/differential/controller/DifferentialChangesetViewController.php +++ b/src/applications/differential/controller/DifferentialChangesetViewController.php @@ -10,7 +10,7 @@ $viewer = $this->getViewer(); $rendering_reference = $request->getStr('ref'); - $parts = explode('/', $rendering_reference); + $parts = @explode('/', $rendering_reference); if (count($parts) == 2) { list($id, $vs) = $parts; } else { @@ -451,7 +451,7 @@ continue; } $coverage_data = idx($test_coverage, $changeset->getFileName()); - if (!strlen($coverage_data)) { + if (!@strlen($coverage_data)) { continue; } $coverage[] = $coverage_data; diff --git a/src/applications/differential/controller/DifferentialDiffCreateController.php b/src/applications/differential/controller/DifferentialDiffCreateController.php --- a/src/applications/differential/controller/DifferentialDiffCreateController.php +++ b/src/applications/differential/controller/DifferentialDiffCreateController.php @@ -52,7 +52,7 @@ $diff = $request->getStr('diff'); } - if (!strlen($diff)) { + if (!@strlen($diff)) { $errors[] = pht( 'You can not create an empty diff. Paste a diff or upload a '. 'file containing a diff.'); diff --git a/src/applications/differential/controller/DifferentialRevisionOperationController.php b/src/applications/differential/controller/DifferentialRevisionOperationController.php --- a/src/applications/differential/controller/DifferentialRevisionOperationController.php +++ b/src/applications/differential/controller/DifferentialRevisionOperationController.php @@ -45,7 +45,7 @@ $v_ref = $request->getArr('refPHIDs'); $ref_phid = head($v_ref); - if (!strlen($ref_phid)) { + if (!@strlen($ref_phid)) { $e_ref = pht('Required'); $errors[] = pht( 'You must select a branch to land this revision onto.'); @@ -133,7 +133,7 @@ DifferentialDiff $diff) { $default_name = $this->getDefaultRefName($repository, $diff); - if (!strlen($default_name)) { + if (!@strlen($default_name)) { return null; } diff --git a/src/applications/differential/customfield/DifferentialBlameRevisionField.php b/src/applications/differential/customfield/DifferentialBlameRevisionField.php --- a/src/applications/differential/customfield/DifferentialBlameRevisionField.php +++ b/src/applications/differential/customfield/DifferentialBlameRevisionField.php @@ -32,7 +32,7 @@ } public function renderPropertyViewValue(array $handles) { - if (!strlen($this->getValue())) { + if (!@strlen($this->getValue())) { return null; } diff --git a/src/applications/differential/customfield/DifferentialBranchField.php b/src/applications/differential/customfield/DifferentialBranchField.php --- a/src/applications/differential/customfield/DifferentialBranchField.php +++ b/src/applications/differential/customfield/DifferentialBranchField.php @@ -39,13 +39,13 @@ $branch = $diff->getBranch(); $bookmark = $diff->getBookmark(); - if (strlen($branch) && strlen($bookmark)) { + if (@strlen($branch) && @strlen($bookmark)) { return pht('%s (bookmark) on %s (branch)', $bookmark, $branch); - } else if (strlen($bookmark)) { + } else if (@strlen($bookmark)) { return pht('%s (bookmark)', $bookmark); - } else if (strlen($branch)) { + } else if (@strlen($branch)) { $onto = $diff->loadTargetBranch(); - if (strlen($onto) && ($onto !== $branch)) { + if (@strlen($onto) && ($onto !== $branch)) { return pht( '%s (branched from %s)', $branch, diff --git a/src/applications/differential/customfield/DifferentialCoreCustomField.php b/src/applications/differential/customfield/DifferentialCoreCustomField.php --- a/src/applications/differential/customfield/DifferentialCoreCustomField.php +++ b/src/applications/differential/customfield/DifferentialCoreCustomField.php @@ -29,7 +29,7 @@ if (is_array($value)) { return !$value; } - return !strlen(trim($value)); + return !@strlen(trim($value)); } protected function getCoreFieldRequiredErrorString() { diff --git a/src/applications/differential/customfield/DifferentialRevertPlanField.php b/src/applications/differential/customfield/DifferentialRevertPlanField.php --- a/src/applications/differential/customfield/DifferentialRevertPlanField.php +++ b/src/applications/differential/customfield/DifferentialRevertPlanField.php @@ -40,7 +40,7 @@ } public function renderPropertyViewValue(array $handles) { - if (!strlen($this->getValue())) { + if (!@strlen($this->getValue())) { return null; } @@ -53,7 +53,7 @@ public function updateAbstractDocument( PhabricatorSearchAbstractDocument $document) { - if (strlen($this->getValue())) { + if (@strlen($this->getValue())) { $document->addField('rvrt', $this->getValue()); } } diff --git a/src/applications/differential/customfield/DifferentialSummaryField.php b/src/applications/differential/customfield/DifferentialSummaryField.php --- a/src/applications/differential/customfield/DifferentialSummaryField.php +++ b/src/applications/differential/customfield/DifferentialSummaryField.php @@ -29,7 +29,7 @@ public function updateAbstractDocument( PhabricatorSearchAbstractDocument $document) { - if (strlen($this->getValue())) { + if (@strlen($this->getValue())) { $document->addField('body', $this->getValue()); } } @@ -51,7 +51,7 @@ } public function renderPropertyViewValue(array $handles) { - if (!strlen($this->getValue())) { + if (!@strlen($this->getValue())) { return null; } @@ -72,7 +72,7 @@ } $summary = $this->getValue(); - if (!strlen(trim($summary))) { + if (!@strlen(trim($summary))) { return; } diff --git a/src/applications/differential/customfield/DifferentialTestPlanField.php b/src/applications/differential/customfield/DifferentialTestPlanField.php --- a/src/applications/differential/customfield/DifferentialTestPlanField.php +++ b/src/applications/differential/customfield/DifferentialTestPlanField.php @@ -33,7 +33,7 @@ public function updateAbstractDocument( PhabricatorSearchAbstractDocument $document) { - if (strlen($this->getValue())) { + if (@strlen($this->getValue())) { $document->addField('plan', $this->getValue()); } } @@ -55,7 +55,7 @@ } public function renderPropertyViewValue(array $handles) { - if (!strlen($this->getValue())) { + if (!@strlen($this->getValue())) { return null; } @@ -76,7 +76,7 @@ } $test_plan = $this->getValue(); - if (!strlen(trim($test_plan))) { + if (!@strlen(trim($test_plan))) { return; } diff --git a/src/applications/differential/editor/DifferentialDiffEditor.php b/src/applications/differential/editor/DifferentialDiffEditor.php --- a/src/applications/differential/editor/DifferentialDiffEditor.php +++ b/src/applications/differential/editor/DifferentialDiffEditor.php @@ -145,7 +145,7 @@ $rule = $blocking_effect->getRule(); $message = $effect->getTarget(); - if (!strlen($message)) { + if (!@strlen($message)) { $message = pht('(None.)'); } diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -218,7 +218,7 @@ // No "$", to allow for branches like T123_demo. $match = null; - if (preg_match('/^T(\d+)/i', $branch, $match)) { + if (@preg_match('/^T(\d+)/i', $branch, $match)) { $task_id = $match[1]; $tasks = id(new ManiphestTaskQuery()) ->setViewer($this->getActor()) @@ -744,7 +744,7 @@ if (($patch !== null) && $config_inline) { $lines = substr_count($patch, "\n"); - $bytes = strlen($patch); + $bytes = @strlen($patch); // Limit the patch size to the smaller of 256 bytes per line or // the mail body limit. This prevents degenerate behavior for patches @@ -768,7 +768,7 @@ if (($patch !== null) && $config_attach) { // See T12033, T11767, and PHI55. This is a crude fix to stop the // major concrete problems that lackluster email size limits cause. - if (strlen($patch) < $body_limit) { + if (@strlen($patch) < $body_limit) { $name = pht('D%s.%s.patch', $object->getID(), $diff->getID()); $mime_type = 'text/x-patch; charset=utf-8'; $body->addAttachment( diff --git a/src/applications/differential/engine/DifferentialAffectedPathEngine.php b/src/applications/differential/engine/DifferentialAffectedPathEngine.php --- a/src/applications/differential/engine/DifferentialAffectedPathEngine.php +++ b/src/applications/differential/engine/DifferentialAffectedPathEngine.php @@ -107,8 +107,8 @@ $repo_root = id(new PhutilURI($repository->getRemoteURI()))->getPath(); $repo_root = rtrim($repo_root, '/'); - if (!strncmp($repo_root, $local_root, strlen($repo_root))) { - $path_prefix = substr($local_root, strlen($repo_root)); + if (!strncmp($repo_root, $local_root, @strlen($repo_root))) { + $path_prefix = @substr($local_root, @strlen($repo_root)); } } } diff --git a/src/applications/differential/engine/DifferentialChangesetEngine.php b/src/applications/differential/engine/DifferentialChangesetEngine.php --- a/src/applications/differential/engine/DifferentialChangesetEngine.php +++ b/src/applications/differential/engine/DifferentialChangesetEngine.php @@ -91,7 +91,7 @@ $paths = PhabricatorEnv::getEnvConfig('differential.generated-paths'); foreach ($paths as $regexp) { - if (preg_match($regexp, $filename)) { + if (@preg_match($regexp, $filename)) { return true; } } @@ -103,13 +103,13 @@ if ($changeset->getHunks()) { $new_data = $changeset->makeNewFile(); - if (strpos($new_data, '@'.'generated') !== false) { + if (@strpos($new_data, '@'.'generated') !== false) { return true; } // See PHI1112. This is the official pattern for marking Go code as // generated. - if (preg_match('(^// Code generated .* DO NOT EDIT\.$)m', $new_data)) { + if (@preg_match('(^// Code generated .* DO NOT EDIT\.$)m', $new_data)) { return true; } } @@ -195,7 +195,7 @@ $text = trim($text); $files[$file][$line] = $text; - if (strlen($text) >= $min_width) { + if (@strlen($text) >= $min_width) { $map[$text][] = array($file, $line); } } diff --git a/src/applications/differential/engine/DifferentialDiffExtractionEngine.php b/src/applications/differential/engine/DifferentialDiffExtractionEngine.php --- a/src/applications/differential/engine/DifferentialDiffExtractionEngine.php +++ b/src/applications/differential/engine/DifferentialDiffExtractionEngine.php @@ -73,7 +73,7 @@ $raw_diff = $diff_file->loadFileData(); // TODO: Support adds, deletes and moves under SVN. - if (strlen($raw_diff)) { + if (@strlen($raw_diff)) { $changes = id(new ArcanistDiffParser())->parseDiff($raw_diff); } else { // This is an empty diff, maybe made with `git commit --allow-empty`. diff --git a/src/applications/differential/engine/DifferentialRevisionTimelineEngine.php b/src/applications/differential/engine/DifferentialRevisionTimelineEngine.php --- a/src/applications/differential/engine/DifferentialRevisionTimelineEngine.php +++ b/src/applications/differential/engine/DifferentialRevisionTimelineEngine.php @@ -26,8 +26,8 @@ $old_ids = idx($view_data, 'old'); $new_ids = idx($view_data, 'new'); - $old_ids = array_filter(explode(',', $old_ids)); - $new_ids = array_filter(explode(',', $new_ids)); + $old_ids = array_filter(@explode(',', $old_ids)); + $new_ids = array_filter(@explode(',', $new_ids)); $type_inline = DifferentialTransaction::TYPE_INLINE; $changeset_ids = array_merge($old_ids, $new_ids); diff --git a/src/applications/differential/engineextension/DifferentialCommitsSearchEngineAttachment.php b/src/applications/differential/engineextension/DifferentialCommitsSearchEngineAttachment.php --- a/src/applications/differential/engineextension/DifferentialCommitsSearchEngineAttachment.php +++ b/src/applications/differential/engineextension/DifferentialCommitsSearchEngineAttachment.php @@ -45,11 +45,11 @@ $author_name = idx($commit, 'author'); $author_email = idx($commit, 'authorEmail'); - if (strlen($author_name) && strlen($author_email)) { + if (@strlen($author_name) && @strlen($author_email)) { $author_raw = (string)id(new PhutilEmailAddress()) ->setDisplayName($author_name) ->setAddress($author_email); - } else if (strlen($author_email)) { + } else if (@strlen($author_email)) { $author_raw = $author_email; } else { $author_raw = $author_name; diff --git a/src/applications/differential/engineextension/DifferentialHovercardEngineExtension.php b/src/applications/differential/engineextension/DifferentialHovercardEngineExtension.php --- a/src/applications/differential/engineextension/DifferentialHovercardEngineExtension.php +++ b/src/applications/differential/engineextension/DifferentialHovercardEngineExtension.php @@ -61,7 +61,7 @@ $viewer->renderHandleList($reviewer_phids)->setAsInline(true)); $summary = $revision->getSummary(); - if (strlen($summary)) { + if (@strlen($summary)) { $summary = id(new PhutilUTF8StringTruncator()) ->setMaximumGlyphs(120) ->truncateString($summary); diff --git a/src/applications/differential/field/DifferentialCommitMessageField.php b/src/applications/differential/field/DifferentialCommitMessageField.php --- a/src/applications/differential/field/DifferentialCommitMessageField.php +++ b/src/applications/differential/field/DifferentialCommitMessageField.php @@ -60,7 +60,7 @@ } public function renderFieldValue($value) { - if (!strlen($value)) { + if (!@strlen($value)) { return null; } diff --git a/src/applications/differential/field/DifferentialReviewersCommitMessageField.php b/src/applications/differential/field/DifferentialReviewersCommitMessageField.php --- a/src/applications/differential/field/DifferentialReviewersCommitMessageField.php +++ b/src/applications/differential/field/DifferentialReviewersCommitMessageField.php @@ -117,8 +117,8 @@ $result = array(); foreach ($values as $value) { - if (substr($value, -1) == '!') { - $value = substr($value, 0, -1); + if (@substr($value, -1) == '!') { + $value = @substr($value, 0, -1); $suffixes = array('!' => '!'); } else { $suffixes = array(); diff --git a/src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php b/src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php --- a/src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php +++ b/src/applications/differential/field/DifferentialRevisionIDCommitMessageField.php @@ -38,7 +38,7 @@ // If the value is just "D123" or similar, parse the ID from it directly. $matches = null; - if (preg_match('/^[dD]([1-9]\d*)\z/', $value, $matches)) { + if (@preg_match('/^[dD]([1-9]\d*)\z/', $value, $matches)) { return (int)$matches[1]; } @@ -52,7 +52,7 @@ if (PhabricatorEnv::isSelfURI($uri_string)) { $matches = null; - if (preg_match('#^/D(\d+)$#', $path, $matches)) { + if (@preg_match('#^/D(\d+)$#', $path, $matches)) { return (int)$matches[1]; } } @@ -72,7 +72,7 @@ } public function renderFieldValue($value) { - if (!strlen($value)) { + if (!@strlen($value)) { return null; } diff --git a/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php b/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php --- a/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php +++ b/src/applications/differential/field/DifferentialTestPlanCommitMessageField.php @@ -29,7 +29,7 @@ $is_required = PhabricatorEnv::getEnvConfig( 'differential.require-test-plan-field'); - if ($is_required && !strlen($value)) { + if ($is_required && !@strlen($value)) { $this->raiseValidationException( pht( 'You must provide a test plan. Describe the actions you performed '. diff --git a/src/applications/differential/field/DifferentialTitleCommitMessageField.php b/src/applications/differential/field/DifferentialTitleCommitMessageField.php --- a/src/applications/differential/field/DifferentialTitleCommitMessageField.php +++ b/src/applications/differential/field/DifferentialTitleCommitMessageField.php @@ -29,7 +29,7 @@ } public function validateFieldValue($value) { - if (!strlen($value)) { + if (!@strlen($value)) { $this->raiseValidationException( pht( 'You must provide a revision title in the first line '. @@ -40,7 +40,7 @@ public function readFieldValueFromObject(DifferentialRevision $revision) { $value = $revision->getTitle(); - if (!strlen($value)) { + if (!@strlen($value)) { return self::getDefaultTitle(); } diff --git a/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php b/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php --- a/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php +++ b/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php @@ -81,8 +81,8 @@ } public function randomlyModify($code, $altcode) { - $codearr = explode("\n", $code); - $altcodearr = explode("\n", $altcode); + $codearr = @explode("\n", $code); + $altcodearr = @explode("\n", $altcode); $no_lines_to_delete = rand(1, min(count($codearr) - 2, 5)); $randomlines = array_rand($codearr, diff --git a/src/applications/differential/mail/DifferentialRevisionMailReceiver.php b/src/applications/differential/mail/DifferentialRevisionMailReceiver.php --- a/src/applications/differential/mail/DifferentialRevisionMailReceiver.php +++ b/src/applications/differential/mail/DifferentialRevisionMailReceiver.php @@ -13,7 +13,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 1); + $id = (int)@substr($pattern, 1); return id(new DifferentialRevisionQuery()) ->setViewer($viewer) diff --git a/src/applications/differential/management/PhabricatorDifferentialMigrateHunkWorkflow.php b/src/applications/differential/management/PhabricatorDifferentialMigrateHunkWorkflow.php --- a/src/applications/differential/management/PhabricatorDifferentialMigrateHunkWorkflow.php +++ b/src/applications/differential/management/PhabricatorDifferentialMigrateHunkWorkflow.php @@ -75,7 +75,7 @@ DifferentialHunk::DATATYPE_FILE, ); $types = array_fuse($types); - if (strlen($storage)) { + if (@strlen($storage)) { if (!isset($types[$storage])) { throw new PhutilArgumentUsageException( pht( diff --git a/src/applications/differential/parser/DifferentialChangesetParser.php b/src/applications/differential/parser/DifferentialChangesetParser.php --- a/src/applications/differential/parser/DifferentialChangesetParser.php +++ b/src/applications/differential/parser/DifferentialChangesetParser.php @@ -467,7 +467,7 @@ $cache = serialize($cache); // We don't want to waste too much space by a single changeset. - if (strlen($cache) > self::CACHE_MAX_SIZE) { + if (@strlen($cache) > self::CACHE_MAX_SIZE) { return; } @@ -495,13 +495,13 @@ } private function markGenerated($new_corpus_block = '') { - $generated_guess = (strpos($new_corpus_block, '@'.'generated') !== false); + $generated_guess = (@strpos($new_corpus_block, '@'.'generated') !== false); if (!$generated_guess) { $generated_path_regexps = PhabricatorEnv::getEnvConfig( 'differential.generated-paths'); foreach ($generated_path_regexps as $regexp) { - if (preg_match($regexp, $this->changeset->getFilename())) { + if (@preg_match($regexp, $this->changeset->getFilename())) { $generated_guess = true; break; } @@ -568,7 +568,7 @@ $this->filename); if (($language != 'txt') && - (strlen($corpus) > self::HIGHLIGHT_BYTE_LIMIT)) { + (@strlen($corpus) > self::HIGHLIGHT_BYTE_LIMIT)) { $this->highlightingDisabled = true; $language = 'txt'; } @@ -1087,7 +1087,7 @@ if ($engine_blocks !== null) { $reference = $this->getRenderingReference(); - $parts = explode('/', $reference); + $parts = @explode('/', $reference); if (count($parts) == 2) { list($id, $vs) = $parts; } else { @@ -1310,7 +1310,7 @@ if ($spec) { $match = null; - if (preg_match('@^(\d+)-(\d+)(?:/(\d+)-(\d+))?$@', $spec, $match)) { + if (@preg_match('@^(\d+)-(\d+)(?:/(\d+)-(\d+))?$@', $spec, $match)) { $range_s = (int)$match[1]; $range_e = (int)$match[2]; if (count($match) > 3) { @@ -1631,7 +1631,7 @@ // is cheap and often immediately produces the correct result with no // further work (and, particularly, no need to handle any unicode cases). - $len = strlen($line); + $len = @strlen($line); $head = 0; for ($head = 0; $head < $len; $head++) { @@ -1646,18 +1646,18 @@ $tags[$tab_width * $head] = str_repeat($tags[$tab_width], $head); } $prefix = $tags[$tab_width * $head]; - $line = substr($line, $head); + $line = @substr($line, $head); } else { $prefix = ''; } // If we have no remaining tabs elsewhere in the string after taking care // of all the prefix tabs, we're done. - if (strpos($line, "\t") === false) { + if (@strpos($line, "\t") === false) { return $prefix.$line; } - $len = strlen($line); + $len = @strlen($line); // If the line is particularly long, don't try to do anything special with // it. Use a faster approximation of the correct tabstop expansion instead. @@ -1672,7 +1672,7 @@ // See PHI1210. If the line only has single-byte characters, we don't need // to vectorize it and can avoid an expensive UTF8 call. - $fast_path = preg_match('/^[\x01-\x7F]*\z/', $line); + $fast_path = @preg_match('/^[\x01-\x7F]*\z/', $line); if ($fast_path) { $replace = array(); for ($ii = 0; $ii < $len; $ii++) { @@ -1816,7 +1816,7 @@ $viewstate = $this->getViewState(); $engine_key = $viewstate->getDocumentEngineKey(); - if (strlen($engine_key)) { + if (@strlen($engine_key)) { if (isset($shared_engines[$engine_key])) { $document_engine = $shared_engines[$engine_key]; } else { diff --git a/src/applications/differential/parser/DifferentialCommitMessageParser.php b/src/applications/differential/parser/DifferentialCommitMessageParser.php --- a/src/applications/differential/parser/DifferentialCommitMessageParser.php +++ b/src/applications/differential/parser/DifferentialCommitMessageParser.php @@ -172,7 +172,7 @@ $seen[$field] = true; } else { $match = null; - if (preg_match($label_regexp, $line, $match)) { + if (@preg_match($label_regexp, $line, $match)) { $lines[$key] = trim($match['text']); $field = $label_map[self::normalizeFieldLabel($match['field'])]; if (!empty($seen[$field])) { @@ -200,14 +200,14 @@ if (isset($fields[$key_title]) && empty($fields[$key_summary])) { $lines = $fields[$key_title]; for ($ii = 0; $ii < count($lines); $ii++) { - if (strlen(trim($lines[$ii])) == 0) { + if (@strlen(trim($lines[$ii])) == 0) { break; } } if ($ii != count($lines)) { $fields[$key_title] = array_slice($lines, 0, $ii); $summary = array_slice($lines, $ii); - if (strlen(trim(implode("\n", $summary)))) { + if (@strlen(trim(implode("\n", $summary)))) { $fields[$key_summary] = $summary; } } @@ -246,8 +246,8 @@ // Summary summary summary summary. $summary = idx($fields, $key_summary, ''); - $offset = strlen($short) - strlen($terminal); - $remainder = ltrim(substr($fields[$key_title], $offset)); + $offset = @strlen($short) - @strlen($terminal); + $remainder = ltrim(@substr($fields[$key_title], $offset)); $summary = '...'.$remainder."\n\n".$summary; $summary = rtrim($summary, "\n"); diff --git a/src/applications/differential/parser/DifferentialHunkParser.php b/src/applications/differential/parser/DifferentialHunkParser.php --- a/src/applications/differential/parser/DifferentialHunkParser.php +++ b/src/applications/differential/parser/DifferentialHunkParser.php @@ -299,7 +299,7 @@ ($n_depth - $o_depth), $tab_width); if ($segment_width) { - $n_text = substr($n_text, $segment_width); + $n_text = @substr($n_text, $segment_width); $n_segments[] = array( $segment_type, $segment_width, @@ -312,7 +312,7 @@ ($o_depth - $n_depth), $tab_width); if ($segment_width) { - $o_text = substr($o_text, $segment_width); + $o_text = @substr($o_text, $segment_width); $o_segments[] = array( $segment_type, $segment_width, @@ -490,7 +490,7 @@ switch ($char) { case ' ': $line_type_map[$line_index] = null; - $line_text[$line_index] = substr($line, 1); + $line_text[$line_index] = @substr($line, 1); break; case "\r": case "\n": @@ -506,7 +506,7 @@ case '-': case '\\': $line_type_map[$line_index] = $char; - $line_text[$line_index] = substr($line, 1); + $line_text[$line_index] = @substr($line, 1); break; default: throw new Exception( @@ -699,7 +699,7 @@ $hunk_pos = array('-' => 0, '+' => 0); $hunk_offset = array('-' => null, '+' => null); $hunk_last = array('-' => null, '+' => null); - foreach (explode("\n", $hunk->getChanges()) as $line) { + foreach (@explode("\n", $hunk->getChanges()) as $line) { $in_common = strncmp($line, ' ', 1) === 0; $in_old = strncmp($line, '-', 1) === 0 || $in_common; $in_new = strncmp($line, '+', 1) === 0 || $in_common; @@ -767,7 +767,7 @@ } private function getIndentDepth($text, $tab_width) { - $len = strlen($text); + $len = @strlen($text); $depth = 0; for ($ii = 0; $ii < $len; $ii++) { @@ -821,7 +821,7 @@ $character_depth = 0; $visual_depth = 0; - $len = strlen($text); + $len = @strlen($text); for ($ii = 0; $ii < $len; $ii++) { if ($visual_depth >= $depth) { break; diff --git a/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php b/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php --- a/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php +++ b/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php @@ -7,13 +7,13 @@ $dir = dirname(__FILE__).'/messages/'; $list = Filesystem::listDirectory($dir, $include_hidden = false); foreach ($list as $file) { - if (!preg_match('/.txt$/', $file)) { + if (!@preg_match('/.txt$/', $file)) { continue; } $data = Filesystem::readFile($dir.$file); $divider = "~~~~~~~~~~\n"; - $parts = explode($divider, $data); + $parts = @explode($divider, $data); if (count($parts) !== 4) { throw new Exception( pht( diff --git a/src/applications/differential/phid/DifferentialRevisionPHIDType.php b/src/applications/differential/phid/DifferentialRevisionPHIDType.php --- a/src/applications/differential/phid/DifferentialRevisionPHIDType.php +++ b/src/applications/differential/phid/DifferentialRevisionPHIDType.php @@ -48,7 +48,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^D[1-9]\d*$/i', $name); + return @preg_match('/^D[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -57,7 +57,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/differential/render/DifferentialChangesetOneUpMailRenderer.php b/src/applications/differential/render/DifferentialChangesetOneUpMailRenderer.php --- a/src/applications/differential/render/DifferentialChangesetOneUpMailRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetOneUpMailRenderer.php @@ -103,7 +103,7 @@ // Remove all leading and trailing empty lines, since these just look kind // of weird in mail. foreach ($out as $key => $line) { - if (!strlen(trim($line['text']))) { + if (!@strlen(trim($line['text']))) { unset($out[$key]); } else { break; @@ -113,7 +113,7 @@ $keys = array_reverse(array_keys($out)); foreach ($keys as $key) { $line = $out[$key]; - if (!strlen(trim($line['text']))) { + if (!@strlen(trim($line['text']))) { unset($out[$key]); } else { break; diff --git a/src/applications/differential/storage/DifferentialChangeset.php b/src/applications/differential/storage/DifferentialChangeset.php --- a/src/applications/differential/storage/DifferentialChangeset.php +++ b/src/applications/differential/storage/DifferentialChangeset.php @@ -273,9 +273,9 @@ $with_context = array(); foreach ($this->getHunks() as $hunk) { $context = array(); - $changes = explode("\n", $hunk->getChanges()); + $changes = @explode("\n", $hunk->getChanges()); foreach ($changes as $l => $line) { - $type = substr($line, 0, 1); + $type = @substr($line, 0, 1); if ($type == '+' || $type == '-') { $context += array_fill($l - $num_lines, 2 * $num_lines + 1, true); } @@ -305,8 +305,8 @@ if ($repository && $repository->getVersionControlSystem() == $svn) { $prefix = $repository->getDetail('remote-uri'); $prefix = id(new PhutilURI($prefix))->getPath(); - if (!strncmp($path, $prefix, strlen($prefix))) { - $path = substr($path, strlen($prefix)); + if (!strncmp($path, $prefix, @strlen($prefix))) { + $path = @substr($path, @strlen($prefix)); } $path = '/'.ltrim($path, '/'); } @@ -325,12 +325,12 @@ public function getOldStatePathVector() { $path = $this->getOldFile(); - if (!strlen($path)) { + if (!@strlen($path)) { $path = $this->getFilename(); } $path = trim($path, '/'); - $path = explode('/', $path); + $path = @explode('/', $path); return $path; } @@ -342,7 +342,7 @@ $path = $this->getFilename(); $path = trim($path, '/'); - $path = explode('/', $path); + $path = @explode('/', $path); return $path; } @@ -674,7 +674,7 @@ } private function getMetadataWithPrefix($prefix) { - $length = strlen($prefix); + $length = @strlen($prefix); $result = array(); foreach ($this->getMetadata() as $key => $value) { @@ -682,7 +682,7 @@ continue; } - $key = substr($key, $length); + $key = @substr($key, $length); $result[$key] = $value; } @@ -759,7 +759,7 @@ } $absolute_path = $this->getAbsoluteRepositoryPath($repository, $diff); - if (strlen($absolute_path)) { + if (@strlen($absolute_path)) { $absolute_path = base64_encode($absolute_path); } else { $absolute_path = null; diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php --- a/src/applications/differential/storage/DifferentialDiff.php +++ b/src/applications/differential/storage/DifferentialDiff.php @@ -777,7 +777,7 @@ $refs = array(); $branch = $this->getBranch(); - if (strlen($branch)) { + if (@strlen($branch)) { $refs[] = array( 'type' => 'branch', 'name' => $branch, @@ -785,7 +785,7 @@ } $onto = $this->loadTargetBranch(); - if (strlen($onto)) { + if (@strlen($onto)) { $refs[] = array( 'type' => 'onto', 'name' => $onto, @@ -793,7 +793,7 @@ } $base = $this->getSourceControlBaseRevision(); - if (strlen($base)) { + if (@strlen($base)) { $refs[] = array( 'type' => 'base', 'identifier' => $base, @@ -801,7 +801,7 @@ } $bookmark = $this->getBookmark(); - if (strlen($bookmark)) { + if (@strlen($bookmark)) { $refs[] = array( 'type' => 'bookmark', 'name' => $bookmark, diff --git a/src/applications/differential/storage/DifferentialHunk.php b/src/applications/differential/storage/DifferentialHunk.php --- a/src/applications/differential/storage/DifferentialHunk.php +++ b/src/applications/differential/storage/DifferentialHunk.php @@ -172,7 +172,7 @@ $structured[] = array( 'type' => $line[0], - 'text' => substr($line, 1), + 'text' => @substr($line, 1), ); } @@ -208,7 +208,7 @@ $results = array(); $include_map = array(); - for ($ii = 0; $ii < strlen($include); $ii++) { + for ($ii = 0; $ii < @strlen($include); $ii++) { $include_map[$include[$ii]] = true; } @@ -232,7 +232,7 @@ $use_next_newline = false; } else { $use_next_newline = true; - $results[$n] = substr($line, 1); + $results[$n] = @substr($line, 1); } if ($line[0] == ' ' || isset($include_map[$line[0]])) { diff --git a/src/applications/differential/view/DifferentialChangesetDetailView.php b/src/applications/differential/view/DifferentialChangesetDetailView.php --- a/src/applications/differential/view/DifferentialChangesetDetailView.php +++ b/src/applications/differential/view/DifferentialChangesetDetailView.php @@ -163,7 +163,7 @@ $path_part = dirname($display_filename); $file_part = basename($display_filename); $display_parts = array(); - if (strlen($path_part)) { + if (@strlen($path_part)) { $path_part = $path_part.'/'; $display_parts[] = phutil_tag( 'span', @@ -191,7 +191,7 @@ } $path_parts = trim($display_filename, '/'); - $path_parts = explode('/', $path_parts); + $path_parts = @explode('/', $path_parts); $show_path_uri = null; $show_directory_uri = null; diff --git a/src/applications/differential/view/DifferentialLocalCommitsView.php b/src/applications/differential/view/DifferentialLocalCommitsView.php --- a/src/applications/differential/view/DifferentialLocalCommitsView.php +++ b/src/applications/differential/view/DifferentialLocalCommitsView.php @@ -129,7 +129,7 @@ } private static function formatCommit($commit) { - return substr($commit, 0, 12); + return @substr($commit, 0, 12); } private function buildCommitLink($hash) { diff --git a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php --- a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php +++ b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php @@ -265,18 +265,18 @@ switch ($diff->getSourceControlSystem()) { case 'git': $base = $diff->getSourceControlBaseRevision(); - if (strpos($base, '@') === false) { - $label = substr($base, 0, 7); + if (@strpos($base, '@') === false) { + $label = @substr($base, 0, 7); } else { // The diff is from git-svn - $base = explode('@', $base); + $base = @explode('@', $base); $base = last($base); $label = $base; } break; case 'svn': $base = $diff->getSourceControlBaseRevision(); - $base = explode('@', $base); + $base = @explode('@', $base); $base = last($base); $label = $base; break; diff --git a/src/applications/differential/xaction/DifferentialRevisionTitleTransaction.php b/src/applications/differential/xaction/DifferentialRevisionTitleTransaction.php --- a/src/applications/differential/xaction/DifferentialRevisionTitleTransaction.php +++ b/src/applications/differential/xaction/DifferentialRevisionTitleTransaction.php @@ -42,7 +42,7 @@ $max_length = $object->getColumnMaximumByteLength('title'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/differential/xaction/DifferentialRevisionTransactionType.php b/src/applications/differential/xaction/DifferentialRevisionTransactionType.php --- a/src/applications/differential/xaction/DifferentialRevisionTransactionType.php +++ b/src/applications/differential/xaction/DifferentialRevisionTransactionType.php @@ -21,7 +21,7 @@ private function validateMessageCorpus($xaction, $field_name) { $value = $xaction->getNewValue(); - if (!strlen($value)) { + if (!@strlen($value)) { return null; } diff --git a/src/applications/diffusion/DiffusionLintSaveRunner.php b/src/applications/diffusion/DiffusionLintSaveRunner.php --- a/src/applications/diffusion/DiffusionLintSaveRunner.php +++ b/src/applications/diffusion/DiffusionLintSaveRunner.php @@ -52,7 +52,7 @@ $this->svnRoot = id(new PhutilURI($api->getSourceControlPath()))->getPath(); if ($api instanceof ArcanistGitAPI) { $svn_fetch = $api->getGitConfig('svn-remote.svn.fetch'); - list($this->svnRoot) = explode(':', $svn_fetch); + list($this->svnRoot) = @explode(':', $svn_fetch); if ($this->svnRoot != '') { $this->svnRoot = '/'.$this->svnRoot; } diff --git a/src/applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php @@ -30,7 +30,7 @@ $repository = $drequest->getRepository(); $contains = $request->getValue('contains'); - if (strlen($contains)) { + if (@strlen($contains)) { // See PHI958 (and, earlier, PHI720). If "patterns" are provided, pass // them to "git branch ..." to let callers test for reachability from @@ -80,7 +80,7 @@ ->setRepository($repository); $contains = $request->getValue('contains'); - if (strlen($contains)) { + if (@strlen($contains)) { $query->withContainsCommit($contains); } diff --git a/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php @@ -37,7 +37,7 @@ $repository = $drequest->getRepository(); $path = $request->getValue('path'); - if (!strlen($path) || $path === '/') { + if (!@strlen($path) || $path === '/') { $path = null; } @@ -88,7 +88,7 @@ } $stderr = $e->getStderr(); - if (preg_match('/^fatal: Not a valid object name/', $stderr)) { + if (@preg_match('/^fatal: Not a valid object name/', $stderr)) { // Grab two logs, since the first one is when the object was deleted. list($stdout) = $repository->execxLocalCommand( 'log -n2 %s %s -- %s', @@ -97,7 +97,7 @@ $path); $stdout = trim($stdout); if ($stdout) { - $commits = explode("\n", $stdout); + $commits = @explode("\n", $stdout); $result ->setReasonForEmptyResultSet( DiffusionBrowseResultSet::REASON_IS_DELETED) @@ -149,7 +149,7 @@ $results = array(); $lines = empty($stdout) ? array() - : explode("\0", rtrim($stdout)); + : @explode("\0", rtrim($stdout)); foreach ($lines as $line) { // NOTE: Limit to 5 components so we parse filenames with spaces in them @@ -236,10 +236,10 @@ $tmp); $dict = array(); - $lines = explode("\n", trim($module_info)); + $lines = @explode("\n", trim($module_info)); foreach ($lines as $line) { - list($key, $value) = explode('=', $line, 2); - $parts = explode('.', $key); + list($key, $value) = @explode('=', $line, 2); + $parts = @explode('.', $key); $dict[$key] = $value; } @@ -275,7 +275,7 @@ $results = array(); $match_against = trim($path, '/'); - $match_len = strlen($match_against); + $match_len = @strlen($match_against); // For the root, don't trim. For other paths, trim the "/" after we match. // We need this because Mercurial's canonical paths have no leading "/", @@ -287,11 +287,11 @@ if (strncmp($path, $match_against, $match_len)) { continue; } - if (!strlen($path)) { + if (!@strlen($path)) { continue; } - $remainder = substr($path, $trim_len); - if (!strlen($remainder)) { + $remainder = @substr($path, $trim_len); + if (!@strlen($remainder)) { // There is a file with this exact name in the manifest, so clearly // it's a file. $result->setReasonForEmptyResultSet( @@ -299,7 +299,7 @@ return $result; } - $parts = explode('/', $remainder); + $parts = @explode('/', $remainder); $name = reset($parts); // If we've already seen this path component, we're looking at a file @@ -357,7 +357,7 @@ $result = $this->getEmptyResultSet(); $subpath = $repository->getDetail('svn-subpath'); - if ($subpath && strncmp($subpath, $path, strlen($subpath))) { + if ($subpath && strncmp($subpath, $path, @strlen($subpath))) { // If we have a subpath and the path isn't a child of it, it (almost // certainly) won't exist since we don't track commits which affect // it. (Even if it exists, return a consistent result.) @@ -516,7 +516,7 @@ foreach ($browse as $file) { $full_path = $file['pathName']; - $file_path = ltrim(substr($full_path, strlen($path_normal)), '/'); + $file_path = ltrim(@substr($full_path, @strlen($path_normal)), '/'); $full_path = ltrim($full_path, '/'); $result_path = new DiffusionRepositoryPath(); diff --git a/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php @@ -47,14 +47,14 @@ $against_hash = $request->getValue('against'); $path = $request->getValue('path'); - if (!strlen($path)) { + if (!@strlen($path)) { $path = null; } $offset = $request->getValue('offset'); $limit = $request->getValue('limit'); - if (strlen($against_hash)) { + if (@strlen($against_hash)) { $commit_range = "${against_hash}..${commit_hash}"; } else { $commit_range = $commit_hash; @@ -82,13 +82,13 @@ 'log %Ls', $argv); - $lines = explode("\n", trim($stdout)); + $lines = @explode("\n", trim($stdout)); $lines = array_filter($lines); $hash_list = array(); $parent_map = array(); foreach ($lines as $line) { - list($hash, $parents) = explode(':', $line); + list($hash, $parents) = @explode(':', $line); $hash_list[] = $hash; $parent_map[$hash] = preg_split('/\s+/', $parents); } @@ -136,7 +136,7 @@ // stop history (this is more consistent with the Mercurial worldview of // branches). - if (strlen($path)) { + if (@strlen($path)) { $path_arg = csprintf('%s', $path); $revset_arg = hgsprintf( 'reverse(ancestors(%s))', @@ -158,7 +158,7 @@ $stdout = DiffusionMercurialCommandEngine::filterMercurialDebugOutput( $stdout); - $lines = explode("\n", trim($stdout)); + $lines = @explode("\n", trim($stdout)); $lines = array_slice($lines, $offset); $hash_list = array(); @@ -166,7 +166,7 @@ $last = null; foreach (array_reverse($lines) as $line) { - list($hash, $parents) = explode(';', $line); + list($hash, $parents) = @explode(';', $line); $parents = trim($parents); if (!$parents) { if ($last === null) { @@ -177,8 +177,8 @@ } else { $parents = preg_split('/\s+/', $parents); foreach ($parents as $parent) { - list($plocal, $phash) = explode(':', $parent); - if (!preg_match('/^0+$/', $phash)) { + list($plocal, $phash) = @explode(':', $parent); + if (!@preg_match('/^0+$/', $phash)) { $parent_map[$hash][] = $phash; } } diff --git a/src/applications/diffusion/conduit/DiffusionInternalGitRawDiffQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionInternalGitRawDiffQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionInternalGitRawDiffQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionInternalGitRawDiffQueryConduitAPIMethod.php @@ -46,7 +46,7 @@ 'log -n1 %s %s --', '--format=%P', gitsprintf('%s', $commit)); - $use_log = !strlen(trim($parents)); + $use_log = !@strlen(trim($parents)); // First, get a fast raw diff without "--find-copies-harder". This flag // produces better results for moves and copies, but is explosively slow diff --git a/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php @@ -57,7 +57,7 @@ gitsprintf('%s', $commit), gitsprintf('%s', '^'.$first_parent)); - $hashes = explode("\n", trim($logs)); + $hashes = @explode("\n", trim($logs)); // Remove the merge commit. $hashes = array_diff($hashes, array($commit)); @@ -78,7 +78,7 @@ 'parents --template=%s --rev %s', '{node}\\n', hgsprintf('%s', $commit)); - $parents = explode("\n", trim($parents)); + $parents = @explode("\n", trim($parents)); if (count($parents) < 2) { // Not a merge commit. @@ -97,7 +97,7 @@ $commit, $last_parent); - $hashes = explode("\n", trim($logs)); + $hashes = @explode("\n", trim($logs)); // Remove the merge commit. $hashes = array_diff($hashes, array($commit)); diff --git a/src/applications/diffusion/conduit/DiffusionQueryPathsConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionQueryPathsConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionQueryPathsConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionQueryPathsConduitAPIMethod.php @@ -39,7 +39,7 @@ // Recent versions of Git don't work if you pass the empty string, and // require "." to list everything. - if (!strlen($path)) { + if (!@strlen($path)) { $path = '.'; } @@ -65,11 +65,11 @@ ->execute(); $match_against = trim($path, '/'); - $match_len = strlen($match_against); + $match_len = @strlen($match_against); $lines = array(); foreach ($entire_manifest as $path) { - if (strlen($path) && !strncmp($path, $match_against, $match_len)) { + if (@strlen($path) && !strncmp($path, $match_against, $match_len)) { $lines[] = $path; } } @@ -82,7 +82,7 @@ $limit = (int)$request->getValue('limit'); $offset = (int)$request->getValue('offset'); - if (strlen($pattern)) { + if (@strlen($pattern)) { // Add delimiters to the regex pattern. $pattern = '('.$pattern.')'; } @@ -90,7 +90,7 @@ $results = array(); $count = 0; foreach ($lines as $line) { - if (strlen($pattern) && !preg_match($pattern, $line)) { + if (@strlen($pattern) && !@preg_match($pattern, $line)) { continue; } diff --git a/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php @@ -38,7 +38,7 @@ if (!$refs) { return array(); } - $refs = explode(',', $refs); + $refs = @explode(',', $refs); $refs = array_map('trim', $refs); $ref_links = array(); diff --git a/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php @@ -56,7 +56,7 @@ // Starting with Git 2.16.0, Git assumes passing an empty argument is // an error and recommends you pass "." instead. - if (!strlen($path)) { + if (!@strlen($path)) { $path = '.'; } @@ -76,9 +76,9 @@ foreach ($lines as $line) { $result = null; - if (preg_match('/[^:]*:(.+)\0(.+)\0(.*)/', $line, $result)) { + if (@preg_match('/[^:]*:(.+)\0(.+)\0(.*)/', $line, $result)) { $results[] = array_slice($result, 1); - } else if (preg_match($binary_pattern, $line, $result)) { + } else if (@preg_match($binary_pattern, $line, $result)) { list(, $path) = $result; $results[] = array($path, null, pht('Binary file')); } else { diff --git a/src/applications/diffusion/conduit/DiffusionTagsQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionTagsQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionTagsQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionTagsQueryConduitAPIMethod.php @@ -109,11 +109,11 @@ } $stdout = rtrim($stdout, "\n"); - if (!strlen($stdout)) { + if (!@strlen($stdout)) { return array(); } - $tag_names = explode("\n", $stdout); + $tag_names = @explode("\n", $stdout); $tag_names = array_fill_keys($tag_names, true); return $tag_names; @@ -146,7 +146,7 @@ // `git tag x [commit]` are "lightweight tags" and `git cat-file tag` // will fail on them. This is fine: they don't have messages. } else { - $parts = explode("\n\n", $stdout, 2); + $parts = @explode("\n\n", $stdout, 2); if (count($parts) == 2) { $message = last($parts); } diff --git a/src/applications/diffusion/controller/DiffusionBranchTableController.php b/src/applications/diffusion/controller/DiffusionBranchTableController.php --- a/src/applications/diffusion/controller/DiffusionBranchTableController.php +++ b/src/applications/diffusion/controller/DiffusionBranchTableController.php @@ -26,7 +26,7 @@ ); $contains = $drequest->getSymbolicCommit(); - if (strlen($contains)) { + if (@strlen($contains)) { $params['contains'] = $contains; } diff --git a/src/applications/diffusion/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php --- a/src/applications/diffusion/controller/DiffusionBrowseController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseController.php @@ -22,7 +22,7 @@ // list. $grep = $request->getStr('grep'); - if (strlen($grep)) { + if (@strlen($grep)) { return $this->browseSearch(); } @@ -391,7 +391,7 @@ $results = array(); break; default: - if (strlen($this->getRequest()->getStr('grep'))) { + if (@strlen($this->getRequest()->getStr('grep'))) { $search_mode = 'grep'; $query_string = $request->getStr('grep'); $results = $this->callConduitWithDiffusionRequest( @@ -758,7 +758,7 @@ $old_line = 0; $new_line = 0; - foreach (explode("\n", $raw_diff) as $text) { + foreach (@explode("\n", $raw_diff) as $text) { if ($text[0] == '-' || $text[0] == ' ') { $old_line++; } @@ -917,7 +917,7 @@ $tags = mpull($tags, null, 'getName'); $tag = idx($tags, $symbolic); - if ($tag && strlen($tag->getMessage())) { + if ($tag && @strlen($tag->getMessage())) { $view->addSectionHeader( pht('Tag Content'), 'fa-tag'); $view->addTextContent($this->markupText($tag->getMessage())); @@ -980,12 +980,12 @@ } $lfs_pattern = '(^version https://git-lfs\\.github\\.com/spec/v1[\r\n])'; - if (!preg_match($lfs_pattern, $data)) { + if (!@preg_match($lfs_pattern, $data)) { return null; } $matches = null; - if (!preg_match('(^oid sha256:(.*)$)m', $data, $matches)) { + if (!@preg_match('(^oid sha256:(.*)$)m', $data, $matches)) { return null; } diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -27,8 +27,8 @@ // If this page is being accessed via "/source/xyz/commit/...", redirect // to the canonical URI. - $has_callsign = strlen($request->getURIData('repositoryCallsign')); - $has_id = strlen($request->getURIData('repositoryID')); + $has_callsign = @strlen($request->getURIData('repositoryCallsign')); + $has_id = @strlen($request->getURIData('repositoryID')); if (!$has_callsign && !$has_id) { $canonical_uri = $repository->getCommitURI($commit_identifier); return id(new AphrontRedirectResponse()) @@ -922,7 +922,7 @@ private function linkBugtraq($corpus) { $url = PhabricatorEnv::getEnvConfig('bugtraq.url'); - if (!strlen($url)) { + if (!@strlen($url)) { return $corpus; } diff --git a/src/applications/diffusion/controller/DiffusionCompareController.php b/src/applications/diffusion/controller/DiffusionCompareController.php --- a/src/applications/diffusion/controller/DiffusionCompareController.php +++ b/src/applications/diffusion/controller/DiffusionCompareController.php @@ -32,14 +32,14 @@ $must_prompt = false; if (!$request->isFormPost()) { - if (!strlen($head_ref)) { + if (!@strlen($head_ref)) { $head_ref = $drequest->getSymbolicCommit(); - if (!strlen($head_ref)) { + if (!@strlen($head_ref)) { $head_ref = $drequest->getBranch(); } } - if (!strlen($against_ref)) { + if (!@strlen($against_ref)) { $default_branch = $repository->getDefaultBranch(); if ($default_branch != $head_ref) { $against_ref = $default_branch; @@ -176,7 +176,7 @@ $e_against = null; $errors = array(); if ($request->isFormPost()) { - if (!strlen($head_ref)) { + if (!@strlen($head_ref)) { $e_head = pht('Required'); $errors[] = pht( 'You must provide two different commits to compare.'); @@ -187,7 +187,7 @@ $head_ref); } - if (!strlen($against_ref)) { + if (!@strlen($against_ref)) { $e_against = pht('Required'); $errors[] = pht( 'You must provide two different commits to compare.'); diff --git a/src/applications/diffusion/controller/DiffusionController.php b/src/applications/diffusion/controller/DiffusionController.php --- a/src/applications/diffusion/controller/DiffusionController.php +++ b/src/applications/diffusion/controller/DiffusionController.php @@ -97,19 +97,19 @@ AphrontRequest $request) { $short_name = $request->getURIData('repositoryShortName'); - if (strlen($short_name)) { + if (@strlen($short_name)) { // If the short name ends in ".git", ignore it. $short_name = preg_replace('/\\.git\z/', '', $short_name); return $short_name; } $identifier = $request->getURIData('repositoryCallsign'); - if (strlen($identifier)) { + if (@strlen($identifier)) { return $identifier; } $id = $request->getURIData('repositoryID'); - if (strlen($id)) { + if (@strlen($id)) { return (int)$id; } @@ -153,7 +153,7 @@ if (!$spec['commit'] && !$spec['tags'] && !$spec['branches']) { $branch_name = $drequest->getBranch(); - if (strlen($branch_name)) { + if (@strlen($branch_name)) { $repository_name .= ' ('.$branch_name.')'; } } @@ -265,7 +265,7 @@ protected function renderPathLinks(DiffusionRequest $drequest, $action) { $path = $drequest->getPath(); - $path_parts = array_filter(explode('/', trim($path, '/'))); + $path_parts = array_filter(@explode('/', trim($path, '/'))); $divider = phutil_tag( 'span', @@ -434,7 +434,7 @@ } $readme_corpus = $readme_cache['corpus']; - if (!strlen($readme_corpus)) { + if (!@strlen($readme_corpus)) { return null; } diff --git a/src/applications/diffusion/controller/DiffusionExternalController.php b/src/applications/diffusion/controller/DiffusionExternalController.php --- a/src/applications/diffusion/controller/DiffusionExternalController.php +++ b/src/applications/diffusion/controller/DiffusionExternalController.php @@ -59,7 +59,7 @@ if (empty($commits)) { $desc = null; - if (strlen($uri)) { + if (@strlen($uri)) { $desc = pht('"%s", at "%s"', $uri, $id); } else { $desc = pht('"%s"', $id); diff --git a/src/applications/diffusion/controller/DiffusionHistoryController.php b/src/applications/diffusion/controller/DiffusionHistoryController.php --- a/src/applications/diffusion/controller/DiffusionHistoryController.php +++ b/src/applications/diffusion/controller/DiffusionHistoryController.php @@ -50,7 +50,7 @@ // ancestors appropriately, but this would currrently be prohibitively // expensive in the general case. - $show_graph = !strlen($drequest->getPath()); + $show_graph = !@strlen($drequest->getPath()); if ($show_graph) { $history_list ->setParents($history_results['parents']) @@ -98,7 +98,7 @@ $viewer = $this->getViewer(); $repository = $drequest->getRepository(); - $no_path = !strlen($drequest->getPath()); + $no_path = !@strlen($drequest->getPath()); if ($no_path) { $header_text = pht('History'); } else { diff --git a/src/applications/diffusion/controller/DiffusionLintController.php b/src/applications/diffusion/controller/DiffusionLintController.php --- a/src/applications/diffusion/controller/DiffusionLintController.php +++ b/src/applications/diffusion/controller/DiffusionLintController.php @@ -21,7 +21,7 @@ } $code = $request->getStr('lint'); - if (strlen($code)) { + if (@strlen($code)) { return $this->buildDetailsResponse(); } @@ -230,7 +230,7 @@ if ($drequest->getPath() != '') { $path = '/'.$drequest->getPath(); - $is_dir = (substr($path, -1) == '/'); + $is_dir = (@substr($path, -1) == '/'); $where[] = ($is_dir ? qsprintf($conn, 'path LIKE %>', $path) : qsprintf($conn, 'path = %s', $path)); @@ -395,7 +395,7 @@ $drequest = $this->getDiffusionRequest(); $branch = $drequest->loadBranch(); $messages = $this->loadLintMessages($branch, $limit, $offset); - $is_dir = (substr('/'.$drequest->getPath(), -1) == '/'); + $is_dir = (@substr('/'.$drequest->getPath(), -1) == '/'); $pager->setHasMorePages(count($messages) >= $limit); @@ -411,7 +411,7 @@ 'path' => $message['path'], )), ), - substr($message['path'], strlen($drequest->getPath()) + 1)); + @substr($message['path'], @strlen($drequest->getPath()) + 1)); $line = phutil_tag( 'a', @@ -509,7 +509,7 @@ if ($drequest->getPath() != '') { $path = '/'.$drequest->getPath(); - $is_dir = (substr($path, -1) == '/'); + $is_dir = (@substr($path, -1) == '/'); $where[] = ($is_dir ? qsprintf($conn, 'path LIKE %>', $path) : qsprintf($conn, 'path = %s', $path)); diff --git a/src/applications/diffusion/controller/DiffusionPathCompleteController.php b/src/applications/diffusion/controller/DiffusionPathCompleteController.php --- a/src/applications/diffusion/controller/DiffusionPathCompleteController.php +++ b/src/applications/diffusion/controller/DiffusionPathCompleteController.php @@ -17,7 +17,7 @@ $drequest = $this->getDiffusionRequest(); $query_path = $request->getStr('q'); - if (preg_match('@/$@', $query_path)) { + if (@preg_match('@/$@', $query_path)) { $query_dir = $query_path; } else { $query_dir = dirname($query_path).'/'; @@ -39,7 +39,7 @@ if ($path->getFileType() == DifferentialChangeType::FILE_DIRECTORY) { $full_path .= '/'; } - $output[] = array('/'.$full_path, null, substr(md5($full_path), 0, 7)); + $output[] = array('/'.$full_path, null, @substr(md5($full_path), 0, 7)); } return id(new AphrontAjaxResponse())->setContent($output); diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php @@ -412,7 +412,7 @@ ->setUser($viewer); $description = $repository->getDetail('description'); - if (strlen($description)) { + if (@strlen($description)) { $description = new PHUIRemarkupView($viewer, $description); $view->addTextContent($description); return id(new PHUIObjectBoxView()) @@ -560,7 +560,7 @@ $repository_name = $repository->getName(); $branch_name = $drequest->getBranch(); - if (strlen($branch_name)) { + if (@strlen($branch_name)) { $repository_name .= ' ('.$branch_name.')'; } diff --git a/src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php b/src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php @@ -40,7 +40,7 @@ } $selected = $request->getURIData('panel'); - if (!strlen($selected)) { + if (!@strlen($selected)) { $selected = head_key($panels); } diff --git a/src/applications/diffusion/controller/DiffusionRepositoryURICredentialController.php b/src/applications/diffusion/controller/DiffusionRepositoryURICredentialController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryURICredentialController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryURICredentialController.php @@ -117,7 +117,7 @@ ->setOptions($options); $default_user = $effective_uri->getUser(); - if (strlen($default_user)) { + if (@strlen($default_user)) { $control->setDefaultUsername($default_user); } diff --git a/src/applications/diffusion/controller/DiffusionServeController.php b/src/applications/diffusion/controller/DiffusionServeController.php --- a/src/applications/diffusion/controller/DiffusionServeController.php +++ b/src/applications/diffusion/controller/DiffusionServeController.php @@ -64,7 +64,7 @@ } else if ($content_type == 'application/x-git-receive-pack-request') { // We get this for `git-receive-pack`. $vcs = PhabricatorRepositoryType::REPOSITORY_TYPE_GIT; - } else if (preg_match($lfs_pattern, $content_type)) { + } else if (@preg_match($lfs_pattern, $content_type)) { // This is a Git LFS HTTP API request. $vcs = PhabricatorRepositoryType::REPOSITORY_TYPE_GIT; $this->isGitLFSRequest = true; @@ -183,8 +183,8 @@ // won't prompt users who provide a username but no password otherwise. // See T10797 for discussion. - $have_user = strlen(idx($_SERVER, 'PHP_AUTH_USER')); - $have_pass = strlen(idx($_SERVER, 'PHP_AUTH_PW')); + $have_user = @strlen(idx($_SERVER, 'PHP_AUTH_USER')); + $have_pass = @strlen(idx($_SERVER, 'PHP_AUTH_PW')); if ($have_user && $have_pass) { $username = $_SERVER['PHP_AUTH_USER']; $password = new PhutilOpaqueEnvelope($_SERVER['PHP_AUTH_PW']); @@ -677,7 +677,7 @@ $known = implode('|', $known); - if (preg_match('@^/([^/]+)/('.$known.')(/|$)@', $base_path)) { + if (@preg_match('@^/([^/]+)/('.$known.')(/|$)@', $base_path)) { $base_path = preg_replace('@^/([^/]+)@', '', $base_path); } } @@ -761,12 +761,12 @@ return null; } - if (!strlen($username)) { + if (!@strlen($username)) { // No username. return null; } - if (!strlen($password->openEnvelope())) { + if (!@strlen($password->openEnvelope())) { // No password. return null; } @@ -823,8 +823,8 @@ $args = $this->getMercurialArguments(); $args = $this->formatMercurialArguments($cmd, $args); - if (strlen($input)) { - $input = strlen($input)."\n".$input."0\n"; + if (@strlen($input)) { + $input = @strlen($input)."\n".$input."0\n"; } $command = csprintf( @@ -855,9 +855,9 @@ // This includes diagnostic information and anything echoed by commit // hooks. We ignore `stdout` since it just has protocol garbage, and // substitute `stderr`. - $body = strlen($stderr)."\n".$stderr; + $body = @strlen($stderr)."\n".$stderr; } else { - list($length, $body) = explode("\n", $stdout, 2); + list($length, $body) = @explode("\n", $stdout, 2); if ($cmd == 'capabilities') { $body = DiffusionMercurialWireProtocol::filterBundle2Capability($body); } @@ -902,7 +902,7 @@ } if (isset($arguments[$arg_key])) { $value = $arguments[$arg_key]; - $size = strlen($value); + $size = @strlen($value); $out[] = "{$arg_key} {$size}\n{$value}"; unset($arguments[$arg_key]); } @@ -928,7 +928,7 @@ // We already added this argument above, so skip it. continue; } - $size = strlen($value); + $size = @strlen($value); $out[] = "{$key} {$size}\n{$value}"; } } @@ -956,10 +956,10 @@ $stdout_regexp = '(^Content-Type: application/x-git-upload-pack-result)m'; - $has_pack = preg_match($stdout_regexp, $stdout); + $has_pack = @preg_match($stdout_regexp, $stdout); - if (strlen($stdout) >= 4) { - $has_flush_packet = (substr($stdout, -4) === "0000"); + if (@strlen($stdout) >= 4) { + $has_flush_packet = (@substr($stdout, -4) === "0000"); } else { $has_flush_packet = false; } @@ -1024,7 +1024,7 @@ $path = $this->getGitLFSRequestPath($repository); $matches = null; - if (preg_match('(^upload/(.*)\z)', $path, $matches)) { + if (@preg_match('(^upload/(.*)\z)', $path, $matches)) { $oid = $matches[1]; return $this->serveGitLFSUploadRequest($repository, $viewer, $oid); } else if ($path == 'objects/batch') { @@ -1261,7 +1261,7 @@ $request_path = $this->getRequestDirectoryPath($repository); $matches = null; - if (preg_match('(^/info/lfs(?:\z|/)(.*))', $request_path, $matches)) { + if (@preg_match('(^/info/lfs(?:\z|/)(.*))', $request_path, $matches)) { return $matches[1]; } diff --git a/src/applications/diffusion/controller/DiffusionSymbolController.php b/src/applications/diffusion/controller/DiffusionSymbolController.php --- a/src/applications/diffusion/controller/DiffusionSymbolController.php +++ b/src/applications/diffusion/controller/DiffusionSymbolController.php @@ -28,7 +28,7 @@ $repos = array(); if ($request->getStr('repositories')) { $phids = $request->getStr('repositories'); - $phids = explode(',', $phids); + $phids = @explode(',', $phids); $phids = array_filter($phids); if ($phids) { diff --git a/src/applications/diffusion/controller/DiffusionTagListController.php b/src/applications/diffusion/controller/DiffusionTagListController.php --- a/src/applications/diffusion/controller/DiffusionTagListController.php +++ b/src/applications/diffusion/controller/DiffusionTagListController.php @@ -25,7 +25,7 @@ 'offset' => $pager->getOffset(), ); - if (strlen($drequest->getSymbolicCommit())) { + if (@strlen($drequest->getSymbolicCommit())) { $is_commit = true; $params['commit'] = $drequest->getSymbolicCommit(); } else { diff --git a/src/applications/diffusion/data/DiffusionBrowseResultSet.php b/src/applications/diffusion/data/DiffusionBrowseResultSet.php --- a/src/applications/diffusion/data/DiffusionBrowseResultSet.php +++ b/src/applications/diffusion/data/DiffusionBrowseResultSet.php @@ -100,7 +100,7 @@ } $local_path = $path_object->getPath(); - if (!preg_match('/^readme(\.|$)/i', $local_path)) { + if (!@preg_match('/^readme(\.|$)/i', $local_path)) { // Skip files not named "README". continue; } @@ -132,7 +132,7 @@ return 90; } - $ext = last(explode('.', $path)); + $ext = last(@explode('.', $path)); switch ($ext) { case 'remarkup': return 100; diff --git a/src/applications/diffusion/data/DiffusionCommitRef.php b/src/applications/diffusion/data/DiffusionCommitRef.php --- a/src/applications/diffusion/data/DiffusionCommitRef.php +++ b/src/applications/diffusion/data/DiffusionCommitRef.php @@ -131,11 +131,11 @@ } private function formatUser($name, $email) { - if (strlen($name) && strlen($email)) { + if (@strlen($name) && @strlen($email)) { return "{$name} <{$email}>"; - } else if (strlen($email)) { + } else if (@strlen($email)) { return $email; - } else if (strlen($name)) { + } else if (@strlen($name)) { return $name; } else { return null; diff --git a/src/applications/diffusion/data/DiffusionGitBranch.php b/src/applications/diffusion/data/DiffusionGitBranch.php --- a/src/applications/diffusion/data/DiffusionGitBranch.php +++ b/src/applications/diffusion/data/DiffusionGitBranch.php @@ -28,10 +28,10 @@ $only_this_remote = null) { $map = array(); - $lines = array_filter(explode("\n", $stdout)); + $lines = array_filter(@explode("\n", $stdout)); foreach ($lines as $line) { $matches = null; - if (preg_match('/^ (\S+)\s+-> (\S+)$/', $line, $matches)) { + if (@preg_match('/^ (\S+)\s+-> (\S+)$/', $line, $matches)) { // This is a line like: // // origin/HEAD -> origin/master @@ -41,7 +41,7 @@ // branch. continue; } - if (!preg_match('/^ *(\S+)\s+([a-z0-9]{40})/', $line, $matches)) { + if (!@preg_match('/^ *(\S+)\s+([a-z0-9]{40})/', $line, $matches)) { throw new Exception( pht( 'Failed to parse %s!', @@ -51,14 +51,14 @@ $remote_branch = $matches[1]; $branch_head = $matches[2]; - if (strpos($remote_branch, 'HEAD') !== false) { + if (@strpos($remote_branch, 'HEAD') !== false) { // let's assume that no one will call their remote or branch HEAD continue; } if ($only_this_remote) { $matches = null; - if (!preg_match('#^([^/]+)/(.*)$#', $remote_branch, $matches)) { + if (!@preg_match('#^([^/]+)/(.*)$#', $remote_branch, $matches)) { throw new Exception( pht( "Failed to parse remote branch '%s'!", @@ -84,11 +84,11 @@ public static function parseLocalBranchOutput($stdout) { $map = array(); - $lines = array_filter(explode("\n", $stdout)); + $lines = array_filter(@explode("\n", $stdout)); $regex = '/^[* ]*(\(no branch\)|\S+)\s+([a-z0-9]{40})/'; foreach ($lines as $line) { $matches = null; - if (!preg_match($regex, $line, $matches)) { + if (!@preg_match($regex, $line, $matches)) { throw new Exception( pht( 'Failed to parse %s!', diff --git a/src/applications/diffusion/document/DiffusionDocumentRenderingEngine.php b/src/applications/diffusion/document/DiffusionDocumentRenderingEngine.php --- a/src/applications/diffusion/document/DiffusionDocumentRenderingEngine.php +++ b/src/applications/diffusion/document/DiffusionDocumentRenderingEngine.php @@ -87,7 +87,7 @@ $ref->setSymbolMetadata($this->getSymbolMetadata()); $coverage = $drequest->loadCoverage(); - if (strlen($coverage)) { + if (@strlen($coverage)) { $ref->addCoverage($coverage); } } @@ -99,7 +99,7 @@ $symbol_repos = nonempty($repo->getSymbolSources(), array()); $symbol_repos[] = $repo->getPHID(); - $lang = last(explode('.', $drequest->getPath())); + $lang = last(@explode('.', $drequest->getPath())); return array( 'repositories' => $symbol_repos, diff --git a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php --- a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php +++ b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php @@ -384,7 +384,7 @@ $this->rejectDetails = $rule->getPHID(); $message = $blocking_effect->getTarget(); - if (!strlen($message)) { + if (!@strlen($message)) { $message = pht('(None.)'); } @@ -437,7 +437,7 @@ $stdin = $this->getStdin(); $lines = phutil_split_lines($stdin, $retain_endings = false); foreach ($lines as $line) { - $parts = explode(' ', $line, 3); + $parts = @explode(' ', $line, 3); if (count($parts) != 3) { throw new Exception(pht('Expected "old new ref", got "%s".', $line)); } @@ -446,12 +446,12 @@ $ref_new = $parts[1]; $ref_raw = $parts[2]; - if (preg_match('(^refs/heads/)', $ref_raw)) { + if (@preg_match('(^refs/heads/)', $ref_raw)) { $ref_type = PhabricatorRepositoryPushLog::REFTYPE_BRANCH; - $ref_raw = substr($ref_raw, strlen('refs/heads/')); - } else if (preg_match('(^refs/tags/)', $ref_raw)) { + $ref_raw = @substr($ref_raw, @strlen('refs/heads/')); + } else if (@preg_match('(^refs/tags/)', $ref_raw)) { $ref_type = PhabricatorRepositoryPushLog::REFTYPE_TAG; - $ref_raw = substr($ref_raw, strlen('refs/tags/')); + $ref_raw = @substr($ref_raw, @strlen('refs/tags/')); } else { $ref_type = PhabricatorRepositoryPushLog::REFTYPE_REF; } @@ -613,7 +613,7 @@ foreach ($futures as $key => $future) { list($stdout) = $future->resolvex(); - if (!strlen(trim($stdout))) { + if (!@strlen(trim($stdout))) { // This change doesn't have any new commits. One common case of this // is creating a new tag which points at an existing commit. continue; @@ -847,7 +847,7 @@ foreach (new FutureIterator($dfutures) as $future_head => $dfuture) { list($stdout) = $dfuture->resolvex(); - $descendant_heads = array_filter(explode("\1", $stdout)); + $descendant_heads = array_filter(@explode("\1", $stdout)); if ($descendant_heads) { // This old head has at least one descendant in the push. $head_map[$future_head] = $descendant_heads; @@ -898,7 +898,7 @@ if ($splits_existing_head || $creates_duplicate_head) { $readable_child_heads = array(); foreach ($child_heads as $child_head) { - $readable_child_heads[] = substr($child_head, 0, 12); + $readable_child_heads[] = @substr($child_head, 0, 12); } $ref_flags |= PhabricatorRepositoryPushLog::CHANGEFLAG_DANGEROUS; @@ -972,12 +972,12 @@ $key_name = getenv('HG_KEY'); $key_old = getenv('HG_OLD'); - if (!strlen($key_old)) { + if (!@strlen($key_old)) { $key_old = null; } $key_new = getenv('HG_NEW'); - if (!strlen($key_new)) { + if (!@strlen($key_new)) { $key_new = null; } @@ -1010,7 +1010,7 @@ '{node}', hgsprintf('ancestor(%s, %s)', $key_old, $key_new)); - if (strlen(trim($merge_base_raw))) { + if (@strlen(trim($merge_base_raw))) { $merge_base = trim($merge_base_raw); } @@ -1045,11 +1045,11 @@ } private function parseMercurialCommits($raw) { - $commits_lines = explode("\2", $raw); + $commits_lines = @explode("\2", $raw); $commits_lines = array_filter($commits_lines); $commit_map = array(); foreach ($commits_lines as $commit_line) { - list($node, $branch) = explode("\1", $commit_line); + list($node, $branch) = @explode("\1", $commit_line); $commit_map[$node] = array($branch); } @@ -1133,7 +1133,7 @@ ->setHookWait(phutil_microseconds_since($hook_start)); $identifier = $this->getRequestIdentifier(); - if (strlen($identifier)) { + if (@strlen($identifier)) { $event->setRequestIdentifier($identifier); } @@ -1225,7 +1225,7 @@ throw new Exception(pht("Unknown VCS '%s!'", $vcs)); } - if (strlen($raw_diff) >= $byte_limit) { + if (@strlen($raw_diff) >= $byte_limit) { throw new Exception( pht( 'The raw text of this change ("%s") is enormous (larger than %s '. @@ -1234,7 +1234,7 @@ new PhutilNumber($byte_limit))); } - if (!strlen($raw_diff)) { + if (!@strlen($raw_diff)) { // If the commit is actually empty, just return no changesets. return array(array(), 0); } @@ -1245,7 +1245,7 @@ $changes); $changesets = $diff->getChangesets(); - $size = strlen($raw_diff); + $size = @strlen($raw_diff); return array($changesets, $size); } diff --git a/src/applications/diffusion/engineextension/DiffusionDatasourceEngineExtension.php b/src/applications/diffusion/engineextension/DiffusionDatasourceEngineExtension.php --- a/src/applications/diffusion/engineextension/DiffusionDatasourceEngineExtension.php +++ b/src/applications/diffusion/engineextension/DiffusionDatasourceEngineExtension.php @@ -14,18 +14,18 @@ $viewer = $this->getViewer(); // Send "r" to Diffusion. - if (preg_match('/^r\z/i', $query)) { + if (@preg_match('/^r\z/i', $query)) { return '/diffusion/'; } // Send "a" to the commit list ("Audit"). - if (preg_match('/^a\z/i', $query)) { + if (@preg_match('/^a\z/i', $query)) { return '/diffusion/commit/'; } // Send "r " to a search for a matching repository. $matches = null; - if (preg_match('/^r\s+(.+)\z/i', $query, $matches)) { + if (@preg_match('/^r\s+(.+)\z/i', $query, $matches)) { $raw_query = $matches[1]; $engine = id(new PhabricatorRepository()) @@ -60,11 +60,11 @@ // Send "s " to a symbol search. $matches = null; - if (preg_match('/^s\s+(.+)\z/i', $query, $matches)) { + if (@preg_match('/^s\s+(.+)\z/i', $query, $matches)) { $symbol = $matches[1]; $parts = null; - if (preg_match('/(.*)(?:\\.|::|->)(.*)/', $symbol, $parts)) { + if (@preg_match('/(.*)(?:\\.|::|->)(.*)/', $symbol, $parts)) { return urisprintf( '/diffusion/symbol/%p/?jump=true&context=%s', $parts[2], diff --git a/src/applications/diffusion/engineextension/DiffusionSourceHyperlinkEngineExtension.php b/src/applications/diffusion/engineextension/DiffusionSourceHyperlinkEngineExtension.php --- a/src/applications/diffusion/engineextension/DiffusionSourceHyperlinkEngineExtension.php +++ b/src/applications/diffusion/engineextension/DiffusionSourceHyperlinkEngineExtension.php @@ -30,7 +30,7 @@ '/(?P.*)'. '\z)'; $matches = null; - if (!preg_match($pattern, $path, $matches)) { + if (!@preg_match($pattern, $path, $matches)) { continue; } diff --git a/src/applications/diffusion/herald/DiffusionPreCommitUsesGitLFSHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitUsesGitLFSHeraldField.php --- a/src/applications/diffusion/herald/DiffusionPreCommitUsesGitLFSHeraldField.php +++ b/src/applications/diffusion/herald/DiffusionPreCommitUsesGitLFSHeraldField.php @@ -26,7 +26,7 @@ $pattern = '(^version\s*https://git-lfs.github.com/spec/)i'; foreach ($map as $path => $content) { - if (preg_match($pattern, $content)) { + if (@preg_match($pattern, $content)) { return true; } } diff --git a/src/applications/diffusion/herald/HeraldPreCommitContentAdapter.php b/src/applications/diffusion/herald/HeraldPreCommitContentAdapter.php --- a/src/applications/diffusion/herald/HeraldPreCommitContentAdapter.php +++ b/src/applications/diffusion/herald/HeraldPreCommitContentAdapter.php @@ -102,7 +102,7 @@ case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: $ref = $this->getCommitRef(); $author = $ref->getAuthor(); - if (!strlen($author)) { + if (!@strlen($author)) { return null; } return $this->lookupUser($author); @@ -123,7 +123,7 @@ // can't resolve it, return `null`. $ref = $this->getCommitRef(); $committer = $ref->getCommitter(); - if (!strlen($committer)) { + if (!@strlen($committer)) { return $this->getAuthorPHID(); } return $this->lookupUser($committer); @@ -157,7 +157,7 @@ // instead. $ref = $this->getCommitRef(); $committer = $ref->getCommitter(); - if (strlen($committer)) { + if (@strlen($committer)) { return $committer; } return $ref->getAuthor(); diff --git a/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php --- a/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php @@ -220,7 +220,7 @@ $view->addProperty(pht('Type'), $type); $callsign = $repository->getCallsign(); - if (!strlen($callsign)) { + if (!@strlen($callsign)) { $callsign = phutil_tag('em', array(), pht('No Callsign')); } $view->addProperty(pht('Callsign'), $callsign); @@ -277,7 +277,7 @@ $view = id(new PHUIPropertyListView()) ->setViewer($viewer); - if (!strlen($description)) { + if (!@strlen($description)) { return null; } else { $description = new PHUIRemarkupView($viewer, $description); @@ -452,7 +452,7 @@ if ($svnlook_check) { $where = Filesystem::resolveBinary('svnlook'); if ($where) { - $path = substr($where, 0, strlen($where) - strlen('svnlook')); + $path = @substr($where, 0, @strlen($where) - @strlen('svnlook')); $dirs = PhabricatorEnv::getEnvConfig('environment.append-paths'); $in_path = false; foreach ($dirs as $dir) { @@ -624,7 +624,7 @@ $message = $message->getParameter('message'); $suggestion = null; - if (preg_match('/Permission denied \(publickey\)./', $message)) { + if (@preg_match('/Permission denied \(publickey\)./', $message)) { $suggestion = pht( 'Public Key Error: This error usually indicates that the '. 'keypair you have configured does not have permission to '. diff --git a/src/applications/diffusion/panel/DiffusionSetPasswordSettingsPanel.php b/src/applications/diffusion/panel/DiffusionSetPasswordSettingsPanel.php --- a/src/applications/diffusion/panel/DiffusionSetPasswordSettingsPanel.php +++ b/src/applications/diffusion/panel/DiffusionSetPasswordSettingsPanel.php @@ -160,7 +160,7 @@ $suggest = Filesystem::readRandomBytes(128); $suggest = preg_replace('([^A-Za-z0-9/!().,;{}^&*%~])', '', $suggest); - $suggest = substr($suggest, 0, 20); + $suggest = @substr($suggest, 0, 20); if ($is_serious) { $form->appendRemarkupInstructions( @@ -195,7 +195,7 @@ ->setLabel(pht('Best Available Algorithm')) ->setValue(PhabricatorPasswordHasher::getBestAlgorithmName())); - if (strlen($hash_envelope->openEnvelope())) { + if (@strlen($hash_envelope->openEnvelope())) { try { $can_upgrade = PhabricatorPasswordHasher::canUpgradeHash( $hash_envelope); diff --git a/src/applications/diffusion/protocol/DiffusionGitUploadPackWireProtocol.php b/src/applications/diffusion/protocol/DiffusionGitUploadPackWireProtocol.php --- a/src/applications/diffusion/protocol/DiffusionGitUploadPackWireProtocol.php +++ b/src/applications/diffusion/protocol/DiffusionGitUploadPackWireProtocol.php @@ -31,7 +31,7 @@ if ($len < 4) { if ($len > 0) { $bytes = $this->peekBytes($len); - if (!preg_match('/^[0-9a-f]+\z/', $bytes)) { + if (!@preg_match('/^[0-9a-f]+\z/', $bytes)) { throw new Exception( pht( 'Bad frame length character in Git protocol ("%s"), '. @@ -157,7 +157,7 @@ private function newProtocolFrame($type, $bytes) { return array( 'type' => $type, - 'length' => strlen($bytes), + 'length' => @strlen($bytes), 'bytes' => $bytes, ); } @@ -208,7 +208,7 @@ $capabilities_pattern = ''; } - $ok = preg_match( + $ok = @preg_match( '('. '^'. '(?:'. diff --git a/src/applications/diffusion/protocol/DiffusionMercurialCommandEngine.php b/src/applications/diffusion/protocol/DiffusionMercurialCommandEngine.php --- a/src/applications/diffusion/protocol/DiffusionMercurialCommandEngine.php +++ b/src/applications/diffusion/protocol/DiffusionMercurialCommandEngine.php @@ -23,7 +23,7 @@ ->splitArguments($test_command); foreach ($test_args as $test_arg) { - if (preg_match('/^--(config|debugger)/i', $test_arg)) { + if (@preg_match('/^--(config|debugger)/i', $test_arg)) { throw new DiffusionMercurialFlagInjectionException( pht( 'Mercurial command appears to contain unsafe injected "--config" '. diff --git a/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php b/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php --- a/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php +++ b/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php @@ -65,7 +65,7 @@ } public static function isReadOnlyBatchCommand($cmds) { - if (!strlen($cmds)) { + if (!@strlen($cmds)) { // We expect a "batch" command to always have a "cmds" string, so err // on the side of caution and throw if we don't get any data here. This // either indicates a mangled command from the client or a programming @@ -93,9 +93,9 @@ // // So just split unconditionally. - $cmds = explode(';', $cmds); + $cmds = @explode(';', $cmds); foreach ($cmds as $sub_cmd) { - $name = head(explode(' ', $sub_cmd, 2)); + $name = head(@explode(' ', $sub_cmd, 2)); if (!self::isReadOnlyCommand($name)) { return false; } @@ -124,9 +124,9 @@ * to replace the original $body to send back to client. */ public static function filterBundle2Capability($capabilities) { - $parts = explode(' ', $capabilities); + $parts = @explode(' ', $capabilities); foreach ($parts as $key => $part) { - if (preg_match('/^bundle2=/', $part)) { + if (@preg_match('/^bundle2=/', $part)) { unset($parts[$key]); break; } diff --git a/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php b/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php --- a/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php +++ b/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php @@ -38,15 +38,15 @@ // protocol requires at least one space, but allows more than one. $matches = null; - if (!preg_match('/^(\s*)\S/', $this->buffer, $matches)) { + if (!@preg_match('/^(\s*)\S/', $this->buffer, $matches)) { // Wait for more data. break; } // We have zero or more spaces and then some other character, so throw // the spaces away and continue parsing frames. - if (strlen($matches[1])) { - $this->buffer = substr($this->buffer, strlen($matches[1])); + if (@strlen($matches[1])) { + $this->buffer = @substr($this->buffer, @strlen($matches[1])); } $this->state = 'item'; @@ -54,17 +54,17 @@ $match = null; $result = null; $buf = $this->buffer; - if (preg_match('/^([a-z][a-z0-9-]*)\s/i', $buf, $match)) { + if (@preg_match('/^([a-z][a-z0-9-]*)\s/i', $buf, $match)) { $this->pushItem($match[1], 'word'); - } else if (preg_match('/^(\d+)\s/', $buf, $match)) { + } else if (@preg_match('/^(\d+)\s/', $buf, $match)) { $this->pushItem((int)$match[1], 'number'); - } else if (preg_match('/^(\d+):/', $buf, $match)) { + } else if (@preg_match('/^(\d+):/', $buf, $match)) { // NOTE: The "+ 1" includes the space after the string. $this->expectBytes = (int)$match[1] + 1; $this->state = 'bytes'; - } else if (preg_match('/^(\\()\s/', $buf, $match)) { + } else if (@preg_match('/^(\\()\s/', $buf, $match)) { $this->pushList(); - } else if (preg_match('/^(\\))\s/', $buf, $match)) { + } else if (@preg_match('/^(\\))\s/', $buf, $match)) { $list = $this->popList(); if ($this->stack) { $this->pushItem($list, 'list'); @@ -76,8 +76,8 @@ } if ($match !== false) { - $this->raw .= substr($this->buffer, 0, strlen($match[0])); - $this->buffer = substr($this->buffer, strlen($match[0])); + $this->raw .= @substr($this->buffer, 0, @strlen($match[0])); + $this->buffer = @substr($this->buffer, @strlen($match[0])); if ($result !== null) { $messages[] = array( @@ -97,21 +97,21 @@ break; } } else if ($this->state == 'bytes') { - $new_data = substr($this->buffer, 0, $this->expectBytes); - if (!strlen($new_data)) { + $new_data = @substr($this->buffer, 0, $this->expectBytes); + if (!@strlen($new_data)) { // No more bytes available yet, wait for more data. break; } - $this->buffer = substr($this->buffer, strlen($new_data)); + $this->buffer = @substr($this->buffer, @strlen($new_data)); - $this->expectBytes -= strlen($new_data); + $this->expectBytes -= @strlen($new_data); $this->raw .= $new_data; $this->byteBuffer .= $new_data; if (!$this->expectBytes) { $this->state = 'byte-space'; // Strip off the terminal space. - $this->pushItem(substr($this->byteBuffer, 0, -1), 'string'); + $this->pushItem(@substr($this->byteBuffer, 0, -1), 'string'); $this->byteBuffer = ''; $this->state = 'space'; } @@ -141,7 +141,7 @@ $out[] = $value; break; case 'string': - $out[] = strlen($value).':'.$value; + $out[] = @strlen($value).':'.$value; break; case 'list': $out[] = self::serializeStruct($value); diff --git a/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php b/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php --- a/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php +++ b/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php @@ -69,7 +69,7 @@ foreach ($this->refs as $ref) { // We require refs to look like hashes and be at least 4 characters // long. This is similar to the behavior of git. - if (preg_match('/^[a-f0-9]{4,}$/', $ref)) { + if (@preg_match('/^[a-f0-9]{4,}$/', $ref)) { $prefixes[] = qsprintf( $conn_r, '(commitIdentifier LIKE %>)', @@ -89,7 +89,7 @@ foreach ($commits as $commit) { $hash = $commit['commitIdentifier']; foreach ($this->refs as $ref) { - if (!strncmp($hash, $ref, strlen($ref))) { + if (!strncmp($hash, $ref, @strlen($ref))) { $results[$ref][] = array( 'type' => 'commit', 'identifier' => $hash, @@ -162,7 +162,7 @@ continue; } - if (!preg_match('/^\d+$/', $ref)) { + if (!@preg_match('/^\d+$/', $ref)) { // This ref is non-numeric, so it doesn't resolve to anything. continue; } diff --git a/src/applications/diffusion/query/DiffusionCommitQuery.php b/src/applications/diffusion/query/DiffusionCommitQuery.php --- a/src/applications/diffusion/query/DiffusionCommitQuery.php +++ b/src/applications/diffusion/query/DiffusionCommitQuery.php @@ -330,8 +330,8 @@ } else { // This awkward construction is so we can link the commits up in O(N) // time instead of O(N^2). - for ($ii = $min_qualified; $ii <= strlen($suffix); $ii++) { - $part = substr($suffix, 0, $ii); + for ($ii = $min_qualified; $ii <= @strlen($suffix); $ii++) { + $part = @substr($suffix, 0, $ii); foreach ($prefixes as $prefix) { if (isset($ids[$prefix.$part])) { $result[$prefix.$part][] = $commit; @@ -714,7 +714,7 @@ $bare = array(); foreach ($this->identifiers as $identifier) { $matches = null; - preg_match('/^(?:[rR]([A-Z]+:?|[0-9]+:))?(.*)$/', + @preg_match('/^(?:[rR]([A-Z]+:?|[0-9]+:))?(.*)$/', $identifier, $matches); $repo = nonempty(rtrim($matches[1], ':'), null); $commit_identifier = nonempty($matches[2], null); @@ -726,7 +726,7 @@ } if ($repo === null) { - if (strlen($commit_identifier) < $min_unqualified) { + if (@strlen($commit_identifier) < $min_unqualified) { continue; } $bare[] = $commit_identifier; @@ -776,12 +776,12 @@ // See T3377. (int)$ref['identifier']); } else { - if (strlen($ref['identifier']) < $min_qualified) { + if (@strlen($ref['identifier']) < $min_qualified) { continue; } $identifier = $ref['identifier']; - if (strlen($identifier) == 40) { + if (@strlen($identifier) == 40) { // MySQL seems to do slightly better with this version if the // clause, so issue it if we have a full commit hash. $sql[] = qsprintf( diff --git a/src/applications/diffusion/query/DiffusionLintCountQuery.php b/src/applications/diffusion/query/DiffusionLintCountQuery.php --- a/src/applications/diffusion/query/DiffusionLintCountQuery.php +++ b/src/applications/diffusion/query/DiffusionLintCountQuery.php @@ -99,7 +99,7 @@ $paths = array(); foreach ($this->paths as $path) { $path = '/'.$path; - if (substr($path, -1) == '/') { + if (@substr($path, -1) == '/') { $dirs[] = $path; } else { $paths[] = $path; @@ -114,7 +114,7 @@ // Strip the leading "/" back off each path. $output = array(); foreach ($data as $path => $count) { - $output[substr($path, 1)] = $count; + $output[@substr($path, 1)] = $count; } return $output; diff --git a/src/applications/diffusion/query/DiffusionResolveUserQuery.php b/src/applications/diffusion/query/DiffusionResolveUserQuery.php --- a/src/applications/diffusion/query/DiffusionResolveUserQuery.php +++ b/src/applications/diffusion/query/DiffusionResolveUserQuery.php @@ -19,7 +19,7 @@ } private function findUserPHID($user_name) { - if (!strlen($user_name)) { + if (!@strlen($user_name)) { return null; } diff --git a/src/applications/diffusion/query/blame/DiffusionBlameQuery.php b/src/applications/diffusion/query/blame/DiffusionBlameQuery.php --- a/src/applications/diffusion/query/blame/DiffusionBlameQuery.php +++ b/src/applications/diffusion/query/blame/DiffusionBlameQuery.php @@ -136,10 +136,10 @@ // Decode the cache storage format. foreach ($results as $path => $cache) { - list($head, $body) = explode("\n", $cache, 2); + list($head, $body) = @explode("\n", $cache, 2); switch ($head) { case 'raw': - $body = explode("\n", $body); + $body = @explode("\n", $body); break; default: $body = null; diff --git a/src/applications/diffusion/query/blame/DiffusionGitBlameQuery.php b/src/applications/diffusion/query/blame/DiffusionGitBlameQuery.php --- a/src/applications/diffusion/query/blame/DiffusionGitBlameQuery.php +++ b/src/applications/diffusion/query/blame/DiffusionGitBlameQuery.php @@ -28,7 +28,7 @@ $lines = phutil_split_lines($stdout); foreach ($lines as $line) { - list($commit) = explode(' ', $line, 2); + list($commit) = @explode(' ', $line, 2); $result[] = $commit; } diff --git a/src/applications/diffusion/query/blame/DiffusionMercurialBlameQuery.php b/src/applications/diffusion/query/blame/DiffusionMercurialBlameQuery.php --- a/src/applications/diffusion/query/blame/DiffusionMercurialBlameQuery.php +++ b/src/applications/diffusion/query/blame/DiffusionMercurialBlameQuery.php @@ -26,7 +26,7 @@ $lines = phutil_split_lines($stdout); foreach ($lines as $line) { - list($commit) = explode(':', $line, 2); + list($commit) = @explode(':', $line, 2); $result[] = $commit; } diff --git a/src/applications/diffusion/query/blame/DiffusionSvnBlameQuery.php b/src/applications/diffusion/query/blame/DiffusionSvnBlameQuery.php --- a/src/applications/diffusion/query/blame/DiffusionSvnBlameQuery.php +++ b/src/applications/diffusion/query/blame/DiffusionSvnBlameQuery.php @@ -23,7 +23,7 @@ $lines = phutil_split_lines($stdout); foreach ($lines as $line) { - if (preg_match('/^\s*(\d+)/', $line, $matches)) { + if (@preg_match('/^\s*(\d+)/', $line, $matches)) { $result[] = (int)$matches[1]; } else { $result[] = null; diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php --- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php +++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php @@ -16,7 +16,7 @@ } protected function executeQuery() { - if (!strlen($this->identifier)) { + if (!@strlen($this->identifier)) { throw new PhutilInvalidStateException('withIdentifier'); } @@ -91,7 +91,7 @@ $argv, gitsprintf('%s', $this->identifier)); - $parts = explode("\0", $info); + $parts = @explode("\0", $info); $encoding = array_shift($parts); foreach ($parts as $key => $part) { @@ -99,7 +99,7 @@ $part = phutil_utf8_convert($part, 'UTF-8', $encoding); } $parts[$key] = phutil_utf8ize($part); - if (!strlen($parts[$key])) { + if (!@strlen($parts[$key])) { $parts[$key] = null; } } @@ -126,11 +126,11 @@ $head = $parts[6]; $tail = $parts[7]; - if (strlen($head) && strlen($tail)) { + if (@strlen($head) && @strlen($tail)) { $body = $head."\n\n".$tail; - } else if (strlen($head)) { + } else if (@strlen($head)) { $body = $head; - } else if (strlen($tail)) { + } else if (@strlen($tail)) { $body = $tail; } else { $body = ''; @@ -158,7 +158,7 @@ '{author}\\n{desc}', hgsprintf('%s', $this->identifier)); - list($author, $message) = explode("\n", $stdout, 2); + list($author, $message) = @explode("\n", $stdout, 2); $author = phutil_utf8ize($author); $message = phutil_utf8ize($message); diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelFilesizeQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelFilesizeQuery.php --- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelFilesizeQuery.php +++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelFilesizeQuery.php @@ -11,7 +11,7 @@ } protected function executeQuery() { - if (!strlen($this->identifier)) { + if (!@strlen($this->identifier)) { throw new PhutilInvalidStateException('withIdentifier'); } @@ -54,7 +54,7 @@ } list($fields, $pathname) = array_values($path_pair); - $fields = explode(' ', $fields); + $fields = @explode(' ', $fields); // Fields are: // diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelGitRefQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelGitRefQuery.php --- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelGitRefQuery.php +++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelGitRefQuery.php @@ -49,8 +49,8 @@ } } - $branch_len = strlen($branch_prefix); - $tag_len = strlen($tag_prefix); + $branch_len = @strlen($branch_prefix); + $tag_len = @strlen($tag_prefix); list($stdout) = $repository->execxLocalCommand( 'for-each-ref --sort=%s --format=%s -- %s', @@ -59,28 +59,28 @@ $prefix); $stdout = rtrim($stdout); - if (!strlen($stdout)) { + if (!@strlen($stdout)) { return array(); } $remote_prefix = 'refs/remotes/'; - $remote_len = strlen($remote_prefix); + $remote_len = @strlen($remote_prefix); // NOTE: Although git supports --count, we can't apply any offset or // limit logic until the very end because we may encounter a HEAD which // we want to discard. - $lines = explode("\n", $stdout); + $lines = @explode("\n", $stdout); $results = array(); foreach ($lines as $line) { $fields = $this->extractFields($line); $refname = $fields['refname']; if (!strncmp($refname, $branch_prefix, $branch_len)) { - $short = substr($refname, $branch_len); + $short = @substr($refname, $branch_len); $type = $type_branch; } else if (!strncmp($refname, $tag_prefix, $tag_len)) { - $short = substr($refname, $tag_len); + $short = @substr($refname, $tag_len); $type = $type_tag; } else if (!strncmp($refname, $remote_prefix, $remote_len)) { // If we've found a remote ref that we didn't recognize as naming a @@ -105,7 +105,7 @@ $creator = $fields['creator']; $matches = null; - if (preg_match('/^(.*) ([0-9]+) ([0-9+-]+)$/', $creator, $matches)) { + if (@preg_match('/^(.*) ([0-9]+) ([0-9+-]+)$/', $creator, $matches)) { $fields['author'] = $matches[1]; $fields['epoch'] = (int)$matches[2]; } else { @@ -160,7 +160,7 @@ */ private function extractFields($line) { $fields = $this->getFields(); - $parts = explode("\1", $line, count($fields)); + $parts = @explode("\1", $line, count($fields)); $dict = array(); foreach ($fields as $index => $field) { diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelMercurialBranchesQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelMercurialBranchesQuery.php --- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelMercurialBranchesQuery.php +++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelMercurialBranchesQuery.php @@ -42,10 +42,10 @@ foreach (new FutureIterator($futures) as $key => $future) { list($stdout) = $future->resolvex(); - $lines = explode("\2", $stdout); + $lines = @explode("\2", $stdout); $lines = array_filter($lines); foreach ($lines as $line) { - list($node, $branch) = explode("\1", $line); + list($node, $branch) = @explode("\1", $line); $id = $node.'/'.$branch; if (empty($branches[$id])) { $branches[$id] = id(new DiffusionRepositoryRef()) diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelMercurialPathsQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelMercurialPathsQuery.php --- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelMercurialPathsQuery.php +++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelMercurialPathsQuery.php @@ -38,7 +38,7 @@ $hg_paths_command, hgsprintf('%s', $commit), $prefix); - return explode("\0", $entire_manifest); + return @explode("\0", $entire_manifest); } } diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php --- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php +++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php @@ -11,7 +11,7 @@ } protected function executeQuery() { - if (!strlen($this->identifier)) { + if (!@strlen($this->identifier)) { throw new PhutilInvalidStateException('withIdentifier'); } @@ -58,12 +58,12 @@ foreach ($hashes as $key => $value) { // Mercurial parents look like "23:ad9f769d6f786fad9f76d9a" -- we want // to strip out the local rev part. - list($local, $global) = explode(':', $value); + list($local, $global) = @explode(':', $value); $hashes[$key] = $global; // With --debug we get 40-character hashes but also get the "000000..." // hash for missing parents; ignore it. - if (preg_match('/^0+$/', $global)) { + if (@preg_match('/^0+$/', $global)) { unset($hashes[$key]); } } diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php --- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php +++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php @@ -72,7 +72,7 @@ // "git for-each-ref" when resolving only commit hashes, which happens // during repository updates. - if (preg_match('(^[a-f0-9]{40}\z)', $ref)) { + if (@preg_match('(^[a-f0-9]{40}\z)', $ref)) { continue; } @@ -100,7 +100,7 @@ foreach ($ref_map[$ref] as $result) { $fields = $result->getRawFields(); $objectname = idx($fields, 'refname'); - if (!strncmp($objectname, $tag_prefix, strlen($tag_prefix))) { + if (!strncmp($objectname, $tag_prefix, @strlen($tag_prefix))) { $type = 'tag'; } else { $type = 'branch'; @@ -136,7 +136,7 @@ $future->write(implode("\n", $unresolved)); list($stdout) = $future->resolvex(); - $lines = explode("\n", rtrim($stdout, "\n")); + $lines = @explode("\n", rtrim($stdout, "\n")); if (count($lines) !== count($unresolved)) { throw new Exception( pht( @@ -149,7 +149,7 @@ $lines = array_combine($unresolved, $lines); foreach ($lines as $ref => $line) { - $parts = explode(' ', $line); + $parts = @explode(' ', $line); if (count($parts) < 2) { throw new Exception( pht( @@ -282,7 +282,7 @@ $hashlike = array(); foreach ($unresolved as $key => $ref) { - if (preg_match('/^[a-f0-9]{40}\z/', $ref)) { + if (@preg_match('/^[a-f0-9]{40}\z/', $ref)) { $hashlike[$key] = $ref; } } @@ -351,13 +351,13 @@ try { list($stdout) = $future->resolvex(); } catch (CommandException $ex) { - if (preg_match('/ambiguous identifier/', $ex->getStderr())) { + if (@preg_match('/ambiguous identifier/', $ex->getStderr())) { // This indicates that the ref ambiguously matched several things. // Eventually, it would be nice to return all of them, but it is // unclear how to best do that. For now, treat it as a miss instead. continue; } - if (preg_match('/unknown revision/', $ex->getStderr())) { + if (@preg_match('/unknown revision/', $ex->getStderr())) { // No matches for this ref. continue; } diff --git a/src/applications/diffusion/query/pathid/DiffusionPathIDQuery.php b/src/applications/diffusion/query/pathid/DiffusionPathIDQuery.php --- a/src/applications/diffusion/query/pathid/DiffusionPathIDQuery.php +++ b/src/applications/diffusion/query/pathid/DiffusionPathIDQuery.php @@ -84,7 +84,7 @@ public static function expandPathToRoot($path) { $path = self::normalizePath($path); $parents = array($path); - $parts = explode('/', trim($path, '/')); + $parts = @explode('/', trim($path, '/')); while (count($parts) >= 1) { if (array_pop($parts)) { $parents[] = '/'.implode('/', $parts); diff --git a/src/applications/diffusion/query/rawdiff/DiffusionGitRawDiffQuery.php b/src/applications/diffusion/query/rawdiff/DiffusionGitRawDiffQuery.php --- a/src/applications/diffusion/query/rawdiff/DiffusionGitRawDiffQuery.php +++ b/src/applications/diffusion/query/rawdiff/DiffusionGitRawDiffQuery.php @@ -27,7 +27,7 @@ '--format=%P', gitsprintf('%s', $commit)); - if (strlen(trim($parents))) { + if (@strlen(trim($parents))) { $against = $commit.'^'; } else { $against = ArcanistGitAPI::GIT_MAGIC_ROOT_COMMIT; @@ -35,7 +35,7 @@ } $path = $drequest->getPath(); - if (!strlen($path)) { + if (!@strlen($path)) { $path = '.'; } diff --git a/src/applications/diffusion/remarkup/DiffusionSourceLinkRemarkupRule.php b/src/applications/diffusion/remarkup/DiffusionSourceLinkRemarkupRule.php --- a/src/applications/diffusion/remarkup/DiffusionSourceLinkRemarkupRule.php +++ b/src/applications/diffusion/remarkup/DiffusionSourceLinkRemarkupRule.php @@ -78,7 +78,7 @@ '(?P.*)'. '\z)'; $matches = null; - if (!preg_match($pattern, $input, $matches)) { + if (!@preg_match($pattern, $input, $matches)) { $hint_text = pht( 'Missing path, expected "{src path ...}" in: %s', $raw); @@ -89,12 +89,12 @@ } $path = idx($matches, 'rawpath'); - if (!strlen($path)) { + if (!@strlen($path)) { $path = idx($matches, 'quotedpath'); $path = stripcslashes($path); } - $parts = explode(':', $path, 2); + $parts = @explode(':', $path, 2); if (count($parts) == 2) { $repository = nonempty($parts[0], null); $path = $parts[1]; diff --git a/src/applications/diffusion/request/DiffusionGitRequest.php b/src/applications/diffusion/request/DiffusionGitRequest.php --- a/src/applications/diffusion/request/DiffusionGitRequest.php +++ b/src/applications/diffusion/request/DiffusionGitRequest.php @@ -3,7 +3,7 @@ final class DiffusionGitRequest extends DiffusionRequest { protected function isStableCommit($symbol) { - return preg_match('/^[a-f0-9]{40}\z/', $symbol); + return @preg_match('/^[a-f0-9]{40}\z/', $symbol); } public function getBranch() { diff --git a/src/applications/diffusion/request/DiffusionMercurialRequest.php b/src/applications/diffusion/request/DiffusionMercurialRequest.php --- a/src/applications/diffusion/request/DiffusionMercurialRequest.php +++ b/src/applications/diffusion/request/DiffusionMercurialRequest.php @@ -3,7 +3,7 @@ final class DiffusionMercurialRequest extends DiffusionRequest { protected function isStableCommit($symbol) { - return preg_match('/^[a-f0-9]{40}\z/', $symbol); + return @preg_match('/^[a-f0-9]{40}\z/', $symbol); } public function getBranch() { diff --git a/src/applications/diffusion/request/DiffusionRequest.php b/src/applications/diffusion/request/DiffusionRequest.php --- a/src/applications/diffusion/request/DiffusionRequest.php +++ b/src/applications/diffusion/request/DiffusionRequest.php @@ -207,7 +207,7 @@ */ private function initializeFromDictionary(array $data) { $blob = idx($data, 'blob'); - if (strlen($blob)) { + if (@strlen($blob)) { $blob = self::parseRequestBlob($blob, $this->supportsBranches()); $data = $blob + $data; } @@ -483,9 +483,9 @@ if ($supports_branches) { // Consume the front part of the URI, up to the first "/". This is the // path-component encoded branch name. - if (preg_match('@^([^/]+)/@', $blob, $matches)) { + if (@preg_match('@^([^/]+)/@', $blob, $matches)) { $result['branch'] = phutil_unescape_uri_path_component($matches[1]); - $blob = substr($blob, strlen($matches[1]) + 1); + $blob = @substr($blob, @strlen($matches[1]) + 1); } } @@ -493,9 +493,9 @@ // lookbehind to prevent matching '$$'. We double the '$' symbol when // encoding so that files with names like "money/$100" will survive. $pattern = '@(?:(?:^|[^$])(?:[$][$])*)[$]([\d,-]+)$@'; - if (preg_match($pattern, $blob, $matches)) { + if (@preg_match($pattern, $blob, $matches)) { $result['line'] = $matches[1]; - $blob = substr($blob, 0, -(strlen($matches[1]) + 1)); + $blob = @substr($blob, 0, -(@strlen($matches[1]) + 1)); } // We've consumed the line number if it exists, so unescape "$" in the @@ -505,20 +505,20 @@ // Consume the commit name, stopping on ';;'. We allow any character to // appear in commits names, as they can sometimes be symbolic names (like // tag names or refs). - if (preg_match('@(?:(?:^|[^;])(?:;;)*);([^;].*)$@', $blob, $matches)) { + if (@preg_match('@(?:(?:^|[^;])(?:;;)*);([^;].*)$@', $blob, $matches)) { $result['commit'] = $matches[1]; - $blob = substr($blob, 0, -(strlen($matches[1]) + 1)); + $blob = @substr($blob, 0, -(@strlen($matches[1]) + 1)); } // We've consumed the commit if it exists, so unescape ";" in the rest // of the string. $blob = str_replace(';;', ';', $blob); - if (strlen($blob)) { + if (@strlen($blob)) { $result['path'] = $blob; } - $parts = explode('/', $result['path']); + $parts = @explode('/', $result['path']); foreach ($parts as $part) { // Prevent any hyjinx since we're ultimately shipping this to the // filesystem under a lot of workflows. diff --git a/src/applications/diffusion/request/DiffusionSvnRequest.php b/src/applications/diffusion/request/DiffusionSvnRequest.php --- a/src/applications/diffusion/request/DiffusionSvnRequest.php +++ b/src/applications/diffusion/request/DiffusionSvnRequest.php @@ -3,7 +3,7 @@ final class DiffusionSvnRequest extends DiffusionRequest { protected function isStableCommit($symbol) { - return preg_match('/^[1-9]\d*\z/', $symbol); + return @preg_match('/^[1-9]\d*\z/', $symbol); } protected function didInitialize() { diff --git a/src/applications/diffusion/response/DiffusionGitResponse.php b/src/applications/diffusion/response/DiffusionGitResponse.php --- a/src/applications/diffusion/response/DiffusionGitResponse.php +++ b/src/applications/diffusion/response/DiffusionGitResponse.php @@ -7,18 +7,18 @@ private $response; public function setGitData($data) { - list($headers, $body) = explode("\r\n\r\n", $data, 2); + list($headers, $body) = @explode("\r\n\r\n", $data, 2); $this->response = $body; - $headers = explode("\r\n", $headers); + $headers = @explode("\r\n", $headers); $matches = null; $this->httpCode = 200; $this->headers = array(); foreach ($headers as $header) { - if (preg_match('/^Status:\s*(\d+)/i', $header, $matches)) { + if (@preg_match('/^Status:\s*(\d+)/i', $header, $matches)) { $this->httpCode = (int)$matches[1]; } else { - $this->headers[] = explode(': ', $header, 2); + $this->headers[] = @explode(': ', $header, 2); } } diff --git a/src/applications/diffusion/ssh/DiffusionGitSSHWorkflow.php b/src/applications/diffusion/ssh/DiffusionGitSSHWorkflow.php --- a/src/applications/diffusion/ssh/DiffusionGitSSHWorkflow.php +++ b/src/applications/diffusion/ssh/DiffusionGitSSHWorkflow.php @@ -102,7 +102,7 @@ PhabricatorSSHPassthruCommand $command, $message) { - $this->ioBytesWritten += strlen($message); + $this->ioBytesWritten += @strlen($message); $log = $this->getProtocolLog(); if ($log) { @@ -135,7 +135,7 @@ // layer. This means the underlying command might emit bytes, but if they // are buffered by the protocol layer they won't count as read bytes yet. - $this->ioBytesRead += strlen($message); + $this->ioBytesRead += @strlen($message); return $message; } diff --git a/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php b/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php --- a/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php +++ b/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php @@ -32,28 +32,28 @@ } private function readProtocolLine() { - $pos = strpos($this->buffer, "\n"); + $pos = @strpos($this->buffer, "\n"); if ($pos === false) { return null; } - $line = substr($this->buffer, 0, $pos); + $line = @substr($this->buffer, 0, $pos); $this->raw .= $line."\n"; - $this->buffer = substr($this->buffer, $pos + 1); + $this->buffer = @substr($this->buffer, $pos + 1); return $line; } private function readProtocolBytes() { - if (strlen($this->buffer) < $this->expectBytes) { + if (@strlen($this->buffer) < $this->expectBytes) { return null; } - $bytes = substr($this->buffer, 0, $this->expectBytes); + $bytes = @substr($this->buffer, 0, $this->expectBytes); $this->raw .= $bytes; - $this->buffer = substr($this->buffer, $this->expectBytes); + $this->buffer = @substr($this->buffer, $this->expectBytes); return $bytes; } @@ -71,7 +71,7 @@ private function newDataMessage($bytes) { $message = array( 'command' => '', - 'raw' => strlen($bytes)."\n".$bytes, + 'raw' => @strlen($bytes)."\n".$bytes, ); return $message; } @@ -125,7 +125,7 @@ break; } - list($arg, $size) = explode(' ', $line, 2); + list($arg, $size) = @explode(' ', $line, 2); $size = (int)$size; if ($arg != '*') { @@ -168,7 +168,7 @@ break; } - list($arg, $size) = explode(' ', $line, 2); + list($arg, $size) = @explode(' ', $line, 2); $size = (int)$size; $this->expectBytes = $size; @@ -207,13 +207,13 @@ // If we don't have any more bytes on the buffer yet, just bail: // otherwise, we'll emit a pointless and possibly harmful 0-byte data // frame. See T13036 for discussion. - if (!strlen($this->buffer)) { + if (!@strlen($this->buffer)) { break; } - $bytes = substr($this->buffer, 0, $this->expectBytes); - $this->buffer = substr($this->buffer, strlen($bytes)); - $this->expectBytes -= strlen($bytes); + $bytes = @substr($this->buffer, 0, $this->expectBytes); + $this->buffer = @substr($this->buffer, @strlen($bytes)); + $this->expectBytes -= @strlen($bytes); // NOTE: We emit a data frame as soon as we read some data. This can // cause us to repackage frames: for example, if we receive one large diff --git a/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php b/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php --- a/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php +++ b/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php @@ -96,7 +96,7 @@ $in_message = $io_channel->read(); if ($in_message !== null) { $this->peekBuffer .= $in_message; - if (strlen($this->peekBuffer) > (1024 * 1024)) { + if (@strlen($this->peekBuffer) > (1024 * 1024)) { throw new Exception( pht( 'Client transmitted more than 1MB of data without transmitting '. @@ -375,7 +375,7 @@ // Subversion presumably deals with this, but make sure there's nothing // sketchy going on with the URI. - if (preg_match('(/\\.\\./)', $path)) { + if (@preg_match('(/\\.\\./)', $path)) { throw new Exception( pht( 'String "%s" is invalid in path specification "%s".', @@ -403,7 +403,7 @@ // Replace "/diffusion/X" in the request with the repository local path, // so "/diffusion/X/master/" becomes "/path/to/repository/X/master/". $local_path = rtrim($repository->getLocalPath(), '/'); - $path = $local_path.substr($path, strlen($external_base)); + $path = $local_path.@substr($path, @strlen($external_base)); // NOTE: We are intentionally NOT removing username information from the // URI. Subversion retains it over the course of the request and considers @@ -437,8 +437,8 @@ $internal = $this->internalBaseURI; $external = $this->externalBaseURI; - if (strncmp($uri, $internal, strlen($internal)) === 0) { - $uri = $external.substr($uri, strlen($internal)); + if (strncmp($uri, $internal, @strlen($internal)) === 0) { + $uri = $external.@substr($uri, @strlen($internal)); } return $uri; diff --git a/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php b/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php --- a/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php +++ b/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php @@ -7,7 +7,7 @@ $dir = Filesystem::listDirectory($data, $include_hidden = false); foreach ($dir as $file) { $raw = Filesystem::readFile($data.$file); - $raw = explode("\n~~~~~~~~~~\n", $raw, 2); + $raw = @explode("\n~~~~~~~~~~\n", $raw, 2); $this->assertEqual(2, count($raw)); $expect = phutil_json_decode($raw[1]); $this->assertTrue(is_array($expect), $file); diff --git a/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php b/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php --- a/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php +++ b/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php @@ -41,7 +41,7 @@ $parts[] = $name; $slug = $repository->getRepositorySlug(); - if (strlen($slug)) { + if (@strlen($slug)) { $parts[] = $slug; } diff --git a/src/applications/diffusion/typeahead/DiffusionSymbolDatasource.php b/src/applications/diffusion/typeahead/DiffusionSymbolDatasource.php --- a/src/applications/diffusion/typeahead/DiffusionSymbolDatasource.php +++ b/src/applications/diffusion/typeahead/DiffusionSymbolDatasource.php @@ -27,7 +27,7 @@ $results = array(); - if (strlen($raw_query)) { + if (@strlen($raw_query)) { $symbols = id(new DiffusionSymbolQuery()) ->setViewer($viewer) ->setNamePrefix($raw_query) diff --git a/src/applications/diffusion/view/DiffusionPatternSearchView.php b/src/applications/diffusion/view/DiffusionPatternSearchView.php --- a/src/applications/diffusion/view/DiffusionPatternSearchView.php +++ b/src/applications/diffusion/view/DiffusionPatternSearchView.php @@ -42,12 +42,12 @@ } else { $output = array(); $cursor = 0; - $length = strlen($string); + $length = @strlen($string); foreach ($matches[0] as $match) { $offset = $match[1]; if ($cursor != $offset) { $output[] = array( - 'text' => substr($string, $cursor, ($offset - $cursor)), + 'text' => @substr($string, $cursor, ($offset - $cursor)), 'highlight' => false, ); } @@ -55,11 +55,11 @@ 'text' => $match[0], 'highlight' => true, ); - $cursor = $offset + strlen($match[0]); + $cursor = $offset + @strlen($match[0]); } if ($cursor != $length) { $output[] = array( - 'text' => substr($string, $cursor), + 'text' => @substr($string, $cursor), 'highlight' => false, ); } diff --git a/src/applications/diffusion/view/DiffusionReadmeView.php b/src/applications/diffusion/view/DiffusionReadmeView.php --- a/src/applications/diffusion/view/DiffusionReadmeView.php +++ b/src/applications/diffusion/view/DiffusionReadmeView.php @@ -35,7 +35,7 @@ return 'remarkup'; } - $ext = last(explode('.', $path)); + $ext = last(@explode('.', $path)); switch ($ext) { case 'remarkup': case 'md': diff --git a/src/applications/diffusion/view/DiffusionSourceLinkView.php b/src/applications/diffusion/view/DiffusionSourceLinkView.php --- a/src/applications/diffusion/view/DiffusionSourceLinkView.php +++ b/src/applications/diffusion/view/DiffusionSourceLinkView.php @@ -162,7 +162,7 @@ $icon = 'fa-file-text-o'; $text = $this->getText(); - if (!strlen($text)) { + if (!@strlen($text)) { $path = $this->getDisplayPath(); $line = $this->getDisplayLine(); diff --git a/src/applications/diffusion/view/DiffusionView.php b/src/applications/diffusion/view/DiffusionView.php --- a/src/applications/diffusion/view/DiffusionView.php +++ b/src/applications/diffusion/view/DiffusionView.php @@ -71,7 +71,7 @@ $display_name = idx($details, 'name'); unset($details['name']); - if (strlen($display_name)) { + if (@strlen($display_name)) { $display_name = phutil_tag( 'span', array( @@ -144,7 +144,7 @@ $commit_name = $repository->formatCommitName($commit, $local = true); - if (strlen($summary)) { + if (@strlen($summary)) { $commit_name .= ': '.$summary; } diff --git a/src/applications/diviner/atom/DivinerAtomRef.php b/src/applications/diviner/atom/DivinerAtomRef.php --- a/src/applications/diviner/atom/DivinerAtomRef.php +++ b/src/applications/diviner/atom/DivinerAtomRef.php @@ -43,7 +43,7 @@ public function setName($name) { $normal_name = self::normalizeString($name); - if (preg_match('/^@\d+\z/', $normal_name)) { + if (@preg_match('/^@\d+\z/', $normal_name)) { throw new Exception( pht( "Atom names must not be in the form '%s'. This pattern is ". diff --git a/src/applications/diviner/atomizer/DivinerArticleAtomizer.php b/src/applications/diviner/atomizer/DivinerArticleAtomizer.php --- a/src/applications/diviner/atomizer/DivinerArticleAtomizer.php +++ b/src/applications/diviner/atomizer/DivinerArticleAtomizer.php @@ -5,7 +5,7 @@ protected function executeAtomize($file_name, $file_data) { $atom = $this->newAtom(DivinerAtom::TYPE_ARTICLE) ->setLine(1) - ->setLength(count(explode("\n", $file_data))) + ->setLength(count(@explode("\n", $file_data))) ->setLanguage('human'); $block = "/**\n".str_replace("\n", "\n * ", $file_data)."\n */"; @@ -14,7 +14,7 @@ $meta = $atom->getDocblockMeta(); $title = idx($meta, 'title'); - if (!strlen($title)) { + if (!@strlen($title)) { $title = pht('Untitled Article "%s"', basename($file_name)); $atom->addWarning(pht('Article has no %s!', '@title')); $atom->setDocblockMetaValue('title', $title); diff --git a/src/applications/diviner/atomizer/DivinerPHPAtomizer.php b/src/applications/diviner/atomizer/DivinerPHPAtomizer.php --- a/src/applications/diviner/atomizer/DivinerPHPAtomizer.php +++ b/src/applications/diviner/atomizer/DivinerPHPAtomizer.php @@ -89,7 +89,7 @@ $attributes = $attribute_list->selectDescendantsOfType('n_STRING'); if ($attributes) { foreach ($attributes as $attribute) { - $attr = strtolower($attribute->getConcreteString()); + $attr = @strtolower($attribute->getConcreteString()); switch ($attr) { case 'final': case 'abstract': @@ -209,7 +209,7 @@ if ($prev && $prev->isComment()) { $value = $prev->getValue(); $matches = null; - if (preg_match('/@(return|param|task|author)/', $value, $matches)) { + if (@preg_match('/@(return|param|task|author)/', $value, $matches)) { $atom->addWarning( pht( 'Atom "%s" is preceded by a comment containing `%s`, but '. @@ -243,7 +243,7 @@ // get rid of the `$num` part (which Diviner considers optional). If it // is present and different from the declared name, raise a warning. $matches = null; - if (preg_match('/^(\\$\S+)\s+/', $docs, $matches)) { + if (@preg_match('/^(\\$\S+)\s+/', $docs, $matches)) { if ($name !== null) { if ($matches[1] !== $name) { $atom->addWarning( @@ -254,7 +254,7 @@ $matches[1])); } } - $docs = substr($docs, strlen($matches[0])); + $docs = @substr($docs, @strlen($matches[0])); } $dict['docs'] = $docs; diff --git a/src/applications/diviner/cache/DivinerDiskCache.php b/src/applications/diviner/cache/DivinerDiskCache.php --- a/src/applications/diviner/cache/DivinerDiskCache.php +++ b/src/applications/diviner/cache/DivinerDiskCache.php @@ -33,9 +33,9 @@ return implode( '/', array( - substr($hash, 0, 2), - substr($hash, 2, 2), - substr($hash, 4, 8), + @substr($hash, 0, 2), + @substr($hash, 2, 2), + @substr($hash, 4, 8), )); } diff --git a/src/applications/diviner/controller/DivinerAtomController.php b/src/applications/diviner/controller/DivinerAtomController.php --- a/src/applications/diviner/controller/DivinerAtomController.php +++ b/src/applications/diviner/controller/DivinerAtomController.php @@ -165,7 +165,7 @@ $item = $this->renderFullSignature($atom, true); - if (strlen($atom->getSummary())) { + if (@strlen($atom->getSummary())) { $item = array( $item, " \xE2\x80\x94 ", @@ -437,7 +437,7 @@ $tasks = $symbol->getAtom()->getDocblockMetaValue('task'); if (!is_array($tasks)) { - if (strlen($tasks)) { + if (@strlen($tasks)) { $tasks = array($tasks); } else { $tasks = array(); @@ -446,7 +446,7 @@ if ($tasks) { foreach ($tasks as $task) { - list($name, $title) = explode(' ', $task, 2); + list($name, $title) = @explode(' ', $task, 2); $name = trim($name); $title = trim($title); @@ -622,7 +622,7 @@ $field = 'default'; $content = $engine->getOutput($symbol, $field); - if (strlen(trim($symbol->getMarkupText($field)))) { + if (@strlen(trim($symbol->getMarkupText($field)))) { $content = phutil_tag( 'div', array( @@ -656,7 +656,7 @@ foreach ($symbols as $key => $symbol) { $impl = $implementations[$key]; if ($impl !== $parent) { - if (!strlen(trim($symbol->getMarkupText($field)))) { + if (!@strlen(trim($symbol->getMarkupText($field)))) { continue; } } diff --git a/src/applications/diviner/controller/DivinerBookController.php b/src/applications/diviner/controller/DivinerBookController.php --- a/src/applications/diviner/controller/DivinerBookController.php +++ b/src/applications/diviner/controller/DivinerBookController.php @@ -74,7 +74,7 @@ $out = array(); foreach ($groups as $group => $atoms) { $group_name = $book->getGroupName($group); - if (!strlen($group_name)) { + if (!@strlen($group_name)) { $group_name = pht('Free Radicals'); } $section = id(new DivinerSectionView()) @@ -85,7 +85,7 @@ $preface = $book->getPreface(); $preface_view = null; - if (strlen($preface)) { + if (@strlen($preface)) { $preface_view = new PHUIRemarkupView($viewer, $preface); } diff --git a/src/applications/diviner/controller/DivinerFindController.php b/src/applications/diviner/controller/DivinerFindController.php --- a/src/applications/diviner/controller/DivinerFindController.php +++ b/src/applications/diviner/controller/DivinerFindController.php @@ -32,12 +32,12 @@ } $context = $request->getStr('context'); - if (strlen($context)) { + if (@strlen($context)) { $query->withContexts(array($context)); } $type = $request->getStr('type'); - if (strlen($type)) { + if (@strlen($type)) { $query->withTypes(array($type)); } diff --git a/src/applications/diviner/markup/DivinerSymbolRemarkupRule.php b/src/applications/diviner/markup/DivinerSymbolRemarkupRule.php --- a/src/applications/diviner/markup/DivinerSymbolRemarkupRule.php +++ b/src/applications/diviner/markup/DivinerSymbolRemarkupRule.php @@ -49,16 +49,16 @@ $ref = array(); - if (strpos($type, '@') !== false) { - list($type, $book) = explode('@', $type, 2); + if (@strpos($type, '@') !== false) { + list($type, $book) = @explode('@', $type, 2); $ref['type'] = trim($type); $ref['book'] = trim($book); } else { $ref['type'] = $type; } - if (strpos($name, '@') !== false) { - list($name, $context) = explode('@', $name, 2); + if (@strpos($name, '@') !== false) { + list($name, $context) = @explode('@', $name, 2); $ref['name'] = trim($name); $ref['context'] = trim($context); } else { diff --git a/src/applications/diviner/query/DivinerBookQuery.php b/src/applications/diviner/query/DivinerBookQuery.php --- a/src/applications/diviner/query/DivinerBookQuery.php +++ b/src/applications/diviner/query/DivinerBookQuery.php @@ -133,7 +133,7 @@ $this->phids); } - if (strlen($this->nameLike)) { + if (@strlen($this->nameLike)) { $where[] = qsprintf( $conn, 'name LIKE %~', @@ -147,7 +147,7 @@ $this->names); } - if (strlen($this->namePrefix)) { + if (@strlen($this->namePrefix)) { $where[] = qsprintf( $conn, 'name LIKE %>', diff --git a/src/applications/diviner/renderer/DivinerDefaultRenderer.php b/src/applications/diviner/renderer/DivinerDefaultRenderer.php --- a/src/applications/diviner/renderer/DivinerDefaultRenderer.php +++ b/src/applications/diviner/renderer/DivinerDefaultRenderer.php @@ -197,7 +197,7 @@ } public function normalizeAtomRef(DivinerAtomRef $ref) { - if (!strlen($ref->getBook())) { + if (!@strlen($ref->getBook())) { $ref->setBook($this->getConfig('name')); } diff --git a/src/applications/diviner/storage/DivinerLiveSymbol.php b/src/applications/diviner/storage/DivinerLiveSymbol.php --- a/src/applications/diviner/storage/DivinerLiveSymbol.php +++ b/src/applications/diviner/storage/DivinerLiveSymbol.php @@ -172,7 +172,7 @@ public function getTitle() { $title = parent::getTitle(); - if (!strlen($title)) { + if (!@strlen($title)) { $title = $this->getName(); } @@ -182,7 +182,7 @@ public function setTitle($value) { $this->writeField('title', $value); - if (strlen($value)) { + if (@strlen($value)) { $slug = DivinerAtomRef::normalizeTitleString($value); $hash = PhabricatorHash::digestForIndex($slug); $this->titleSlugHash = $hash; diff --git a/src/applications/diviner/workflow/DivinerAtomizeWorkflow.php b/src/applications/diviner/workflow/DivinerAtomizeWorkflow.php --- a/src/applications/diviner/workflow/DivinerAtomizeWorkflow.php +++ b/src/applications/diviner/workflow/DivinerAtomizeWorkflow.php @@ -93,7 +93,7 @@ $context['group'] = null; foreach ($group_rules as $rule => $group) { - if (preg_match($rule, $file)) { + if (@preg_match($rule, $file)) { $context['group'] = $group; break; } @@ -135,7 +135,7 @@ } private function shouldAtomizeFile($file_name, $file_data) { - return strpos($file_data, '@'.'undivinable') === false; + return @strpos($file_data, '@'.'undivinable') === false; } } diff --git a/src/applications/diviner/workflow/DivinerGenerateWorkflow.php b/src/applications/diviner/workflow/DivinerGenerateWorkflow.php --- a/src/applications/diviner/workflow/DivinerGenerateWorkflow.php +++ b/src/applications/diviner/workflow/DivinerGenerateWorkflow.php @@ -194,7 +194,7 @@ $identifier = $args->getArg('repository'); $repository = null; - if (strlen($identifier)) { + if (@strlen($identifier)) { $repository = id(new PhabricatorRepositoryQuery()) ->setViewer(PhabricatorUser::getOmnipotentUser()) ->withIdentifiers(array($identifier)) @@ -264,13 +264,13 @@ foreach ($files as $file) { foreach ($exclude as $pattern) { - if (preg_match($pattern, $file)) { + if (@preg_match($pattern, $file)) { continue 2; } } foreach ($rules as $rule => $atomizer) { - $ok = preg_match($rule, $file); + $ok = @preg_match($rule, $file); if ($ok === false) { throw new Exception( pht("Rule '%s' is not a valid regular expression.", $rule)); diff --git a/src/applications/diviner/workflow/DivinerWorkflow.php b/src/applications/diviner/workflow/DivinerWorkflow.php --- a/src/applications/diviner/workflow/DivinerWorkflow.php +++ b/src/applications/diviner/workflow/DivinerWorkflow.php @@ -50,7 +50,7 @@ } $book['root'] = Filesystem::resolvePath($book['root'], $full_path); - if (!preg_match('/^[a-z][a-z-]*\z/', $book['name'])) { + if (!@preg_match('/^[a-z][a-z-]*\z/', $book['name'])) { $name = $book['name']; throw new PhutilArgumentUsageException( pht( diff --git a/src/applications/doorkeeper/bridge/DoorkeeperBridgeGitHub.php b/src/applications/doorkeeper/bridge/DoorkeeperBridgeGitHub.php --- a/src/applications/doorkeeper/bridge/DoorkeeperBridgeGitHub.php +++ b/src/applications/doorkeeper/bridge/DoorkeeperBridgeGitHub.php @@ -31,7 +31,7 @@ protected function parseGitHubIssueID($id) { $matches = null; - if (!preg_match('(^([^/]+)/([^/]+)#([1-9]\d*)\z)', $id, $matches)) { + if (!@preg_match('(^([^/]+)/([^/]+)#([1-9]\d*)\z)', $id, $matches)) { throw new Exception( pht( 'GitHub Issue ID "%s" is not properly formatted. Expected an ID '. diff --git a/src/applications/doorkeeper/bridge/DoorkeeperBridgeGitHubIssue.php b/src/applications/doorkeeper/bridge/DoorkeeperBridgeGitHubIssue.php --- a/src/applications/doorkeeper/bridge/DoorkeeperBridgeGitHubIssue.php +++ b/src/applications/doorkeeper/bridge/DoorkeeperBridgeGitHubIssue.php @@ -19,7 +19,7 @@ public function pullRefs(array $refs) { $token = $this->getGitHubAccessToken(); - if (!strlen($token)) { + if (!@strlen($token)) { return null; } diff --git a/src/applications/doorkeeper/bridge/DoorkeeperBridgeGitHubUser.php b/src/applications/doorkeeper/bridge/DoorkeeperBridgeGitHubUser.php --- a/src/applications/doorkeeper/bridge/DoorkeeperBridgeGitHubUser.php +++ b/src/applications/doorkeeper/bridge/DoorkeeperBridgeGitHubUser.php @@ -19,7 +19,7 @@ public function pullRefs(array $refs) { $token = $this->getGitHubAccessToken(); - if (!strlen($token)) { + if (!@strlen($token)) { return null; } diff --git a/src/applications/doorkeeper/bridge/DoorkeeperBridgeJIRA.php b/src/applications/doorkeeper/bridge/DoorkeeperBridgeJIRA.php --- a/src/applications/doorkeeper/bridge/DoorkeeperBridgeJIRA.php +++ b/src/applications/doorkeeper/bridge/DoorkeeperBridgeJIRA.php @@ -147,7 +147,7 @@ return null; } - $path = substr($path, 0, $pos); + $path = @substr($path, 0, $pos); $path = $path.'browse/'.$object_id; $uri->setPath($path); diff --git a/src/applications/draft/storage/PhabricatorDraft.php b/src/applications/draft/storage/PhabricatorDraft.php --- a/src/applications/draft/storage/PhabricatorDraft.php +++ b/src/applications/draft/storage/PhabricatorDraft.php @@ -50,7 +50,7 @@ } public static function newFromUserAndKey(PhabricatorUser $user, $key) { - if ($user->getPHID() && strlen($key)) { + if ($user->getPHID() && @strlen($key)) { $draft = id(new PhabricatorDraft())->loadOneWhere( 'authorPHID = %s AND draftKey = %s', $user->getPHID(), diff --git a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php --- a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php +++ b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php @@ -223,7 +223,7 @@ $root_key = 'workingcopy.root'; $root = $resource->getAttribute($root_key); - if (strlen($root)) { + if (@strlen($root)) { $interface->execx('rm -rf -- %s', $root); } } diff --git a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php --- a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php +++ b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php @@ -41,7 +41,7 @@ } $until = $args->getArg('until'); - if (strlen($until)) { + if (@strlen($until)) { $until = strtotime($until); if ($until <= 0) { throw new PhutilArgumentUsageException( @@ -52,7 +52,7 @@ } $attributes_file = $args->getArg('attributes'); - if (strlen($attributes_file)) { + if (@strlen($attributes_file)) { if ($attributes_file == '-') { echo tsprintf( "%s\n", diff --git a/src/applications/drydock/operation/DrydockLandRepositoryOperation.php b/src/applications/drydock/operation/DrydockLandRepositoryOperation.php --- a/src/applications/drydock/operation/DrydockLandRepositoryOperation.php +++ b/src/applications/drydock/operation/DrydockLandRepositoryOperation.php @@ -96,7 +96,7 @@ } $target = $operation->getRepositoryTarget(); - list($type, $name) = explode(':', $target, 2); + list($type, $name) = @explode(':', $target, 2); switch ($type) { case 'branch': $push_dst = 'refs/heads/'.$name; @@ -178,7 +178,7 @@ } } - if (!strlen($committer_name)) { + if (!@strlen($committer_name)) { $committer_name = pht('autocommitter'); } diff --git a/src/applications/drydock/worker/DrydockRepositoryOperationUpdateWorker.php b/src/applications/drydock/worker/DrydockRepositoryOperationUpdateWorker.php --- a/src/applications/drydock/worker/DrydockRepositoryOperationUpdateWorker.php +++ b/src/applications/drydock/worker/DrydockRepositoryOperationUpdateWorker.php @@ -157,7 +157,7 @@ $repository = $operation->getRepository(); $target = $operation->getRepositoryTarget(); - list($type, $name) = explode(':', $target, 2); + list($type, $name) = @explode(':', $target, 2); switch ($type) { case 'branch': $spec = array( diff --git a/src/applications/drydock/xaction/DrydockBlueprintNameTransaction.php b/src/applications/drydock/xaction/DrydockBlueprintNameTransaction.php --- a/src/applications/drydock/xaction/DrydockBlueprintNameTransaction.php +++ b/src/applications/drydock/xaction/DrydockBlueprintNameTransaction.php @@ -46,7 +46,7 @@ foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('Blueprint names can be no longer than %s characters.', diff --git a/src/applications/fact/chart/PhabricatorChartFunctionArgumentParser.php b/src/applications/fact/chart/PhabricatorChartFunctionArgumentParser.php --- a/src/applications/fact/chart/PhabricatorChartFunctionArgumentParser.php +++ b/src/applications/fact/chart/PhabricatorChartFunctionArgumentParser.php @@ -29,7 +29,7 @@ public function addArgument(PhabricatorChartFunctionArgument $spec) { $name = $spec->getName(); - if (!strlen($name)) { + if (!@strlen($name)) { throw new Exception( pht( 'Chart function "%s" emitted an argument specification with no '. @@ -38,7 +38,7 @@ } $type = $spec->getType(); - if (!strlen($type)) { + if (!@strlen($type)) { throw new Exception( pht( 'Chart function "%s" emitted an argument specification ("%s") with '. diff --git a/src/applications/fact/extract/PhabricatorFactUpdateIterator.php b/src/applications/fact/extract/PhabricatorFactUpdateIterator.php --- a/src/applications/fact/extract/PhabricatorFactUpdateIterator.php +++ b/src/applications/fact/extract/PhabricatorFactUpdateIterator.php @@ -40,7 +40,7 @@ protected function loadPage() { if ($this->object->hasProperty('dateModified')) { if ($this->cursor) { - list($after_epoch, $after_id) = explode(':', $this->cursor); + list($after_epoch, $after_id) = @explode(':', $this->cursor); } else { $after_epoch = 0; $after_id = 0; diff --git a/src/applications/fact/fact/PhabricatorFact.php b/src/applications/fact/fact/PhabricatorFact.php --- a/src/applications/fact/fact/PhabricatorFact.php +++ b/src/applications/fact/fact/PhabricatorFact.php @@ -42,13 +42,13 @@ $argv = array(); - if (preg_match('/\.project\z/', $key)) { + if (@preg_match('/\.project\z/', $key)) { $argv[] = id(new PhabricatorChartFunctionArgument()) ->setName('phid') ->setType('phid'); } - if (preg_match('/\.owner\z/', $key)) { + if (@preg_match('/\.owner\z/', $key)) { $argv[] = id(new PhabricatorChartFunctionArgument()) ->setName('phid') ->setType('phid'); diff --git a/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php b/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php --- a/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php +++ b/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php @@ -80,12 +80,12 @@ ->setPageSize($limit); $after = $request->getValue('after'); - if (strlen($after)) { + if (@strlen($after)) { $pager->setAfterID($after); } $before = $request->getValue('before'); - if (strlen($before)) { + if (@strlen($before)) { $pager->setBeforeID($before); } diff --git a/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php b/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php --- a/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php +++ b/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php @@ -15,7 +15,7 @@ $username = $user->getUsername(); $image_map = $this->getMap('image'); - $initial = phutil_utf8_strtoupper(substr($username, 0, 1)); + $initial = phutil_utf8_strtoupper(@substr($username, 0, 1)); $pack = $this->pickMap('pack', $username); $icon = "alphanumeric/{$pack}/{$initial}.png"; if (!isset($image_map[$icon])) { diff --git a/src/applications/files/conduit/FileAllocateConduitAPIMethod.php b/src/applications/files/conduit/FileAllocateConduitAPIMethod.php --- a/src/applications/files/conduit/FileAllocateConduitAPIMethod.php +++ b/src/applications/files/conduit/FileAllocateConduitAPIMethod.php @@ -65,7 +65,7 @@ ->executeOne(); } - if (strlen($name) && !$hash && !$file) { + if (@strlen($name) && !$hash && !$file) { if ($length > PhabricatorFileStorageEngine::getChunkThreshold()) { // If we don't have a hash, but this file is large enough to store in // chunks and thus may be resumable, try to find a partially uploaded diff --git a/src/applications/files/conduit/FileUploadChunkConduitAPIMethod.php b/src/applications/files/conduit/FileUploadChunkConduitAPIMethod.php --- a/src/applications/files/conduit/FileUploadChunkConduitAPIMethod.php +++ b/src/applications/files/conduit/FileUploadChunkConduitAPIMethod.php @@ -43,7 +43,7 @@ default: throw new Exception(pht('Unsupported data encoding.')); } - $length = strlen($data); + $length = @strlen($data); $chunk = $this->loadFileChunkForUpload( $viewer, diff --git a/src/applications/files/controller/PhabricatorFileDataController.php b/src/applications/files/controller/PhabricatorFileDataController.php --- a/src/applications/files/controller/PhabricatorFileDataController.php +++ b/src/applications/files/controller/PhabricatorFileDataController.php @@ -29,7 +29,7 @@ $request_kind = $request->getURIData('kind'); $is_download = ($request_kind === 'download'); - if (!strlen($alt) || $main_domain == $alt_domain) { + if (!@strlen($alt) || $main_domain == $alt_domain) { // No alternate domain. $should_redirect = false; $is_alternate_domain = false; @@ -69,7 +69,7 @@ // an initial request for bytes 0-1 of the audio file, and things go south // if we can't respond with a 206 Partial Content. $range = $request->getHTTPHeader('range'); - if (strlen($range)) { + if (@strlen($range)) { list($begin, $end) = $response->parseHTTPRange($range); } diff --git a/src/applications/files/controller/PhabricatorFileLightboxController.php b/src/applications/files/controller/PhabricatorFileLightboxController.php --- a/src/applications/files/controller/PhabricatorFileLightboxController.php +++ b/src/applications/files/controller/PhabricatorFileLightboxController.php @@ -20,7 +20,7 @@ return new Aphront404Response(); } - if (strlen($comment)) { + if (@strlen($comment)) { $xactions = array(); $xactions[] = id(new PhabricatorFileTransaction()) ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) diff --git a/src/applications/files/controller/PhabricatorFileViewController.php b/src/applications/files/controller/PhabricatorFileViewController.php --- a/src/applications/files/controller/PhabricatorFileViewController.php +++ b/src/applications/files/controller/PhabricatorFileViewController.php @@ -311,12 +311,12 @@ $file->getStorageHandle()); $custom_alt = $file->getCustomAltText(); - if (strlen($custom_alt)) { + if (@strlen($custom_alt)) { $finfo->addProperty(pht('Custom Alt Text'), $custom_alt); } $default_alt = $file->getDefaultAltText(); - if (strlen($default_alt)) { + if (@strlen($default_alt)) { $finfo->addProperty(pht('Default Alt Text'), $default_alt); } diff --git a/src/applications/files/diff/PhabricatorDocumentEngineBlocks.php b/src/applications/files/diff/PhabricatorDocumentEngineBlocks.php --- a/src/applications/files/diff/PhabricatorDocumentEngineBlocks.php +++ b/src/applications/files/diff/PhabricatorDocumentEngineBlocks.php @@ -100,7 +100,7 @@ if ($old_line) { $old_hash = rtrim($old_line['text'], "\n"); - if (!strlen($old_hash)) { + if (!@strlen($old_hash)) { // This can happen when one of the sources has no blocks. $old_block = null; } else { @@ -115,7 +115,7 @@ if ($new_line) { $new_hash = rtrim($new_line['text'], "\n"); - if (!strlen($new_hash)) { + if (!@strlen($new_hash)) { $new_block = null; } else { $new_block = array_shift($new_map[$new_hash]); diff --git a/src/applications/files/document/PhabricatorDocumentRef.php b/src/applications/files/document/PhabricatorDocumentRef.php --- a/src/applications/files/document/PhabricatorDocumentRef.php +++ b/src/applications/files/document/PhabricatorDocumentRef.php @@ -67,7 +67,7 @@ } if ($this->data !== null) { - return strlen($this->data); + return @strlen($this->data); } if ($this->file) { @@ -87,11 +87,11 @@ $data = $this->data; if ($begin !== null && $end !== null) { - $data = substr($data, $begin, $end - $begin); + $data = @substr($data, $begin, $end - $begin); } else if ($begin !== null) { - $data = substr($data, $begin); + $data = @substr($data, $begin); } else if ($end !== null) { - $data = substr($data, 0, $end); + $data = @substr($data, 0, $end); } return $data; @@ -112,7 +112,7 @@ public function hasAnyMimeType(array $candidate_types) { $mime_full = $this->getMimeType(); - $mime_parts = explode(';', $mime_full); + $mime_parts = @explode(';', $mime_full); $mime_type = head($mime_parts); $mime_type = $this->normalizeMimeType($mime_type); @@ -134,7 +134,7 @@ public function isProbablyText() { $snippet = $this->getSnippet(); - return (strpos($snippet, "\0") === false); + return (@strpos($snippet, "\0") === false); } public function isProbablyJSON() { @@ -147,7 +147,7 @@ // If the file is longer than the snippet, we don't detect the content // as JSON. We could use some kind of heuristic here if we wanted, but // see PHI749 for a false positive. - if (strlen($snippet) < $this->getByteLength()) { + if (@strlen($snippet) < $this->getByteLength()) { return false; } diff --git a/src/applications/files/document/PhabricatorHexdumpDocumentEngine.php b/src/applications/files/document/PhabricatorHexdumpDocumentEngine.php --- a/src/applications/files/document/PhabricatorHexdumpDocumentEngine.php +++ b/src/applications/files/document/PhabricatorHexdumpDocumentEngine.php @@ -51,8 +51,8 @@ $output[] = sprintf( '%08x %- 23s %- 23s %- 16s', $offset, - $this->renderHex(substr($line, 0, 8)), - $this->renderHex(substr($line, 8)), + $this->renderHex(@substr($line, 0, 8)), + $this->renderHex(@substr($line, 8)), $this->renderBytes($line)); $offset += 16; @@ -83,7 +83,7 @@ } private function renderHex($bytes) { - $length = strlen($bytes); + $length = @strlen($bytes); $output = array(); for ($ii = 0; $ii < $length; $ii++) { @@ -94,7 +94,7 @@ } private function renderBytes($bytes) { - $length = strlen($bytes); + $length = @strlen($bytes); $output = array(); for ($ii = 0; $ii < $length; $ii++) { diff --git a/src/applications/files/document/PhabricatorJSONDocumentEngine.php b/src/applications/files/document/PhabricatorJSONDocumentEngine.php --- a/src/applications/files/document/PhabricatorJSONDocumentEngine.php +++ b/src/applications/files/document/PhabricatorJSONDocumentEngine.php @@ -14,7 +14,7 @@ } protected function getContentScore(PhabricatorDocumentRef $ref) { - if (preg_match('/\.json\z/', $ref->getName())) { + if (@preg_match('/\.json\z/', $ref->getName())) { return 2000; } @@ -42,7 +42,7 @@ 'decoding it with "phutil_json_decode(...).')); } - if (preg_match('/^\s*\[/', $raw_data)) { + if (@preg_match('/^\s*\[/', $raw_data)) { $content = id(new PhutilJSON())->encodeAsList($data); } else { $content = id(new PhutilJSON())->encodeFormatted($data); diff --git a/src/applications/files/document/PhabricatorJupyterDocumentEngine.php b/src/applications/files/document/PhabricatorJupyterDocumentEngine.php --- a/src/applications/files/document/PhabricatorJupyterDocumentEngine.php +++ b/src/applications/files/document/PhabricatorJupyterDocumentEngine.php @@ -24,7 +24,7 @@ protected function getContentScore(PhabricatorDocumentRef $ref) { $name = $ref->getName(); - if (preg_match('/\\.ipynb\z/i', $name)) { + if (@preg_match('/\\.ipynb\z/i', $name)) { return 2000; } @@ -323,7 +323,7 @@ } $nbformat = idx($data, 'nbformat'); - if (!strlen($nbformat)) { + if (!@strlen($nbformat)) { throw new Exception( pht( 'This document is missing an "nbformat" field. Jupyter notebooks '. @@ -691,7 +691,7 @@ if ($force_language === null) { $head = head($lines); $matches = null; - if (preg_match('/^%%(.*)$/', $head, $matches)) { + if (@preg_match('/^%%(.*)$/', $head, $matches)) { $restore = array_shift($lines); $lang = $matches[1]; } else { diff --git a/src/applications/files/document/PhabricatorRemarkupDocumentEngine.php b/src/applications/files/document/PhabricatorRemarkupDocumentEngine.php --- a/src/applications/files/document/PhabricatorRemarkupDocumentEngine.php +++ b/src/applications/files/document/PhabricatorRemarkupDocumentEngine.php @@ -15,7 +15,7 @@ protected function getContentScore(PhabricatorDocumentRef $ref) { $name = $ref->getName(); - if (preg_match('/\\.remarkup\z/i', $name)) { + if (@preg_match('/\\.remarkup\z/i', $name)) { return 2000; } diff --git a/src/applications/files/document/PhabricatorSourceDocumentEngine.php b/src/applications/files/document/PhabricatorSourceDocumentEngine.php --- a/src/applications/files/document/PhabricatorSourceDocumentEngine.php +++ b/src/applications/files/document/PhabricatorSourceDocumentEngine.php @@ -37,7 +37,7 @@ $content); } else { $highlight_limit = DifferentialChangesetParser::HIGHLIGHT_BYTE_LIMIT; - if (strlen($content) > $highlight_limit) { + if (@strlen($content) > $highlight_limit) { $messages[] = $this->newMessage( pht( 'This file is larger than %s, so syntax highlighting was skipped.', diff --git a/src/applications/files/document/render/PhabricatorDocumentRenderingEngine.php b/src/applications/files/document/render/PhabricatorDocumentRenderingEngine.php --- a/src/applications/files/document/render/PhabricatorDocumentRenderingEngine.php +++ b/src/applications/files/document/render/PhabricatorDocumentRenderingEngine.php @@ -60,12 +60,12 @@ } $encode_setting = $request->getStr('encode'); - if (strlen($encode_setting)) { + if (@strlen($encode_setting)) { $engine->setEncodingConfiguration($encode_setting); } $highlight_setting = $request->getStr('highlight'); - if (strlen($highlight_setting)) { + if (@strlen($highlight_setting)) { $engine->setHighlightingConfiguration($highlight_setting); } @@ -208,12 +208,12 @@ $this->activeEngine = $engine; $encode_setting = $request->getStr('encode'); - if (strlen($encode_setting)) { + if (@strlen($encode_setting)) { $engine->setEncodingConfiguration($encode_setting); } $highlight_setting = $request->getStr('highlight'); - if (strlen($highlight_setting)) { + if (@strlen($highlight_setting)) { $engine->setHighlightingConfiguration($highlight_setting); } diff --git a/src/applications/files/engine/PhabricatorChunkedFileStorageEngine.php b/src/applications/files/engine/PhabricatorChunkedFileStorageEngine.php --- a/src/applications/files/engine/PhabricatorChunkedFileStorageEngine.php +++ b/src/applications/files/engine/PhabricatorChunkedFileStorageEngine.php @@ -105,7 +105,7 @@ $rehash = PhabricatorHash::weakDigest($input); // Add a suffix to identify this as a chunk hash. - $rehash = substr($rehash, 0, -2).'-C'; + $rehash = @substr($rehash, 0, -2).'-C'; return $rehash; } diff --git a/src/applications/files/engine/PhabricatorFileChunkIterator.php b/src/applications/files/engine/PhabricatorFileChunkIterator.php --- a/src/applications/files/engine/PhabricatorFileChunkIterator.php +++ b/src/applications/files/engine/PhabricatorFileChunkIterator.php @@ -40,13 +40,13 @@ if ($this->end !== null) { if ($chunk->getByteEnd() > $this->end) { - $data = substr($data, 0, ($this->end - $chunk->getByteStart())); + $data = @substr($data, 0, ($this->end - $chunk->getByteStart())); } } if ($this->begin !== null) { if ($chunk->getByteStart() < $this->begin) { - $data = substr($data, ($this->begin - $chunk->getByteStart())); + $data = @substr($data, ($this->begin - $chunk->getByteStart())); } } diff --git a/src/applications/files/engine/PhabricatorFileStorageEngine.php b/src/applications/files/engine/PhabricatorFileStorageEngine.php --- a/src/applications/files/engine/PhabricatorFileStorageEngine.php +++ b/src/applications/files/engine/PhabricatorFileStorageEngine.php @@ -355,11 +355,11 @@ } if ($begin !== null && $end !== null) { - $data = substr($data, $begin, ($end - $begin)); + $data = @substr($data, $begin, ($end - $begin)); } else if ($begin !== null) { - $data = substr($data, $begin); + $data = @substr($data, $begin); } else if ($end !== null) { - $data = substr($data, 0, $end); + $data = @substr($data, 0, $end); } return array($data); 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 @@ -26,7 +26,7 @@ public function canWriteFiles() { $path = PhabricatorEnv::getEnvConfig('storage.local-disk.path'); - return (bool)strlen($path); + return (bool)@strlen($path); } @@ -123,7 +123,7 @@ // Make sure there's no funny business going on here. Users normally have // no ability to affect the content of handles, but double-check that // we're only accessing local storage just in case. - if (!preg_match('@^[a-f0-9]{2}/[a-f0-9]{2}/[a-f0-9]{28}\z@', $handle)) { + if (!@preg_match('@^[a-f0-9]{2}/[a-f0-9]{2}/[a-f0-9]{28}\z@', $handle)) { throw new Exception( pht( "Local disk filesystem handle '%s' is malformed!", diff --git a/src/applications/files/engine/PhabricatorS3FileStorageEngine.php b/src/applications/files/engine/PhabricatorS3FileStorageEngine.php --- a/src/applications/files/engine/PhabricatorS3FileStorageEngine.php +++ b/src/applications/files/engine/PhabricatorS3FileStorageEngine.php @@ -31,11 +31,11 @@ $endpoint = PhabricatorEnv::getEnvConfig('amazon-s3.endpoint'); $region = PhabricatorEnv::getEnvConfig('amazon-s3.region'); - return (strlen($bucket) && - strlen($access_key) && - strlen($secret_key) && - strlen($endpoint) && - strlen($region)); + return (@strlen($bucket) && + @strlen($access_key) && + @strlen($secret_key) && + @strlen($endpoint) && + @strlen($region)); } @@ -57,13 +57,13 @@ $parts[] = 'phabricator'; $instance_name = PhabricatorEnv::getEnvConfig('cluster.instance'); - if (strlen($instance_name)) { + if (@strlen($instance_name)) { $parts[] = $instance_name; } - $parts[] = substr($seed, 0, 2); - $parts[] = substr($seed, 2, 2); - $parts[] = substr($seed, 4); + $parts[] = @substr($seed, 0, 2); + $parts[] = @substr($seed, 2, 2); + $parts[] = @substr($seed, 4); $name = implode('/', $parts); diff --git a/src/applications/files/keyring/PhabricatorKeyringConfigOptionType.php b/src/applications/files/keyring/PhabricatorKeyringConfigOptionType.php --- a/src/applications/files/keyring/PhabricatorKeyringConfigOptionType.php +++ b/src/applications/files/keyring/PhabricatorKeyringConfigOptionType.php @@ -80,13 +80,13 @@ $name)); } - if (strlen($material) != 32) { + if (@strlen($material) != 32) { throw new Exception( pht( 'Keyring specifies an invalid key ("%s"): key material '. 'should be 32 bytes (256 bits) but has length %s.', $name, - new PhutilNumber(strlen($material)))); + new PhutilNumber(@strlen($material)))); } break; default: diff --git a/src/applications/files/mail/FileMailReceiver.php b/src/applications/files/mail/FileMailReceiver.php --- a/src/applications/files/mail/FileMailReceiver.php +++ b/src/applications/files/mail/FileMailReceiver.php @@ -12,7 +12,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 1); + $id = (int)@substr($pattern, 1); return id(new PhabricatorFileQuery()) ->setViewer($viewer) diff --git a/src/applications/files/management/PhabricatorFilesManagementEncodeWorkflow.php b/src/applications/files/management/PhabricatorFilesManagementEncodeWorkflow.php --- a/src/applications/files/management/PhabricatorFilesManagementEncodeWorkflow.php +++ b/src/applications/files/management/PhabricatorFilesManagementEncodeWorkflow.php @@ -42,7 +42,7 @@ $format_list = implode(', ', $format_list); $format_key = $args->getArg('as'); - if (!strlen($format_key)) { + if (!@strlen($format_key)) { throw new PhutilArgumentUsageException( pht( 'Use --as to select a target encoding format. Available '. @@ -60,7 +60,7 @@ } $key_name = $args->getArg('key'); - if (strlen($key_name)) { + if (@strlen($key_name)) { $format->selectMasterKey($key_name); } diff --git a/src/applications/files/management/PhabricatorFilesManagementGenerateKeyWorkflow.php b/src/applications/files/management/PhabricatorFilesManagementGenerateKeyWorkflow.php --- a/src/applications/files/management/PhabricatorFilesManagementGenerateKeyWorkflow.php +++ b/src/applications/files/management/PhabricatorFilesManagementGenerateKeyWorkflow.php @@ -20,7 +20,7 @@ public function execute(PhutilArgumentParser $args) { $type = $args->getArg('type'); - if (!strlen($type)) { + if (!@strlen($type)) { throw new PhutilArgumentUsageException( pht( 'Specify the type of key to generate with --type.')); diff --git a/src/applications/files/management/PhabricatorFilesManagementMigrateWorkflow.php b/src/applications/files/management/PhabricatorFilesManagementMigrateWorkflow.php --- a/src/applications/files/management/PhabricatorFilesManagementMigrateWorkflow.php +++ b/src/applications/files/management/PhabricatorFilesManagementMigrateWorkflow.php @@ -62,7 +62,7 @@ // it as though it is configured to use the specified location. $local_disk_source = $args->getArg('local-disk-source'); - if (strlen($local_disk_source)) { + if (@strlen($local_disk_source)) { $path = Filesystem::resolvePath($local_disk_source); try { Filesystem::assertIsDirectory($path); diff --git a/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php b/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php --- a/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php +++ b/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php @@ -166,7 +166,7 @@ $alt = $options['alt']; } - if (!strlen($alt)) { + if (!@strlen($alt)) { $alt = $file->getAltText(); } @@ -317,7 +317,7 @@ private function parseDimension($string) { $string = trim($string); - if (preg_match('/^(?:\d*\\.)?\d+%?$/', $string)) { + if (@preg_match('/^(?:\d*\\.)?\d+%?$/', $string)) { return $string; } diff --git a/src/applications/files/markup/PhabricatorImageRemarkupRule.php b/src/applications/files/markup/PhabricatorImageRemarkupRule.php --- a/src/applications/files/markup/PhabricatorImageRemarkupRule.php +++ b/src/applications/files/markup/PhabricatorImageRemarkupRule.php @@ -49,7 +49,7 @@ $args += $defaults; - if (!strlen($args['uri'])) { + if (!@strlen($args['uri'])) { return $matches[0]; } @@ -59,7 +59,7 @@ try { $uri = new PhutilURI($args['uri']); - if (!strlen($uri->getProtocol())) { + if (!@strlen($uri->getProtocol())) { return $matches[0]; } @@ -165,7 +165,7 @@ private function isURI($uri_string) { // Very simple check to make sure it starts with either http or https. // If it does, we'll try to treat it like a valid URI - return preg_match('~^https?\:\/\/.*\z~i', $uri_string); + return @preg_match('~^https?\:\/\/.*\z~i', $uri_string); } } diff --git a/src/applications/files/phid/PhabricatorFileFilePHIDType.php b/src/applications/files/phid/PhabricatorFileFilePHIDType.php --- a/src/applications/files/phid/PhabricatorFileFilePHIDType.php +++ b/src/applications/files/phid/PhabricatorFileFilePHIDType.php @@ -43,7 +43,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^F\d*[1-9]\d*$/', $name); + return @preg_match('/^F\d*[1-9]\d*$/', $name); } public function loadNamedObjects( @@ -52,7 +52,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php --- a/src/applications/files/storage/PhabricatorFile.php +++ b/src/applications/files/storage/PhabricatorFile.php @@ -211,7 +211,7 @@ $file_data = Filesystem::readFile($tmp_name); $file_size = idx($spec, 'size'); - if (strlen($file_data) != $file_size) { + if (@strlen($file_data) != $file_size) { throw new Exception(pht('File size disagrees with uploaded size.')); } @@ -288,7 +288,7 @@ // update the parent file if a MIME type hasn't been provided. This matters // for large media files like video. $mime_type = idx($params, 'mime-type'); - if (!strlen($mime_type)) { + if (!@strlen($mime_type)) { $file->setMimeType('application/octet-stream'); } @@ -328,7 +328,7 @@ if (isset($params['storageEngines'])) { $engines = $params['storageEngines']; } else { - $size = strlen($data); + $size = @strlen($data); $engines = PhabricatorFileStorageEngine::loadStorageEngines($size); if (!$engines) { @@ -406,7 +406,7 @@ $exceptions); } - $file->setByteSize(strlen($data)); + $file->setByteSize(@strlen($data)); $hash = self::hashFileContent($data); $file->setContentHash($hash); @@ -552,7 +552,7 @@ $data_handle = $engine->writeFile($formatted_data, $params); - if (!$data_handle || strlen($data_handle) > 255) { + if (!$data_handle || @strlen($data_handle) > 255) { // This indicates an improperly implemented storage engine. throw new PhabricatorFileStorageConfigurationException( pht( @@ -565,7 +565,7 @@ } $engine_identifier = $engine->getEngineIdentifier(); - if (!$engine_identifier || strlen($engine_identifier) > 32) { + if (!$engine_identifier || @strlen($engine_identifier) > 32) { throw new PhabricatorFileStorageConfigurationException( pht( "Storage engine '%s' returned an improper engine identifier '{%s}': ". @@ -856,7 +856,7 @@ // instance identity in the path allows us to distinguish between requests // originating from different instances but served through the same CDN. $instance = PhabricatorEnv::getEnvConfig('cluster.instance'); - if (strlen($instance)) { + if (@strlen($instance)) { $parts[] = '@'.$instance; } @@ -903,7 +903,7 @@ $parts[] = 'xform'; $instance = PhabricatorEnv::getEnvConfig('cluster.instance'); - if (strlen($instance)) { + if (@strlen($instance)) { $parts[] = '@'.$instance; } @@ -971,7 +971,7 @@ // warns you if you don't have complete support. $matches = null; - $ok = preg_match( + $ok = @preg_match( '@^image/(gif|png|jpe?g)@', $this->getViewableMimeType(), $matches); @@ -1049,7 +1049,7 @@ $mime_map = PhabricatorEnv::getEnvConfig('files.viewable-mime-types'); $mime_type = $this->getMimeType(); - $mime_parts = explode(';', $mime_type); + $mime_parts = @explode(';', $mime_type); $mime_type = trim(reset($mime_parts)); return idx($mime_map, $mime_type); @@ -1278,7 +1278,7 @@ public function getAltText() { $alt = $this->getCustomAltText(); - if (strlen($alt)) { + if (@strlen($alt)) { return $alt; } @@ -1292,7 +1292,7 @@ public function setCustomAltText($value) { $value = phutil_string_cast($value); - if (!strlen($value)) { + if (!@strlen($value)) { $value = null; } @@ -1309,7 +1309,7 @@ $parts = array(); $name = $this->getName(); - if (strlen($name)) { + if (@strlen($name)) { $parts[] = $name; } @@ -1567,7 +1567,7 @@ // redirects here anyway, since we only ever transform viewable images // right now. - $is_external = strlen(id(new PhutilURI($uri))->getDomain()); + $is_external = @strlen(id(new PhutilURI($uri))->getDomain()); return id(new AphrontRedirectResponse()) ->setIsExternal($is_external) diff --git a/src/applications/files/uploadsource/PhabricatorFileUploadSource.php b/src/applications/files/uploadsource/PhabricatorFileUploadSource.php --- a/src/applications/files/uploadsource/PhabricatorFileUploadSource.php +++ b/src/applications/files/uploadsource/PhabricatorFileUploadSource.php @@ -113,7 +113,7 @@ } $read_bytes = $data->current(); - $this->totalBytesRead += strlen($read_bytes); + $this->totalBytesRead += @strlen($read_bytes); if ($this->byteLimit && ($this->totalBytesRead > $this->byteLimit)) { throw new PhabricatorFileUploadSourceByteLimitException(); @@ -223,7 +223,7 @@ $rope = $this->getRope(); $data = $rope->getPrefixBytes($max_length); - $actual_length = strlen($data); + $actual_length = @strlen($data); $rope->removeBytesFromHead($actual_length); $params = array( diff --git a/src/applications/files/view/PhabricatorGlobalUploadTargetView.php b/src/applications/files/view/PhabricatorGlobalUploadTargetView.php --- a/src/applications/files/view/PhabricatorGlobalUploadTargetView.php +++ b/src/applications/files/view/PhabricatorGlobalUploadTargetView.php @@ -67,7 +67,7 @@ require_celerity_resource('global-drag-and-drop-css'); $hint_text = $this->getHintText(); - if (!strlen($hint_text)) { + if (!@strlen($hint_text)) { $hint_text = "\xE2\x87\xAA ".pht('Drop Files to Upload'); } diff --git a/src/applications/files/xaction/PhabricatorFileAltTextTransaction.php b/src/applications/files/xaction/PhabricatorFileAltTextTransaction.php --- a/src/applications/files/xaction/PhabricatorFileAltTextTransaction.php +++ b/src/applications/files/xaction/PhabricatorFileAltTextTransaction.php @@ -12,7 +12,7 @@ public function generateNewValue($object, $value) { $value = phutil_string_cast($value); - if (!strlen($value)) { + if (!@strlen($value)) { $value = null; } @@ -27,12 +27,12 @@ $old_value = $this->getOldValue(); $new_value = $this->getNewValue(); - if (!strlen($old_value)) { + if (!@strlen($old_value)) { return pht( '%s set the alternate text for this file to %s.', $this->renderAuthor(), $this->renderNewValue()); - } else if (!strlen($new_value)) { + } else if (!@strlen($new_value)) { return pht( '%s removed the alternate text for this file (was %s).', $this->renderAuthor(), @@ -50,13 +50,13 @@ $old_value = $this->getOldValue(); $new_value = $this->getNewValue(); - if (!strlen($old_value)) { + if (!@strlen($old_value)) { return pht( '%s set the alternate text for %s to %s.', $this->renderAuthor(), $this->renderObject(), $this->renderNewValue()); - } else if (!strlen($new_value)) { + } else if (!@strlen($new_value)) { return pht( '%s removed the alternate text for %s (was %s).', $this->renderAuthor(), @@ -79,7 +79,7 @@ foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/files/xaction/PhabricatorFileNameTransaction.php b/src/applications/files/xaction/PhabricatorFileNameTransaction.php --- a/src/applications/files/xaction/PhabricatorFileNameTransaction.php +++ b/src/applications/files/xaction/PhabricatorFileNameTransaction.php @@ -40,7 +40,7 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/fund/controller/FundInitiativeBackController.php b/src/applications/fund/controller/FundInitiativeBackController.php --- a/src/applications/fund/controller/FundInitiativeBackController.php +++ b/src/applications/fund/controller/FundInitiativeBackController.php @@ -53,7 +53,7 @@ $account = $accounts[$v_account]; } - if (!strlen($v_amount)) { + if (!@strlen($v_amount)) { $errors[] = pht( 'You must specify how much money you want to contribute to the '. 'initiative.'); diff --git a/src/applications/fund/controller/FundInitiativeViewController.php b/src/applications/fund/controller/FundInitiativeViewController.php --- a/src/applications/fund/controller/FundInitiativeViewController.php +++ b/src/applications/fund/controller/FundInitiativeViewController.php @@ -94,7 +94,7 @@ $initiative->getTotalAsCurrency()->formatForDisplay()); $description = $initiative->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $description = new PHUIRemarkupView($viewer, $description); $view->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); @@ -102,7 +102,7 @@ } $risks = $initiative->getRisks(); - if (strlen($risks)) { + if (@strlen($risks)) { $risks = new PHUIRemarkupView($viewer, $risks); $view->addSectionHeader( pht('Risks/Challenges'), 'fa-ambulance'); diff --git a/src/applications/fund/phid/FundInitiativePHIDType.php b/src/applications/fund/phid/FundInitiativePHIDType.php --- a/src/applications/fund/phid/FundInitiativePHIDType.php +++ b/src/applications/fund/phid/FundInitiativePHIDType.php @@ -47,7 +47,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^I\d*[1-9]\d*$/i', $name); + return @preg_match('/^I\d*[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -56,7 +56,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/fund/xaction/FundInitiativeDescriptionTransaction.php b/src/applications/fund/xaction/FundInitiativeDescriptionTransaction.php --- a/src/applications/fund/xaction/FundInitiativeDescriptionTransaction.php +++ b/src/applications/fund/xaction/FundInitiativeDescriptionTransaction.php @@ -16,7 +16,7 @@ public function shouldHide() { $old = $this->getOldValue(); $new = $this->getNewValue(); - if (!strlen($old) && !strlen($new)) { + if (!@strlen($old) && !@strlen($new)) { return true; } return false; diff --git a/src/applications/fund/xaction/FundInitiativeNameTransaction.php b/src/applications/fund/xaction/FundInitiativeNameTransaction.php --- a/src/applications/fund/xaction/FundInitiativeNameTransaction.php +++ b/src/applications/fund/xaction/FundInitiativeNameTransaction.php @@ -15,7 +15,7 @@ public function getTitle() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s created this initiative.', $this->renderAuthor()); @@ -30,7 +30,7 @@ public function getTitleForFeed() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s created initiative %s.', $this->renderAuthor(), @@ -56,7 +56,7 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The name can be no longer than %s characters.', diff --git a/src/applications/fund/xaction/FundInitiativeRisksTransaction.php b/src/applications/fund/xaction/FundInitiativeRisksTransaction.php --- a/src/applications/fund/xaction/FundInitiativeRisksTransaction.php +++ b/src/applications/fund/xaction/FundInitiativeRisksTransaction.php @@ -16,7 +16,7 @@ public function shouldHide() { $old = $this->getOldValue(); $new = $this->getNewValue(); - if (!strlen($old) && !strlen($new)) { + if (!@strlen($old) && !@strlen($new)) { return true; } return false; diff --git a/src/applications/harbormaster/artifact/HarbormasterURIArtifact.php b/src/applications/harbormaster/artifact/HarbormasterURIArtifact.php --- a/src/applications/harbormaster/artifact/HarbormasterURIArtifact.php +++ b/src/applications/harbormaster/artifact/HarbormasterURIArtifact.php @@ -96,7 +96,7 @@ $uri = new PhutilURI($raw_uri); $protocol = $uri->getProtocol(); - if (!strlen($protocol)) { + if (!@strlen($protocol)) { throw new Exception( pht( 'Unable to identify the protocol for URI "%s". URIs must be '. diff --git a/src/applications/harbormaster/controller/HarbormasterBuildLogRenderController.php b/src/applications/harbormaster/controller/HarbormasterBuildLogRenderController.php --- a/src/applications/harbormaster/controller/HarbormasterBuildLogRenderController.php +++ b/src/applications/harbormaster/controller/HarbormasterBuildLogRenderController.php @@ -135,7 +135,7 @@ $lines = $this->getLines($data); $line_data = array(); foreach ($lines as $line_text) { - $length = strlen($line_text); + $length = @strlen($line_text); $line_data[] = array( 'offset' => $offset, 'length' => $length, @@ -277,14 +277,14 @@ } $trim = ($view_offset - $line_offset); - if ($trim && ($trim >= strlen($line['data']))) { + if ($trim && ($trim >= @strlen($line['data']))) { unset($lines[$line_key]); continue; } - $line_data = substr($line['data'], $trim); + $line_data = @substr($line['data'], $trim); $lines[$line_key]['data'] = $line_data; - $lines[$line_key]['length'] = strlen($line_data); + $lines[$line_key]['length'] = @strlen($line_data); $lines[$line_key]['offset'] += $trim; break; } @@ -297,14 +297,14 @@ } $trim = ($line_end - $view_end); - if ($trim && ($trim >= strlen($line['data']))) { + if ($trim && ($trim >= @strlen($line['data']))) { unset($lines[$line_key]); continue; } - $line_data = substr($line['data'], -$trim); + $line_data = @substr($line['data'], -$trim); $lines[$line_key]['data'] = $line_data; - $lines[$line_key]['length'] = strlen($line_data); + $lines[$line_key]['length'] = @strlen($line_data); } $views[$view_key]['viewData'] = $lines; @@ -838,7 +838,7 @@ } } - $offset += strlen($line); + $offset += @strlen($line); if ($max_offset === null) { if ($number === $range_max) { diff --git a/src/applications/harbormaster/controller/HarbormasterPlanViewController.php b/src/applications/harbormaster/controller/HarbormasterPlanViewController.php --- a/src/applications/harbormaster/controller/HarbormasterPlanViewController.php +++ b/src/applications/harbormaster/controller/HarbormasterPlanViewController.php @@ -308,7 +308,7 @@ $error = null; $key = idx($artifact, 'key'); - if (!strlen($key)) { + if (!@strlen($key)) { $bound = phutil_tag('em', array(), pht('(null)')); if ($is_input) { // This is an unbound input. For now, all inputs are always required. diff --git a/src/applications/harbormaster/controller/HarbormasterStepEditController.php b/src/applications/harbormaster/controller/HarbormasterStepEditController.php --- a/src/applications/harbormaster/controller/HarbormasterStepEditController.php +++ b/src/applications/harbormaster/controller/HarbormasterStepEditController.php @@ -139,7 +139,7 @@ ->setUser($viewer); $instructions = $implementation->getEditInstructions(); - if (strlen($instructions)) { + if (@strlen($instructions)) { $form->appendRemarkupInstructions($instructions); } diff --git a/src/applications/harbormaster/controller/HarbormasterStepViewController.php b/src/applications/harbormaster/controller/HarbormasterStepViewController.php --- a/src/applications/harbormaster/controller/HarbormasterStepViewController.php +++ b/src/applications/harbormaster/controller/HarbormasterStepViewController.php @@ -99,7 +99,7 @@ $view); $description = $step->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $view->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); diff --git a/src/applications/harbormaster/editor/HarbormasterBuildPlanEditEngine.php b/src/applications/harbormaster/editor/HarbormasterBuildPlanEditEngine.php --- a/src/applications/harbormaster/editor/HarbormasterBuildPlanEditEngine.php +++ b/src/applications/harbormaster/editor/HarbormasterBuildPlanEditEngine.php @@ -103,7 +103,7 @@ $key); $behavior_option = $object->getPlanProperty($storage_key); - if (!strlen($behavior_option)) { + if (!@strlen($behavior_option)) { $behavior_option = $behavior->getPlanOption($object)->getKey(); } diff --git a/src/applications/harbormaster/integration/circleci/HarbormasterCircleCIBuildStepImplementation.php b/src/applications/harbormaster/integration/circleci/HarbormasterCircleCIBuildStepImplementation.php --- a/src/applications/harbormaster/integration/circleci/HarbormasterCircleCIBuildStepImplementation.php +++ b/src/applications/harbormaster/integration/circleci/HarbormasterCircleCIBuildStepImplementation.php @@ -117,7 +117,7 @@ } $path_parts = trim($path, '/'); - $path_parts = explode('/', $path_parts); + $path_parts = @explode('/', $path_parts); if (count($path_parts) < 2) { throw new Exception( pht( diff --git a/src/applications/harbormaster/management/HarbormasterManagementArchiveLogsWorkflow.php b/src/applications/harbormaster/management/HarbormasterManagementArchiveLogsWorkflow.php --- a/src/applications/harbormaster/management/HarbormasterManagementArchiveLogsWorkflow.php +++ b/src/applications/harbormaster/management/HarbormasterManagementArchiveLogsWorkflow.php @@ -104,7 +104,7 @@ $hash = hash_init('sha1'); foreach ($log->newChunkIterator() as $chunk) { - $bytes += strlen($chunk->getChunk()); + $bytes += @strlen($chunk->getChunk()); $chunks++; hash_update($hash, $chunk->getChunkDisplayText()); } diff --git a/src/applications/harbormaster/management/HarbormasterManagementWriteLogWorkflow.php b/src/applications/harbormaster/management/HarbormasterManagementWriteLogWorkflow.php --- a/src/applications/harbormaster/management/HarbormasterManagementWriteLogWorkflow.php +++ b/src/applications/harbormaster/management/HarbormasterManagementWriteLogWorkflow.php @@ -75,7 +75,7 @@ pht('Writing log, slowly...')); $offset = 0; - $total = strlen($content); + $total = @strlen($content); $pieces = str_split($content, $rate); $bar = id(new PhutilConsoleProgressBar()) @@ -83,7 +83,7 @@ foreach ($pieces as $piece) { $log->append($piece); - $bar->update(strlen($piece)); + $bar->update(@strlen($piece)); sleep(1); } diff --git a/src/applications/harbormaster/phid/HarbormasterBuildablePHIDType.php b/src/applications/harbormaster/phid/HarbormasterBuildablePHIDType.php --- a/src/applications/harbormaster/phid/HarbormasterBuildablePHIDType.php +++ b/src/applications/harbormaster/phid/HarbormasterBuildablePHIDType.php @@ -57,7 +57,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^B\d*[1-9]\d*$/i', $name); + return @preg_match('/^B\d*[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -66,7 +66,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/harbormaster/query/HarbormasterBuildPlanQuery.php b/src/applications/harbormaster/query/HarbormasterBuildPlanQuery.php --- a/src/applications/harbormaster/query/HarbormasterBuildPlanQuery.php +++ b/src/applications/harbormaster/query/HarbormasterBuildPlanQuery.php @@ -98,7 +98,7 @@ $this->statuses); } - if (strlen($this->datasourceQuery)) { + if (@strlen($this->datasourceQuery)) { $where[] = qsprintf( $conn, 'plan.name LIKE %>', diff --git a/src/applications/harbormaster/query/HarbormasterBuildUnitMessageQuery.php b/src/applications/harbormaster/query/HarbormasterBuildUnitMessageQuery.php --- a/src/applications/harbormaster/query/HarbormasterBuildUnitMessageQuery.php +++ b/src/applications/harbormaster/query/HarbormasterBuildUnitMessageQuery.php @@ -61,7 +61,7 @@ $indexes = array(); foreach ($messages as $message) { $index = $message->getNameIndex(); - if (strlen($index)) { + if (@strlen($index)) { $indexes[$index] = $index; } } @@ -72,7 +72,7 @@ foreach ($messages as $message) { $index = $message->getNameIndex(); - if (!strlen($index)) { + if (!@strlen($index)) { continue; } diff --git a/src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php b/src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php --- a/src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php +++ b/src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php @@ -221,7 +221,7 @@ } protected function formatValueForDescription($value) { - if (strlen($value)) { + if (@strlen($value)) { return phutil_tag('strong', array(), $value); } else { return phutil_tag('em', array(), pht('(null)')); diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuildLintMessage.php b/src/applications/harbormaster/storage/build/HarbormasterBuildLintMessage.php --- a/src/applications/harbormaster/storage/build/HarbormasterBuildLintMessage.php +++ b/src/applications/harbormaster/storage/build/HarbormasterBuildLintMessage.php @@ -88,7 +88,7 @@ $obj->setName($dict['name']); $description = idx($dict, 'description'); - if (strlen($description)) { + if (@strlen($description)) { $obj->setProperty('description', $description); } diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php b/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php --- a/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php +++ b/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php @@ -204,11 +204,11 @@ $chop_tail = ($range['tail'] - $end); if ($chop_head) { - $parts = substr($parts, $chop_head); + $parts = @substr($parts, $chop_head); } if ($chop_tail) { - $parts = substr($parts, 0, -$chop_tail); + $parts = @substr($parts, 0, -$chop_tail); } return $parts; @@ -284,7 +284,7 @@ } public function getRenderURI($lines) { - if (strlen($lines)) { + if (@strlen($lines)) { $lines = '$'.$lines; } @@ -359,7 +359,7 @@ $mode) { $data = $rope->getPrefixBytes($length); - $size = strlen($data); + $size = @strlen($data); switch ($mode) { case HarbormasterBuildLogChunk::CHUNK_ENCODING_TEXT: @@ -515,7 +515,7 @@ $data_limit = ($chunk_limit - $prefix_size); $append_data = $rope->getPrefixBytes($data_limit); - $data_size = strlen($append_data); + $data_size = @strlen($append_data); $this->openTransaction(); if ($append_id) { @@ -550,7 +550,7 @@ } public function updateLineMap($append_data, $marker_distance = null) { - $this->byteLength += strlen($append_data); + $this->byteLength += @strlen($append_data); if (!$marker_distance) { $marker_distance = (self::CHUNK_BYTE_LIMIT / 2); @@ -585,12 +585,12 @@ $next_marker = $last_marker + $marker_distance; $pos = 0; - $len = strlen($buffer); + $len = @strlen($buffer); while (true) { // If we only have a few bytes left in the buffer, leave it as a prefix // for next time. if (($len - $pos) <= ($max_utf8_width * 2)) { - $prefix = substr($buffer, $pos); + $prefix = @substr($buffer, $pos); break; } @@ -641,7 +641,7 @@ $slice_length--; } - $slice = substr($buffer, $pos, $slice_length); + $slice = @substr($buffer, $pos, $slice_length); $pos += $slice_length; $map_bytes += $slice_length; diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php b/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php --- a/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php +++ b/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php @@ -197,7 +197,7 @@ } public function getName() { - if (strlen($this->name) && !$this->isAutotarget()) { + if (@strlen($this->name) && !$this->isAutotarget()) { return $this->name; } diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuildUnitMessage.php b/src/applications/harbormaster/storage/build/HarbormasterBuildUnitMessage.php --- a/src/applications/harbormaster/storage/build/HarbormasterBuildUnitMessage.php +++ b/src/applications/harbormaster/storage/build/HarbormasterBuildUnitMessage.php @@ -102,7 +102,7 @@ $obj->setDuration((float)idx($dict, 'duration')); $path = idx($dict, 'path'); - if (strlen($path)) { + if (@strlen($path)) { $obj->setProperty('path', $path); } @@ -182,7 +182,7 @@ $message = null; $full_details = $this->getUnitMessageDetails(); - $byte_length = strlen($full_details); + $byte_length = @strlen($full_details); $text_limit = 1024 * 2; $remarkup_limit = 1024 * 8; @@ -291,16 +291,16 @@ $name = $this->getName(); $namespace = $this->getNamespace(); - if (strlen($namespace)) { + if (@strlen($namespace)) { $name = $namespace.'::'.$name; } $engine = $this->getEngine(); - if (strlen($engine)) { + if (@strlen($engine)) { $name = $engine.' > '.$name; } - if (!strlen($name)) { + if (!@strlen($name)) { return pht('Nameless Test (%d)', $this->getID()); } diff --git a/src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php b/src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php --- a/src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php +++ b/src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php @@ -79,7 +79,7 @@ } public function getName() { - if (strlen($this->name)) { + if (@strlen($this->name)) { return $this->name; } diff --git a/src/applications/harbormaster/view/HarbormasterLintPropertyView.php b/src/applications/harbormaster/view/HarbormasterLintPropertyView.php --- a/src/applications/harbormaster/view/HarbormasterLintPropertyView.php +++ b/src/applications/harbormaster/view/HarbormasterLintPropertyView.php @@ -36,14 +36,14 @@ $line = $message->getLine(); $href = null; - if (strlen(idx($this->pathURIMap, $path))) { + if (@strlen(idx($this->pathURIMap, $path))) { $href = $this->pathURIMap[$path].max($line, 1); } $severity = $this->renderSeverity($message->getSeverity()); $location = $path.':'.$line; - if (strlen($href)) { + if (@strlen($href)) { $location = phutil_tag( 'a', array( diff --git a/src/applications/harbormaster/view/HarbormasterUnitSummaryView.php b/src/applications/harbormaster/view/HarbormasterUnitSummaryView.php --- a/src/applications/harbormaster/view/HarbormasterUnitSummaryView.php +++ b/src/applications/harbormaster/view/HarbormasterUnitSummaryView.php @@ -89,7 +89,7 @@ } $excuse = $this->excuse; - if (strlen($excuse)) { + if (@strlen($excuse)) { $excuse_icon = id(new PHUIIconView()) ->setIcon('fa-commenting-o red'); diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php --- a/src/applications/herald/adapter/HeraldAdapter.php +++ b/src/applications/herald/adapter/HeraldAdapter.php @@ -527,7 +527,7 @@ foreach ((array)$field_value as $value) { try { - $result = phutil_preg_match($condition_pattern, $value); + $result = phutilpreg_match($condition_pattern, $value); } catch (PhutilRegexException $ex) { $message = array(); $message[] = pht( @@ -569,13 +569,13 @@ $value_regexp = array_shift($regexp_pair); foreach ((array)$field_value as $key => $value) { - $key_matches = @preg_match($key_regexp, $key); + $key_matches = @@preg_match($key_regexp, $key); if ($key_matches === false) { throw new HeraldInvalidConditionException( pht('First regular expression is invalid!')); } if ($key_matches) { - $value_matches = @preg_match($value_regexp, $value); + $value_matches = @@preg_match($value_regexp, $value); if ($value_matches === false) { throw new HeraldInvalidConditionException( pht('Second regular expression is invalid!')); @@ -617,7 +617,7 @@ switch ($condition_type) { case self::CONDITION_REGEXP: case self::CONDITION_NOT_REGEXP: - $ok = @preg_match($condition_value, ''); + $ok = @@preg_match($condition_value, ''); if ($ok === false) { throw new HeraldInvalidConditionException( pht( @@ -650,7 +650,7 @@ $key_regexp = array_shift($json); $val_regexp = array_shift($json); - $key_ok = @preg_match($key_regexp, ''); + $key_ok = @@preg_match($key_regexp, ''); if ($key_ok === false) { throw new HeraldInvalidConditionException( pht( @@ -659,7 +659,7 @@ $key_regexp)); } - $val_ok = @preg_match($val_regexp, ''); + $val_ok = @@preg_match($val_regexp, ''); if ($val_ok === false) { throw new HeraldInvalidConditionException( pht( diff --git a/src/applications/herald/controller/HeraldNewController.php b/src/applications/herald/controller/HeraldNewController.php --- a/src/applications/herald/controller/HeraldNewController.php +++ b/src/applications/herald/controller/HeraldNewController.php @@ -35,7 +35,7 @@ $e_object = null; if ($request->isFormPost()) { - if (strlen($object_name)) { + if (@strlen($object_name)) { $target_object = id(new PhabricatorObjectQuery()) ->setViewer($viewer) ->withNames(array($object_name)) diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php --- a/src/applications/herald/controller/HeraldRuleController.php +++ b/src/applications/herald/controller/HeraldRuleController.php @@ -278,7 +278,7 @@ $e_name = true; $errors = array(); - if (!strlen($new_name)) { + if (!@strlen($new_name)) { $e_name = pht('Required'); $errors[] = pht('Rule must have a name.'); } diff --git a/src/applications/herald/controller/HeraldWebhookTestController.php b/src/applications/herald/controller/HeraldWebhookTestController.php --- a/src/applications/herald/controller/HeraldWebhookTestController.php +++ b/src/applications/herald/controller/HeraldWebhookTestController.php @@ -25,7 +25,7 @@ if ($request->isFormPost()) { $v_object = $request->getStr('object'); - if (!strlen($v_object)) { + if (!@strlen($v_object)) { $object = $hook; } else { $objects = id(new PhabricatorObjectQuery()) diff --git a/src/applications/herald/management/HeraldRuleManagementWorkflow.php b/src/applications/herald/management/HeraldRuleManagementWorkflow.php --- a/src/applications/herald/management/HeraldRuleManagementWorkflow.php +++ b/src/applications/herald/management/HeraldRuleManagementWorkflow.php @@ -33,13 +33,13 @@ $viewer = $this->getViewer(); $rule_name = $args->getArg('rule'); - if (!strlen($rule_name)) { + if (!@strlen($rule_name)) { throw new PhutilArgumentUsageException( pht('Specify a rule to edit with "--rule ".')); } - if (preg_match('/^H\d+/', $rule_name)) { - $rule_id = substr($rule_name, 1); + if (@preg_match('/^H\d+/', $rule_name)) { + $rule_id = @substr($rule_name, 1); } else { $rule_id = $rule_name; } diff --git a/src/applications/herald/management/HeraldTestManagementWorkflow.php b/src/applications/herald/management/HeraldTestManagementWorkflow.php --- a/src/applications/herald/management/HeraldTestManagementWorkflow.php +++ b/src/applications/herald/management/HeraldTestManagementWorkflow.php @@ -30,7 +30,7 @@ $viewer = $this->getViewer(); $object_name = $args->getArg('object'); - if (!strlen($object_name)) { + if (!@strlen($object_name)) { throw new PhutilArgumentUsageException( pht('Specify an object to test rules for with "--object".')); } @@ -69,7 +69,7 @@ $content_type = $args->getArg('type'); - if (!strlen($content_type)) { + if (!@strlen($content_type)) { throw new PhutilArgumentUsageException( pht( 'Specify a content type to run rules for. For this object, valid '. diff --git a/src/applications/herald/phid/HeraldRulePHIDType.php b/src/applications/herald/phid/HeraldRulePHIDType.php --- a/src/applications/herald/phid/HeraldRulePHIDType.php +++ b/src/applications/herald/phid/HeraldRulePHIDType.php @@ -46,7 +46,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^H\d*[1-9]\d*$/i', $name); + return @preg_match('/^H\d*[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -55,7 +55,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/herald/storage/__tests__/HeraldTranscriptTestCase.php b/src/applications/herald/storage/__tests__/HeraldTranscriptTestCase.php --- a/src/applications/herald/storage/__tests__/HeraldTranscriptTestCase.php +++ b/src/applications/herald/storage/__tests__/HeraldTranscriptTestCase.php @@ -40,7 +40,7 @@ array('a', 'b', 'c'), array_keys($truncated_fields['ma'])); $this->assertEqual( - 'abc!def!'.substr($short_string, 6), + 'abc!def!'.@substr($short_string, 6), implode('!', $truncated_fields['ma'])); } diff --git a/src/applications/herald/storage/transcript/HeraldConditionResult.php b/src/applications/herald/storage/transcript/HeraldConditionResult.php --- a/src/applications/herald/storage/transcript/HeraldConditionResult.php +++ b/src/applications/herald/storage/transcript/HeraldConditionResult.php @@ -34,7 +34,7 @@ $error_class = $this->getDataProperty('exception.class'); $error_message = $this->getDataProperty('exception.message'); - if (!strlen($error_class)) { + if (!@strlen($error_class)) { $error_class = pht('Unknown Error'); } @@ -44,7 +44,7 @@ break; } - if (!strlen($error_message)) { + if (!@strlen($error_message)) { $error_message = pht( 'An unknown error occurred while evaluating this condition. No '. 'additional information is available.'); diff --git a/src/applications/herald/storage/transcript/HeraldObjectTranscript.php b/src/applications/herald/storage/transcript/HeraldObjectTranscript.php --- a/src/applications/herald/storage/transcript/HeraldObjectTranscript.php +++ b/src/applications/herald/storage/transcript/HeraldObjectTranscript.php @@ -69,11 +69,11 @@ private static function truncateValue($value, $length) { if (is_string($value)) { - if (strlen($value) <= $length) { + if (@strlen($value) <= $length) { return $value; } else { // NOTE: PhutilUTF8StringTruncator has huge runtime for giant strings. - return phutil_utf8ize(substr($value, 0, $length)."\n<...>"); + return phutil_utf8ize(@substr($value, 0, $length)."\n<...>"); } } else if (is_array($value)) { foreach ($value as $key => $v) { @@ -82,7 +82,7 @@ unset($value[$key]); } else { $v = self::truncateValue($v, $length); - $length -= strlen($v); + $length -= @strlen($v); $value[$key] = $v; } } diff --git a/src/applications/herald/storage/transcript/HeraldRuleResult.php b/src/applications/herald/storage/transcript/HeraldRuleResult.php --- a/src/applications/herald/storage/transcript/HeraldRuleResult.php +++ b/src/applications/herald/storage/transcript/HeraldRuleResult.php @@ -46,11 +46,11 @@ $error_class = $this->getDataProperty('exception.class'); $error_message = $this->getDataProperty('exception.message'); - if (!strlen($error_class)) { + if (!@strlen($error_class)) { $error_class = pht('Unknown Error'); } - if (!strlen($error_message)) { + if (!@strlen($error_message)) { $error_message = pht( 'An unknown error occurred while evaluating this condition. No '. 'additional information is available.'); diff --git a/src/applications/herald/typeahead/HeraldRuleDatasource.php b/src/applications/herald/typeahead/HeraldRuleDatasource.php --- a/src/applications/herald/typeahead/HeraldRuleDatasource.php +++ b/src/applications/herald/typeahead/HeraldRuleDatasource.php @@ -22,7 +22,7 @@ $query = id(new HeraldRuleQuery()) ->setViewer($viewer); - if (preg_match('/^[hH]\d+\z/', $raw_query)) { + if (@preg_match('/^[hH]\d+\z/', $raw_query)) { $id = trim($raw_query, 'hH'); $id = (int)$id; $query->withIDs(array($id)); diff --git a/src/applications/herald/value/HeraldTextFieldValue.php b/src/applications/herald/value/HeraldTextFieldValue.php --- a/src/applications/herald/value/HeraldTextFieldValue.php +++ b/src/applications/herald/value/HeraldTextFieldValue.php @@ -24,11 +24,11 @@ $value = implode('', $value); } - if (!strlen($value)) { + if (!@strlen($value)) { return phutil_tag('em', array(), pht('None')); } - if (strlen($value) > 256) { + if (@strlen($value) > 256) { $value = phutil_tag( 'textarea', array( diff --git a/src/applications/herald/xaction/HeraldRuleNameTransaction.php b/src/applications/herald/xaction/HeraldRuleNameTransaction.php --- a/src/applications/herald/xaction/HeraldRuleNameTransaction.php +++ b/src/applications/herald/xaction/HeraldRuleNameTransaction.php @@ -33,7 +33,7 @@ foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/herald/xaction/HeraldWebhookNameTransaction.php b/src/applications/herald/xaction/HeraldWebhookNameTransaction.php --- a/src/applications/herald/xaction/HeraldWebhookNameTransaction.php +++ b/src/applications/herald/xaction/HeraldWebhookNameTransaction.php @@ -45,7 +45,7 @@ $old_value = $this->generateOldValue($object); $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/herald/xaction/HeraldWebhookURITransaction.php b/src/applications/herald/xaction/HeraldWebhookURITransaction.php --- a/src/applications/herald/xaction/HeraldWebhookURITransaction.php +++ b/src/applications/herald/xaction/HeraldWebhookURITransaction.php @@ -45,7 +45,7 @@ $old_value = $this->generateOldValue($object); $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php b/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php --- a/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php +++ b/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php @@ -31,7 +31,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php b/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php --- a/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php +++ b/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php @@ -26,7 +26,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/legalpad/controller/LegalpadDocumentManageController.php b/src/applications/legalpad/controller/LegalpadDocumentManageController.php --- a/src/applications/legalpad/controller/LegalpadDocumentManageController.php +++ b/src/applications/legalpad/controller/LegalpadDocumentManageController.php @@ -91,7 +91,7 @@ $document_body, LegalpadDocumentBody::MARKUP_FIELD_TEXT); $preamble_box = null; - if (strlen($document->getPreamble())) { + if (@strlen($document->getPreamble())) { $preamble_text = new PHUIRemarkupView($viewer, $document->getPreamble()); $view->addTextContent($preamble_text); $view->addSectionHeader(''); diff --git a/src/applications/legalpad/controller/LegalpadDocumentSignController.php b/src/applications/legalpad/controller/LegalpadDocumentSignController.php --- a/src/applications/legalpad/controller/LegalpadDocumentSignController.php +++ b/src/applications/legalpad/controller/LegalpadDocumentSignController.php @@ -280,7 +280,7 @@ } $preamble_box = null; - if (strlen($document->getPreamble())) { + if (@strlen($document->getPreamble())) { $preamble_text = new PHUIRemarkupView($viewer, $document->getPreamble()); // NOTE: We're avoiding `setObject()` here so we don't pick up extra UI @@ -376,7 +376,7 @@ ); } else if ($request->isFormPost()) { $email = new PhutilEmailAddress($request->getStr('email')); - if (strlen($email->getDomainName())) { + if (@strlen($email->getDomainName())) { $email_obj = id(new PhabricatorUserEmail()) ->loadOneWhere('address = %s', $email->getAddress()); if ($email_obj) { @@ -565,7 +565,7 @@ $name = $request->getStr('name'); - if (!strlen($name)) { + if (!@strlen($name)) { $field_errors['name'] = pht('Required'); $errors[] = pht('Name field is required.'); } else { @@ -580,7 +580,7 @@ $email = $request->getStr('email'); $addr_obj = null; - if (!strlen($email)) { + if (!@strlen($email)) { $field_errors['email'] = pht('Required'); $errors[] = pht('Email field is required.'); } else { @@ -617,7 +617,7 @@ $name = $request->getStr('name'); - if (!strlen($name)) { + if (!@strlen($name)) { $field_errors['name'] = pht('Required'); $errors[] = pht('Company name is required.'); } else { @@ -626,7 +626,7 @@ $signature_data['name'] = $name; $address = $request->getStr('address'); - if (!strlen($address)) { + if (!@strlen($address)) { $field_errors['address'] = pht('Required'); $errors[] = pht('Company address is required.'); } else { @@ -635,7 +635,7 @@ $signature_data['address'] = $address; $contact_name = $request->getStr('contact.name'); - if (!strlen($contact_name)) { + if (!@strlen($contact_name)) { $field_errors['contact.name'] = pht('Required'); $errors[] = pht('Contact name is required.'); } else { @@ -645,7 +645,7 @@ $email = $request->getStr('email'); $addr_obj = null; - if (!strlen($email)) { + if (!@strlen($email)) { $field_errors['email'] = pht('Required'); $errors[] = pht('Contact email is required.'); } else { diff --git a/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php b/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php --- a/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php +++ b/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php @@ -67,7 +67,7 @@ } } else { $company_name = $v_name; - if (!strlen($company_name)) { + if (!@strlen($company_name)) { $e_name = pht('Required'); $errors[] = pht('You must choose a company to add an exemption for.'); } diff --git a/src/applications/legalpad/mail/LegalpadMailReceiver.php b/src/applications/legalpad/mail/LegalpadMailReceiver.php --- a/src/applications/legalpad/mail/LegalpadMailReceiver.php +++ b/src/applications/legalpad/mail/LegalpadMailReceiver.php @@ -12,7 +12,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 1); + $id = (int)@substr($pattern, 1); return id(new LegalpadDocumentQuery()) ->setViewer($viewer) diff --git a/src/applications/legalpad/phid/PhabricatorLegalpadDocumentPHIDType.php b/src/applications/legalpad/phid/PhabricatorLegalpadDocumentPHIDType.php --- a/src/applications/legalpad/phid/PhabricatorLegalpadDocumentPHIDType.php +++ b/src/applications/legalpad/phid/PhabricatorLegalpadDocumentPHIDType.php @@ -43,7 +43,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^L\d*[1-9]\d*$/i', $name); + return @preg_match('/^L\d*[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -52,7 +52,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php b/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php --- a/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php +++ b/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php @@ -127,12 +127,12 @@ } $name_contains = $saved->getParameter('nameContains'); - if (strlen($name_contains)) { + if (@strlen($name_contains)) { $query->withNameContains($name_contains); } $email_contains = $saved->getParameter('emailContains'); - if (strlen($email_contains)) { + if (@strlen($email_contains)) { $query->withEmailContains($email_contains); } diff --git a/src/applications/legalpad/xaction/LegalpadDocumentTextTransaction.php b/src/applications/legalpad/xaction/LegalpadDocumentTextTransaction.php --- a/src/applications/legalpad/xaction/LegalpadDocumentTextTransaction.php +++ b/src/applications/legalpad/xaction/LegalpadDocumentTextTransaction.php @@ -19,7 +19,7 @@ public function getTitle() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s set the document text.', $this->renderAuthor()); diff --git a/src/applications/legalpad/xaction/LegalpadDocumentTitleTransaction.php b/src/applications/legalpad/xaction/LegalpadDocumentTitleTransaction.php --- a/src/applications/legalpad/xaction/LegalpadDocumentTitleTransaction.php +++ b/src/applications/legalpad/xaction/LegalpadDocumentTitleTransaction.php @@ -19,7 +19,7 @@ public function getTitle() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s created this document.', $this->renderAuthor()); @@ -35,7 +35,7 @@ public function getTitleForFeed() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s created %s.', $this->renderAuthor(), @@ -61,7 +61,7 @@ $max_length = $object->getColumnMaximumByteLength('title'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The title can be no longer than %s characters.', diff --git a/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php b/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php --- a/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php +++ b/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php @@ -103,7 +103,7 @@ } // If there's a partial match, match that generator but continue. - if (strpos($name, $arg) !== false) { + if (@strpos($name, $arg) !== false) { $matches[] = $generator; } } diff --git a/src/applications/macro/engine/PhabricatorMemeEngine.php b/src/applications/macro/engine/PhabricatorMemeEngine.php --- a/src/applications/macro/engine/PhabricatorMemeEngine.php +++ b/src/applications/macro/engine/PhabricatorMemeEngine.php @@ -182,7 +182,7 @@ // changes to the image. $above_text = $this->getAboveText(); $below_text = $this->getBelowText(); - if (!strlen(trim($above_text)) && !strlen(trim($below_text))) { + if (!@strlen(trim($above_text)) && !@strlen(trim($below_text))) { return $template_data; } @@ -272,7 +272,7 @@ $size = $metrics['size']; $above = $this->getAboveText(); - if (strlen($above)) { + if (@strlen($above)) { $x = (int)floor(($dx - $metrics['text']['above']['width']) / 2); $y = $metrics['text']['above']['height'] + 12; @@ -280,7 +280,7 @@ } $below = $this->getBelowText(); - if (strlen($below)) { + if (@strlen($below)) { $x = (int)floor(($dx - $metrics['text']['below']['width']) / 2); $y = $dy - 12 - $metrics['text']['below']['descend']; diff --git a/src/applications/macro/mail/PhabricatorMacroMailReceiver.php b/src/applications/macro/mail/PhabricatorMacroMailReceiver.php --- a/src/applications/macro/mail/PhabricatorMacroMailReceiver.php +++ b/src/applications/macro/mail/PhabricatorMacroMailReceiver.php @@ -12,7 +12,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 4); + $id = (int)@substr($pattern, 4); return id(new PhabricatorMacroQuery()) ->setViewer($viewer) diff --git a/src/applications/macro/markup/PhabricatorMemeRemarkupRule.php b/src/applications/macro/markup/PhabricatorMemeRemarkupRule.php --- a/src/applications/macro/markup/PhabricatorMemeRemarkupRule.php +++ b/src/applications/macro/markup/PhabricatorMemeRemarkupRule.php @@ -61,14 +61,14 @@ $parts = array(); $above = $options['above']; - if (strlen($above)) { + if (@strlen($above)) { $parts[] = pht('"%s"', $above); } $parts[] = $options['src'].' <'.$uri.'>'; $below = $options['below']; - if (strlen($below)) { + if (@strlen($below)) { $parts[] = pht('"%s"', $below); } diff --git a/src/applications/macro/query/PhabricatorMacroQuery.php b/src/applications/macro/query/PhabricatorMacroQuery.php --- a/src/applications/macro/query/PhabricatorMacroQuery.php +++ b/src/applications/macro/query/PhabricatorMacroQuery.php @@ -128,7 +128,7 @@ $this->authorPHIDs); } - if (strlen($this->nameLike)) { + if (@strlen($this->nameLike)) { $where[] = qsprintf( $conn, 'm.name LIKE %~', @@ -142,7 +142,7 @@ $this->names); } - if (strlen($this->namePrefix)) { + if (@strlen($this->namePrefix)) { $where[] = qsprintf( $conn, 'm.name LIKE %>', diff --git a/src/applications/macro/query/PhabricatorMacroSearchEngine.php b/src/applications/macro/query/PhabricatorMacroSearchEngine.php --- a/src/applications/macro/query/PhabricatorMacroSearchEngine.php +++ b/src/applications/macro/query/PhabricatorMacroSearchEngine.php @@ -69,7 +69,7 @@ $query->withNames($map['names']); } - if (strlen($map['nameLike'])) { + if (@strlen($map['nameLike'])) { $query->withNameLike($map['nameLike']); } diff --git a/src/applications/macro/xaction/PhabricatorMacroNameTransaction.php b/src/applications/macro/xaction/PhabricatorMacroNameTransaction.php --- a/src/applications/macro/xaction/PhabricatorMacroNameTransaction.php +++ b/src/applications/macro/xaction/PhabricatorMacroNameTransaction.php @@ -45,7 +45,7 @@ $old_value = $this->generateOldValue($object); $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The name can be no longer than %s characters.', @@ -83,12 +83,12 @@ } public static function isValidMacroName($name) { - if (preg_match('/^[:_-]+\z/', $name)) { + if (@preg_match('/^[:_-]+\z/', $name)) { return false; } // Accept trivial macro names. - if (preg_match('/^[a-z0-9:_-]{3,}\z/', $name)) { + if (@preg_match('/^[a-z0-9:_-]{3,}\z/', $name)) { return true; } @@ -105,7 +105,7 @@ continue; } - if (preg_match('/^[^a-z0-9:_-]/', $character)) { + if (@preg_match('/^[^a-z0-9:_-]/', $character)) { return false; } } diff --git a/src/applications/maniphest/constants/ManiphestTaskPriority.php b/src/applications/maniphest/constants/ManiphestTaskPriority.php --- a/src/applications/maniphest/constants/ManiphestTaskPriority.php +++ b/src/applications/maniphest/constants/ManiphestTaskPriority.php @@ -183,12 +183,12 @@ } private static function isValidPriorityKeyword($keyword) { - if (!strlen($keyword) || strlen($keyword) > 64) { + if (!@strlen($keyword) || @strlen($keyword) > 64) { return false; } // Alphanumeric, but not exclusively numeric - if (!preg_match('/^(?![0-9]*$)[a-zA-Z0-9]+$/', $keyword)) { + if (!@preg_match('/^(?![0-9]*$)[a-zA-Z0-9]+$/', $keyword)) { return false; } return true; diff --git a/src/applications/maniphest/constants/ManiphestTaskStatus.php b/src/applications/maniphest/constants/ManiphestTaskStatus.php --- a/src/applications/maniphest/constants/ManiphestTaskStatus.php +++ b/src/applications/maniphest/constants/ManiphestTaskStatus.php @@ -244,12 +244,12 @@ * @task validate */ public static function isValidStatusConstant($constant) { - if (!strlen($constant) || strlen($constant) > 64) { + if (!@strlen($constant) || @strlen($constant) > 64) { return false; } // Alphanumeric, but not exclusively numeric - if (!preg_match('/^(?![0-9]*$)[a-zA-Z0-9]+$/', $constant)) { + if (!@preg_match('/^(?![0-9]*$)[a-zA-Z0-9]+$/', $constant)) { return false; } return true; diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -411,7 +411,7 @@ $section = null; $description = $task->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $section = new PHUIPropertyListView(); $section->addTextContent( phutil_tag( diff --git a/src/applications/maniphest/mail/ManiphestTaskMailReceiver.php b/src/applications/maniphest/mail/ManiphestTaskMailReceiver.php --- a/src/applications/maniphest/mail/ManiphestTaskMailReceiver.php +++ b/src/applications/maniphest/mail/ManiphestTaskMailReceiver.php @@ -12,7 +12,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 1); + $id = (int)@substr($pattern, 1); return id(new ManiphestTaskQuery()) ->setViewer($viewer) diff --git a/src/applications/maniphest/phid/ManiphestTaskPHIDType.php b/src/applications/maniphest/phid/ManiphestTaskPHIDType.php --- a/src/applications/maniphest/phid/ManiphestTaskPHIDType.php +++ b/src/applications/maniphest/phid/ManiphestTaskPHIDType.php @@ -45,7 +45,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^T\d*[1-9]\d*$/i', $name); + return @preg_match('/^T\d*[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -54,7 +54,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php --- a/src/applications/maniphest/query/ManiphestTaskQuery.php +++ b/src/applications/maniphest/query/ManiphestTaskQuery.php @@ -1030,13 +1030,13 @@ // Split a "123.PHID-PROJ-abcd" cursor into a "Task ID" part and a // "Project PHID" part. - $parts = explode('.', $cursor, 2); + $parts = @explode('.', $cursor, 2); if (count($parts) < 2) { $parts[] = null; } - if (!strlen($parts[1])) { + if (!@strlen($parts[1])) { $parts[1] = null; } diff --git a/src/applications/maniphest/xaction/ManiphestTaskOwnerTransaction.php b/src/applications/maniphest/xaction/ManiphestTaskOwnerTransaction.php --- a/src/applications/maniphest/xaction/ManiphestTaskOwnerTransaction.php +++ b/src/applications/maniphest/xaction/ManiphestTaskOwnerTransaction.php @@ -112,7 +112,7 @@ foreach ($xactions as $xaction) { $old = $xaction->getOldValue(); $new = $xaction->getNewValue(); - if (!strlen($new)) { + if (!@strlen($new)) { continue; } diff --git a/src/applications/maniphest/xaction/ManiphestTaskPointsTransaction.php b/src/applications/maniphest/xaction/ManiphestTaskPointsTransaction.php --- a/src/applications/maniphest/xaction/ManiphestTaskPointsTransaction.php +++ b/src/applications/maniphest/xaction/ManiphestTaskPointsTransaction.php @@ -77,7 +77,7 @@ foreach ($xactions as $xaction) { $new = $xaction->getNewValue(); - if (strlen($new) && !is_numeric($new)) { + if (@strlen($new) && !is_numeric($new)) { $errors[] = $this->newInvalidError( pht('Points value must be numeric or empty.')); continue; @@ -98,7 +98,7 @@ } private function getValueForPoints($value) { - if (!strlen($value)) { + if (!@strlen($value)) { $value = null; } if ($value !== null) { diff --git a/src/applications/maniphest/xaction/ManiphestTaskTitleTransaction.php b/src/applications/maniphest/xaction/ManiphestTaskTitleTransaction.php --- a/src/applications/maniphest/xaction/ManiphestTaskTitleTransaction.php +++ b/src/applications/maniphest/xaction/ManiphestTaskTitleTransaction.php @@ -20,7 +20,7 @@ public function getActionName() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht('Created'); } @@ -30,7 +30,7 @@ public function getTitle() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s created this task.', $this->renderAuthor()); @@ -72,7 +72,7 @@ foreach ($xactions as $xaction) { $new = $xaction->getNewValue(); - if (!strlen($new)) { + if (!@strlen($new)) { $errors[] = $this->newInvalidError( pht('Tasks must have a title.'), $xaction); diff --git a/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php b/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php --- a/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php +++ b/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php @@ -114,7 +114,7 @@ } $overview = $application->getOverview(); - if (strlen($overview)) { + if (@strlen($overview)) { $overview = new PHUIRemarkupView($viewer, $overview); $properties->addSectionHeader( pht('Overview'), PHUIPropertyListView::ICON_SUMMARY); diff --git a/src/applications/meta/engineextension/PhabricatorDatasourceURIEngineExtension.php b/src/applications/meta/engineextension/PhabricatorDatasourceURIEngineExtension.php --- a/src/applications/meta/engineextension/PhabricatorDatasourceURIEngineExtension.php +++ b/src/applications/meta/engineextension/PhabricatorDatasourceURIEngineExtension.php @@ -32,7 +32,7 @@ // no trailing slash, there may be no path. Redirecting to the empty // string is considered an error by safety checks during redirection, // so treat this like the user entered the URI with a trailing slash. - if (!strlen($uri)) { + if (!@strlen($uri)) { $uri = '/'; } diff --git a/src/applications/meta/engineextension/PhabricatorSelfHyperlinkEngineExtension.php b/src/applications/meta/engineextension/PhabricatorSelfHyperlinkEngineExtension.php --- a/src/applications/meta/engineextension/PhabricatorSelfHyperlinkEngineExtension.php +++ b/src/applications/meta/engineextension/PhabricatorSelfHyperlinkEngineExtension.php @@ -25,7 +25,7 @@ $matches = null; $path = $uri->getPath(); - if (!preg_match('(^/([^/]+)\z)', $path, $matches)) { + if (!@preg_match('(^/([^/]+)\z)', $path, $matches)) { continue; } diff --git a/src/applications/meta/query/PhabricatorAppSearchEngine.php b/src/applications/meta/query/PhabricatorAppSearchEngine.php --- a/src/applications/meta/query/PhabricatorAppSearchEngine.php +++ b/src/applications/meta/query/PhabricatorAppSearchEngine.php @@ -45,7 +45,7 @@ ->withUnlisted(false); $name = $saved->getParameter('name'); - if (strlen($name)) { + if (@strlen($name)) { $query->withNameContains($name); } diff --git a/src/applications/meta/query/PhabricatorApplicationQuery.php b/src/applications/meta/query/PhabricatorApplicationQuery.php --- a/src/applications/meta/query/PhabricatorApplicationQuery.php +++ b/src/applications/meta/query/PhabricatorApplicationQuery.php @@ -89,7 +89,7 @@ } } - if (strlen($this->nameContains)) { + if (@strlen($this->nameContains)) { foreach ($apps as $key => $app) { if (stripos($app->getName(), $this->nameContains) === false) { unset($apps[$key]); diff --git a/src/applications/metamta/adapter/PhabricatorMailAdapter.php b/src/applications/metamta/adapter/PhabricatorMailAdapter.php --- a/src/applications/metamta/adapter/PhabricatorMailAdapter.php +++ b/src/applications/metamta/adapter/PhabricatorMailAdapter.php @@ -161,7 +161,7 @@ $host = phutil_utf8_strtolower($host); foreach ($host_blocklist as $regexp) { - if (preg_match($regexp, $host)) { + if (@preg_match($regexp, $host)) { return false; } } diff --git a/src/applications/metamta/adapter/PhabricatorMailSMTPAdapter.php b/src/applications/metamta/adapter/PhabricatorMailSMTPAdapter.php --- a/src/applications/metamta/adapter/PhabricatorMailSMTPAdapter.php +++ b/src/applications/metamta/adapter/PhabricatorMailSMTPAdapter.php @@ -62,7 +62,7 @@ $smtp->Host = $this->getOption('host'); $smtp->Port = $this->getOption('port'); $user = $this->getOption('user'); - if (strlen($user)) { + if (@strlen($user)) { $smtp->SMTPAuth = true; $smtp->Username = $user; $smtp->Password = $this->getOption('password'); diff --git a/src/applications/metamta/adapter/PhabricatorMailTestAdapter.php b/src/applications/metamta/adapter/PhabricatorMailTestAdapter.php --- a/src/applications/metamta/adapter/PhabricatorMailTestAdapter.php +++ b/src/applications/metamta/adapter/PhabricatorMailTestAdapter.php @@ -111,7 +111,7 @@ $guts['ccs'] = $cc; $subject = $message->getSubject(); - if (strlen($subject)) { + if (@strlen($subject)) { $guts['subject'] = $subject; } @@ -126,12 +126,12 @@ $guts['headers'] = $header_list; $text_body = $message->getTextBody(); - if (strlen($text_body)) { + if (@strlen($text_body)) { $guts['body'] = $text_body; } $html_body = $message->getHTMLBody(); - if (strlen($html_body)) { + if (@strlen($html_body)) { $guts['html-body'] = $html_body; } diff --git a/src/applications/metamta/applicationpanel/PhabricatorMetaMTAApplicationEmailPanel.php b/src/applications/metamta/applicationpanel/PhabricatorMetaMTAApplicationEmailPanel.php --- a/src/applications/metamta/applicationpanel/PhabricatorMetaMTAApplicationEmailPanel.php +++ b/src/applications/metamta/applicationpanel/PhabricatorMetaMTAApplicationEmailPanel.php @@ -50,7 +50,7 @@ $application = $this->getApplication(); $path = $request->getURIData('path'); - if (strlen($path)) { + if (@strlen($path)) { return new Aphront404Response(); } 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 @@ -419,7 +419,7 @@ $properties->addProperty(pht('Message PHID'), $mail->getPHID()); $details = $mail->getMessage(); - if (!strlen($details)) { + if (!@strlen($details)) { $details = phutil_tag('em', array(), pht('None')); } $properties->addProperty(pht('Status Details'), $details); diff --git a/src/applications/metamta/controller/PhabricatorMetaMTAMailgunReceiveController.php b/src/applications/metamta/controller/PhabricatorMetaMTAMailgunReceiveController.php --- a/src/applications/metamta/controller/PhabricatorMetaMTAMailgunReceiveController.php +++ b/src/applications/metamta/controller/PhabricatorMetaMTAMailgunReceiveController.php @@ -47,7 +47,7 @@ $raw_headers = $request->getStr('message-headers'); $raw_dict = array(); - if (strlen($raw_headers)) { + if (@strlen($raw_headers)) { $raw_headers = phutil_json_decode($raw_headers); foreach ($raw_headers as $raw_header) { list($name, $value) = $raw_header; diff --git a/src/applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php b/src/applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php --- a/src/applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php +++ b/src/applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php @@ -27,10 +27,10 @@ $user = $request->getUser(); $raw_headers = $request->getStr('headers'); - $raw_headers = explode("\n", rtrim($raw_headers)); + $raw_headers = @explode("\n", rtrim($raw_headers)); $raw_dict = array(); foreach (array_filter($raw_headers) as $header) { - list($name, $value) = explode(':', $header, 2); + list($name, $value) = @explode(':', $header, 2); $raw_dict[$name] = ltrim($value); } diff --git a/src/applications/metamta/editor/PhabricatorMetaMTAApplicationEmailEditor.php b/src/applications/metamta/editor/PhabricatorMetaMTAApplicationEmailEditor.php --- a/src/applications/metamta/editor/PhabricatorMetaMTAApplicationEmailEditor.php +++ b/src/applications/metamta/editor/PhabricatorMetaMTAApplicationEmailEditor.php @@ -93,7 +93,7 @@ case PhabricatorMetaMTAApplicationEmailTransaction::TYPE_ADDRESS: foreach ($xactions as $xaction) { $email = $xaction->getNewValue(); - if (!strlen($email)) { + if (!@strlen($email)) { // We'll deal with this below. continue; } diff --git a/src/applications/metamta/engine/PhabricatorMailEmailEngine.php b/src/applications/metamta/engine/PhabricatorMailEmailEngine.php --- a/src/applications/metamta/engine/PhabricatorMailEmailEngine.php +++ b/src/applications/metamta/engine/PhabricatorMailEmailEngine.php @@ -91,7 +91,7 @@ $parts = array(); $encrypt_uri = $mail->getMustEncryptURI(); - if (!strlen($encrypt_uri)) { + if (!@strlen($encrypt_uri)) { $encrypt_phid = $mail->getRelatedPHID(); if ($encrypt_phid) { $encrypt_uri = urisprintf( @@ -100,7 +100,7 @@ } } - if (strlen($encrypt_uri)) { + if (@strlen($encrypt_uri)) { $parts[] = pht( 'This secure message is notifying you of a change to this object:'); $parts[] = PhabricatorEnv::getProductionURI($encrypt_uri); @@ -119,7 +119,7 @@ } $body_limit = PhabricatorEnv::getEnvConfig('metamta.email-body-limit'); - if (strlen($body) > $body_limit) { + if (@strlen($body) > $body_limit) { $body = id(new PhutilUTF8StringTruncator()) ->setMaximumBytes($body_limit) ->truncateString($body); @@ -127,7 +127,7 @@ $body .= pht('(This email was truncated at %d bytes.)', $body_limit); } $message->setTextBody($body); - $body_limit -= strlen($body); + $body_limit -= @strlen($body); // If we sent a different message body than we were asked to, record // what we actually sent to make debugging and diagnostics easier. @@ -143,13 +143,13 @@ if ($send_html) { $html_body = $mail->getHTMLBody(); - if (strlen($html_body)) { + if (@strlen($html_body)) { // NOTE: We just drop the entire HTML body if it won't fit. Safely // truncating HTML is hard, and we already have the text body to fall // back to. - if (strlen($html_body) <= $body_limit) { + if (@strlen($html_body) <= $body_limit) { $message->setHTMLBody($html_body); - $body_limit -= strlen($html_body); + $body_limit -= @strlen($html_body); } } } @@ -226,7 +226,7 @@ $mail = $this->getMail(); $reply_raw = $mail->getReplyTo(); - if (!strlen($reply_raw)) { + if (!@strlen($reply_raw)) { return null; } @@ -240,7 +240,7 @@ } // If we don't have a display name, fill in a default. - if (!strlen($reply_address->getDisplayName())) { + if (!@strlen($reply_address->getDisplayName())) { $reply_address->setDisplayName(pht('Phabricator')); } @@ -307,13 +307,13 @@ // a generic one. if ($must_encrypt) { $encrypt_subject = $mail->getMustEncryptSubject(); - if (!strlen($encrypt_subject)) { + if (!@strlen($encrypt_subject)) { $encrypt_subject = pht('Object Updated'); } $subject[] = $encrypt_subject; } else { $vary_prefix = $mail->getVarySubjectPrefix(); - if (strlen($vary_prefix)) { + if (@strlen($vary_prefix)) { if ($this->shouldVarySubject()) { $subject[] = $vary_prefix; } @@ -323,7 +323,7 @@ } foreach ($subject as $key => $part) { - if (!strlen($part)) { + if (!@strlen($part)) { unset($subject[$key]); } } @@ -403,7 +403,7 @@ $headers = array(); $thread_id = $mail->getThreadID(); - if (!strlen($thread_id)) { + if (!@strlen($thread_id)) { return $headers; } @@ -491,7 +491,7 @@ $object = id(new PhutilEmailAddress()) ->setAddress($address); - if (strlen($name)) { + if (@strlen($name)) { $object->setDisplayName($name); } @@ -501,14 +501,14 @@ public function newDefaultEmailAddress() { $raw_address = PhabricatorEnv::getEnvConfig('metamta.default-address'); - if (!strlen($raw_address)) { + if (!@strlen($raw_address)) { $domain = $this->newMailDomain(); $raw_address = "noreply@{$domain}"; } $address = new PhutilEmailAddress($raw_address); - if (!strlen($address->getDisplayName())) { + if (!@strlen($address->getDisplayName())) { $address->setDisplayName(pht('Phabricator')); } @@ -521,7 +521,7 @@ private function newMailDomain() { $domain = PhabricatorEnv::getEnvConfig('metamta.reply-handler-domain'); - if (strlen($domain)) { + if (@strlen($domain)) { return $domain; } @@ -622,7 +622,7 @@ // but it would be very difficult to keep track of the entire tree and this // gets us reasonable client behavior. - $base = substr(md5($seed), 0, 27); + $base = @substr(md5($seed), 0, 27); if (!$is_first_mail) { // Not totally sure, but it seems like outlook orders replies by // thread-index rather than timestamp, so to get these to show up in the diff --git a/src/applications/metamta/management/PhabricatorMailManagementReceiveTestWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementReceiveTestWorkflow.php --- a/src/applications/metamta/management/PhabricatorMailManagementReceiveTestWorkflow.php +++ b/src/applications/metamta/management/PhabricatorMailManagementReceiveTestWorkflow.php @@ -102,7 +102,7 @@ 'Cc' => implode(', ', $cc), ); - if (preg_match('/.+@.+/', $to)) { + if (@preg_match('/.+@.+/', $to)) { $header_content['to'] = $to; } else { diff --git a/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php --- a/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php +++ b/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php @@ -74,7 +74,7 @@ $viewer = $this->getViewer(); $type = $args->getArg('type'); - if (!strlen($type)) { + if (!@strlen($type)) { $type = PhabricatorMailEmailMessage::MESSAGETYPE; } @@ -121,7 +121,7 @@ foreach ($tos as $key => $username) { // If the recipient has an "@" in any noninitial position, treat this as // a raw email address. - if (preg_match('/.@/', $username)) { + if (@preg_match('/.@/', $username)) { $raw_tos[] = $username; unset($tos[$key]); continue; diff --git a/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php --- a/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php +++ b/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php @@ -65,7 +65,7 @@ foreach ($messages as $message_key => $message) { if ($args->getArg('dump-html')) { $html_body = $message->getHTMLBody(); - if (strlen($html_body)) { + if (@strlen($html_body)) { $template = "{$html_body}"; $console->writeOut("%s\n", $html_body); @@ -188,7 +188,7 @@ $info[] = null; $info[] = $this->newSectionHeader(pht('TEXT BODY')); - if (strlen($message->getBody())) { + if (@strlen($message->getBody())) { $info[] = tsprintf('%B', $message->getBody()); } else { $info[] = pht('(This message has no text body.)'); @@ -203,7 +203,7 @@ $info[] = null; $info[] = $this->newSectionHeader(pht('HTML BODY')); - if (strlen($message->getHTMLBody())) { + if (@strlen($message->getHTMLBody())) { $info[] = $message->getHTMLBody(); $info[] = null; } else { diff --git a/src/applications/metamta/message/PhabricatorPhoneNumber.php b/src/applications/metamta/message/PhabricatorPhoneNumber.php --- a/src/applications/metamta/message/PhabricatorPhoneNumber.php +++ b/src/applications/metamta/message/PhabricatorPhoneNumber.php @@ -8,7 +8,7 @@ public function __construct($raw_number) { $number = preg_replace('/[^\d]+/', '', $raw_number); - if (!preg_match('/^[1-9]\d{9,14}\z/', $number)) { + if (!@preg_match('/^[1-9]\d{9,14}\z/', $number)) { throw new Exception( pht( 'Phone number ("%s") is not in a recognized format: expected a '. @@ -19,8 +19,8 @@ // If the number didn't start with "+" and has has 10 digits, assume it is // a US number with no country code prefix, like "(555) 555-5555". - if (!preg_match('/^[+]/', $raw_number)) { - if (strlen($number) === 10) { + if (!@preg_match('/^[+]/', $raw_number)) { + if (@strlen($number) === 10) { $number = '1'.$number; } } diff --git a/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php b/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php --- a/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php +++ b/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php @@ -55,13 +55,13 @@ $saw_command = false; $commands = array(); foreach ($lines as $key => $line) { - if (!strlen(trim($line)) && $saw_command) { + if (!@strlen(trim($line)) && $saw_command) { unset($lines[$key]); continue; } $matches = null; - if (!preg_match('/^\s*!(\w+.*$)/', $line, $matches)) { + if (!@preg_match('/^\s*!(\w+.*$)/', $line, $matches)) { break; } @@ -93,11 +93,11 @@ $start = null; $lines = phutil_split_lines($body); foreach ($lines as $key => $line) { - if (preg_match('/^\s*>?\s*On\b/', $line)) { + if (@preg_match('/^\s*>?\s*On\b/', $line)) { $start = $key; } if ($start !== null) { - if (preg_match('/\bwrote:/', $line)) { + if (@preg_match('/\bwrote:/', $line)) { $lines = array_slice($lines, 0, $start); $body = implode('', $lines); break; diff --git a/src/applications/metamta/query/PhabricatorMetaMTAActorQuery.php b/src/applications/metamta/query/PhabricatorMetaMTAActorQuery.php --- a/src/applications/metamta/query/PhabricatorMetaMTAActorQuery.php +++ b/src/applications/metamta/query/PhabricatorMetaMTAActorQuery.php @@ -111,7 +111,7 @@ $name = $user->getUserName(); break; case 'real': - $name = strlen($user->getRealName()) ? + $name = @strlen($user->getRealName()) ? $user->getRealName() : $user->getUserName(); break; case 'full': diff --git a/src/applications/metamta/receiver/PhabricatorObjectMailReceiver.php b/src/applications/metamta/receiver/PhabricatorObjectMailReceiver.php --- a/src/applications/metamta/receiver/PhabricatorObjectMailReceiver.php +++ b/src/applications/metamta/receiver/PhabricatorObjectMailReceiver.php @@ -158,7 +158,7 @@ $regexp = $this->getAddressRegexp(); $matches = null; - if (!preg_match($regexp, $local, $matches)) { + if (!@preg_match($regexp, $local, $matches)) { return false; } @@ -184,7 +184,7 @@ $hash = PhabricatorHash::digestWithNamedKey( $mail_key.$phid, 'mail.object-address-key'); - return substr($hash, 0, 16); + return @substr($hash, 0, 16); } } diff --git a/src/applications/metamta/replyhandler/PhabricatorMailTarget.php b/src/applications/metamta/replyhandler/PhabricatorMailTarget.php --- a/src/applications/metamta/replyhandler/PhabricatorMailTarget.php +++ b/src/applications/metamta/replyhandler/PhabricatorMailTarget.php @@ -62,7 +62,7 @@ $body = $mail->getBody(); $html_body = $mail->getHTMLBody(); - $has_html = (strlen($html_body) > 0); + $has_html = (@strlen($html_body) > 0); if ($show_stamps) { $stamps = $mail->getMailStamps(); diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php --- a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php +++ b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php @@ -63,7 +63,7 @@ } private function normalizeMailHeaderName($name) { - return strtolower($name); + return @strtolower($name); } public function getMessageID() { @@ -339,7 +339,7 @@ */ private function getRawEmailAddress($address) { $matches = null; - $ok = preg_match('/<(.*)>/', $address, $matches); + $ok = @preg_match('/<(.*)>/', $address, $matches); if ($ok) { $address = $matches[1]; } @@ -348,7 +348,7 @@ private function getRawEmailAddresses($addresses) { $raw_addresses = array(); - foreach (explode(',', $addresses) as $address) { + foreach (@explode(',', $addresses) as $address) { $raw_addresses[] = $this->getRawEmailAddress($address); } return array_filter($raw_addresses); @@ -416,7 +416,7 @@ $body = $this->getCleanTextBody(); $attachments = $this->getAttachments(); - if (strlen($body) || $attachments) { + if (@strlen($body) || $attachments) { return; } @@ -522,7 +522,7 @@ public function newFromAddress() { $raw_from = $this->getHeader('From'); - if (strlen($raw_from)) { + if (@strlen($raw_from)) { return new PhutilEmailAddress($raw_from); } diff --git a/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php b/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php --- a/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php +++ b/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php @@ -389,13 +389,13 @@ // We expect the body was truncated, because it exceeded the body limit. $this->assertTrue( - (strlen($text_body) < strlen($string_1mb)), + (@strlen($text_body) < @strlen($string_1mb)), pht('Text Body Truncated')); // We expect the HTML body was dropped completely after the text body was // truncated. $this->assertTrue( - !strlen($html_body), + !@strlen($html_body), pht('HTML Body Removed')); @@ -416,7 +416,7 @@ $html_body = $mailer->getHTMLBody(); $this->assertEqual($string_1kb, $text_body); - $this->assertTrue(!strlen($html_body)); + $this->assertTrue(!@strlen($html_body)); } } diff --git a/src/applications/metamta/util/PhabricatorMailUtil.php b/src/applications/metamta/util/PhabricatorMailUtil.php --- a/src/applications/metamta/util/PhabricatorMailUtil.php +++ b/src/applications/metamta/util/PhabricatorMailUtil.php @@ -21,14 +21,14 @@ // If a mailbox prefix is configured and present, strip it off. $prefix_key = 'metamta.single-reply-handler-prefix'; $prefix = PhabricatorEnv::getEnvConfig($prefix_key); - $len = strlen($prefix); + $len = @strlen($prefix); if ($len) { $prefix = $prefix.'+'; $len = $len + 1; if (!strncasecmp($raw_address, $prefix, $len)) { - $raw_address = substr($raw_address, $len); + $raw_address = @substr($raw_address, $len); } } diff --git a/src/applications/metamta/view/PhabricatorMetaMTAMailBody.php b/src/applications/metamta/view/PhabricatorMetaMTAMailBody.php --- a/src/applications/metamta/view/PhabricatorMetaMTAMailBody.php +++ b/src/applications/metamta/view/PhabricatorMetaMTAMailBody.php @@ -45,7 +45,7 @@ * @task compose */ public function addRawSection($text) { - if (strlen($text)) { + if (@strlen($text)) { $text = rtrim($text); $this->sections[] = $text; $this->htmlSections[] = phutil_escape_html_newlines( @@ -81,7 +81,7 @@ } public function addRawPlaintextSection($text) { - if (strlen($text)) { + if (@strlen($text)) { $text = rtrim($text); $this->sections[] = $text; } diff --git a/src/applications/multimeter/controller/MultimeterSampleController.php b/src/applications/multimeter/controller/MultimeterSampleController.php --- a/src/applications/multimeter/controller/MultimeterSampleController.php +++ b/src/applications/multimeter/controller/MultimeterSampleController.php @@ -10,7 +10,7 @@ $viewer = $this->getViewer(); $group_map = $this->getColumnMap(); - $group = explode('.', $request->getStr('group')); + $group = @explode('.', $request->getStr('group')); $group = array_intersect($group, array_keys($group_map)); $group = array_fuse($group); @@ -299,7 +299,7 @@ $uri = clone $this->getRequest()->getRequestURI(); $group = implode('.', $group); - if (!strlen($group)) { + if (!@strlen($group)) { $uri->removeQueryParam('group'); } else { $uri->replaceQueryParam('group', $group); @@ -342,7 +342,7 @@ private function getEventViewerPHID($viewer_name) { if (!strncmp($viewer_name, 'user.', 5)) { - return substr($viewer_name, 5); + return @substr($viewer_name, 5); } return null; } diff --git a/src/applications/notification/client/PhabricatorNotificationServerRef.php b/src/applications/notification/client/PhabricatorNotificationServerRef.php --- a/src/applications/notification/client/PhabricatorNotificationServerRef.php +++ b/src/applications/notification/client/PhabricatorNotificationServerRef.php @@ -152,7 +152,7 @@ ->setPath($full_path); $instance = PhabricatorEnv::getEnvConfig('cluster.instance'); - if (strlen($instance)) { + if (@strlen($instance)) { $uri->replaceQueryParam('instance', $instance); } @@ -161,7 +161,7 @@ public function getWebsocketURI($to_path = null) { $instance = PhabricatorEnv::getEnvConfig('cluster.instance'); - if (strlen($instance)) { + if (@strlen($instance)) { $to_path = $to_path.'~'.$instance.'/'; } diff --git a/src/applications/notification/config/PhabricatorNotificationServersConfigType.php b/src/applications/notification/config/PhabricatorNotificationServersConfigType.php --- a/src/applications/notification/config/PhabricatorNotificationServersConfigType.php +++ b/src/applications/notification/config/PhabricatorNotificationServersConfigType.php @@ -92,7 +92,7 @@ } $path = idx($spec, 'path'); - if ($type == 'admin' && strlen($path)) { + if ($type == 'admin' && @strlen($path)) { throw $this->newException( pht( 'Notification server configuration describes an invalid host '. diff --git a/src/applications/nuance/cursor/NuanceGitHubImportCursor.php b/src/applications/nuance/cursor/NuanceGitHubImportCursor.php --- a/src/applications/nuance/cursor/NuanceGitHubImportCursor.php +++ b/src/applications/nuance/cursor/NuanceGitHubImportCursor.php @@ -204,7 +204,7 @@ $now = PhabricatorTime::getNow(); $limit_ttl = null; - if (strlen($remaining)) { + if (@strlen($remaining)) { $remaining = (int)$remaining; if (!$remaining) { $limit_ttl = (int)$limit_reset; diff --git a/src/applications/nuance/github/NuanceGitHubRawEvent.php b/src/applications/nuance/github/NuanceGitHubRawEvent.php --- a/src/applications/nuance/github/NuanceGitHubRawEvent.php +++ b/src/applications/nuance/github/NuanceGitHubRawEvent.php @@ -164,7 +164,7 @@ $raw = $this->raw; $full = idxv($raw, array('repo', 'name')); - if (strlen($full)) { + if (@strlen($full)) { return $full; } @@ -172,7 +172,7 @@ // response body. Parse it out of the URI. $matches = null; - $ok = preg_match( + $ok = @preg_match( '(/repos/((?:[^/]+)/(?:[^/]+))/issues/events/)', idx($raw, 'url'), $matches); @@ -269,8 +269,8 @@ break; case 'PushEvent': $ref = idxv($raw, array('payload', 'ref')); - if (preg_match('(^refs/heads/)', $ref)) { - return pht('Branch %s', substr($ref, strlen('refs/heads/'))); + if (@preg_match('(^refs/heads/)', $ref)) { + return pht('Branch %s', @substr($ref, @strlen('refs/heads/'))); } else { return pht('Ref %s', $ref); } @@ -348,7 +348,7 @@ return pht('Created'); case 'PushEvent': $head = idxv($raw, array('payload', 'head')); - $head = substr($head, 0, 12); + $head = @substr($head, 0, 12); return pht('Pushed: %s', $head); case 'IssuesEvent': $action = idxv($raw, array('payload', 'action')); diff --git a/src/applications/nuance/item/NuanceGitHubEventItemType.php b/src/applications/nuance/item/NuanceGitHubEventItemType.php --- a/src/applications/nuance/item/NuanceGitHubEventItemType.php +++ b/src/applications/nuance/item/NuanceGitHubEventItemType.php @@ -69,7 +69,7 @@ $raw = $this->newRawEvent($item); $full_repository = $raw->getRepositoryFullName(); - if (!strlen($full_repository)) { + if (!@strlen($full_repository)) { return null; } @@ -386,7 +386,7 @@ ->setBridgedObjectPHID($xobj_phid); $title = $xobj->getProperty('task.title'); - if (!strlen($title)) { + if (!@strlen($title)) { $title = pht('Nuance Item %d Task', $item->getID()); } @@ -413,7 +413,7 @@ $event = $this->newRawEvent($item); $comment = $event->getComment(); - if (strlen($comment)) { + if (@strlen($comment)) { $xactions[] = id(new ManiphestTransaction()) ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) ->attachComment( diff --git a/src/applications/nuance/management/NuanceManagementImportWorkflow.php b/src/applications/nuance/management/NuanceManagementImportWorkflow.php --- a/src/applications/nuance/management/NuanceManagementImportWorkflow.php +++ b/src/applications/nuance/management/NuanceManagementImportWorkflow.php @@ -46,7 +46,7 @@ } $select = $args->getArg('cursor'); - if (strlen($select)) { + if (@strlen($select)) { if (empty($cursors[$select])) { throw new PhutilArgumentUsageException( pht( diff --git a/src/applications/nuance/management/NuanceManagementWorkflow.php b/src/applications/nuance/management/NuanceManagementWorkflow.php --- a/src/applications/nuance/management/NuanceManagementWorkflow.php +++ b/src/applications/nuance/management/NuanceManagementWorkflow.php @@ -5,7 +5,7 @@ protected function loadSource(PhutilArgumentParser $argv, $key) { $source = $argv->getArg($key); - if (!strlen($source)) { + if (!@strlen($source)) { throw new PhutilArgumentUsageException( pht( 'Specify a source with %s.', @@ -66,7 +66,7 @@ protected function loadITem(PhutilArgumentParser $argv, $key) { $item = $argv->getArg($key); - if (!strlen($item)) { + if (!@strlen($item)) { throw new PhutilArgumentUsageException( pht( 'Specify a item with %s.', diff --git a/src/applications/nuance/source/NuanceSourceDefinition.php b/src/applications/nuance/source/NuanceSourceDefinition.php --- a/src/applications/nuance/source/NuanceSourceDefinition.php +++ b/src/applications/nuance/source/NuanceSourceDefinition.php @@ -77,7 +77,7 @@ } $key = $cursor->getCursorKey(); - if (!strlen($key)) { + if (!@strlen($key)) { throw new Exception( pht( 'Source "%s" (of class "%s") returned an import cursor with '. diff --git a/src/applications/nuance/xaction/NuanceQueueNameTransaction.php b/src/applications/nuance/xaction/NuanceQueueNameTransaction.php --- a/src/applications/nuance/xaction/NuanceQueueNameTransaction.php +++ b/src/applications/nuance/xaction/NuanceQueueNameTransaction.php @@ -32,7 +32,7 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/nuance/xaction/NuanceSourceNameTransaction.php b/src/applications/nuance/xaction/NuanceSourceNameTransaction.php --- a/src/applications/nuance/xaction/NuanceSourceNameTransaction.php +++ b/src/applications/nuance/xaction/NuanceSourceNameTransaction.php @@ -32,7 +32,7 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/oauthserver/PhabricatorOAuthServer.php b/src/applications/oauthserver/PhabricatorOAuthServer.php --- a/src/applications/oauthserver/PhabricatorOAuthServer.php +++ b/src/applications/oauthserver/PhabricatorOAuthServer.php @@ -201,7 +201,7 @@ $uri = new PhutilURI($raw_uri); $fragment = $uri->getFragment(); - if (strlen($fragment)) { + if (@strlen($fragment)) { throw new Exception( pht( 'OAuth application redirect URIs must not contain URI '. @@ -272,8 +272,8 @@ // defuses an attack where a third party with control over the network // tricks you into using HTTP to authenticate over a link which is supposed // to be HTTPS only and sniffs all your token cookies. - if (strtolower($primary_uri->getProtocol()) == 'https') { - if (strtolower($secondary_uri->getProtocol()) != 'https') { + if (@strtolower($primary_uri->getProtocol()) == 'https') { + if (@strtolower($secondary_uri->getProtocol()) != 'https') { return false; } } diff --git a/src/applications/oauthserver/controller/PhabricatorOAuthServerAuthController.php b/src/applications/oauthserver/controller/PhabricatorOAuthServerAuthController.php --- a/src/applications/oauthserver/controller/PhabricatorOAuthServerAuthController.php +++ b/src/applications/oauthserver/controller/PhabricatorOAuthServerAuthController.php @@ -305,7 +305,7 @@ $full_uri = clone $uri; foreach ($params as $key => $value) { - if (strlen($value)) { + if (@strlen($value)) { $full_uri->replaceQueryParam($key, $value); } } diff --git a/src/applications/oauthserver/controller/PhabricatorOAuthServerTokenController.php b/src/applications/oauthserver/controller/PhabricatorOAuthServerTokenController.php --- a/src/applications/oauthserver/controller/PhabricatorOAuthServerTokenController.php +++ b/src/applications/oauthserver/controller/PhabricatorOAuthServerTokenController.php @@ -23,7 +23,7 @@ $client_id_parameter = $request->getStr('client_id'); $client_id_header = idx($_SERVER, 'PHP_AUTH_USER'); - if (strlen($client_id_parameter) && strlen($client_id_header)) { + if (@strlen($client_id_parameter) && @strlen($client_id_header)) { if ($client_id_parameter !== $client_id_header) { throw new Exception( pht( @@ -37,7 +37,7 @@ $client_secret_parameter = $request->getStr('client_secret'); $client_secret_header = idx($_SERVER, 'PHP_AUTH_PW'); - if (strlen($client_secret_parameter)) { + if (@strlen($client_secret_parameter)) { // If the `client_secret` parameter is present, prefer parameters. $client_phid = $client_id_parameter; $client_secret = $client_secret_parameter; diff --git a/src/applications/owners/controller/PhabricatorOwnersDetailController.php b/src/applications/owners/controller/PhabricatorOwnersDetailController.php --- a/src/applications/owners/controller/PhabricatorOwnersDetailController.php +++ b/src/applications/owners/controller/PhabricatorOwnersDetailController.php @@ -217,7 +217,7 @@ $view->addProperty(pht('Ignored Attributes'), $ignored); $description = $package->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $description = new PHUIRemarkupView($viewer, $description); $view->addSectionHeader(pht('Description')); $view->addTextContent($description); diff --git a/src/applications/owners/controller/PhabricatorOwnersPathsController.php b/src/applications/owners/controller/PhabricatorOwnersPathsController.php --- a/src/applications/owners/controller/PhabricatorOwnersPathsController.php +++ b/src/applications/owners/controller/PhabricatorOwnersPathsController.php @@ -27,7 +27,7 @@ $path_refs = array(); foreach ($paths as $key => $path) { - if (!isset($repos[$key]) || !strlen($repos[$key])) { + if (!isset($repos[$key]) || !@strlen($repos[$key])) { throw new Exception( pht( 'No repository PHID for path "%s"!', diff --git a/src/applications/owners/engineextension/PhabricatorOwnersHovercardEngineExtension.php b/src/applications/owners/engineextension/PhabricatorOwnersHovercardEngineExtension.php --- a/src/applications/owners/engineextension/PhabricatorOwnersHovercardEngineExtension.php +++ b/src/applications/owners/engineextension/PhabricatorOwnersHovercardEngineExtension.php @@ -76,7 +76,7 @@ $viewer->renderHandleList($owner_phids)->setAsInline(true)); $description = $package->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $description = id(new PhutilUTF8StringTruncator()) ->setMaximumGlyphs(120) ->truncateString($description); diff --git a/src/applications/owners/lipsum/PhabricatorOwnersPackageTestDataGenerator.php b/src/applications/owners/lipsum/PhabricatorOwnersPackageTestDataGenerator.php --- a/src/applications/owners/lipsum/PhabricatorOwnersPackageTestDataGenerator.php +++ b/src/applications/owners/lipsum/PhabricatorOwnersPackageTestDataGenerator.php @@ -52,7 +52,7 @@ $paths = id(new PhabricatorOwnersPathContextFreeGrammar()) ->generateSeveral($path_count, "\n"); - $paths = explode("\n", $paths); + $paths = @explode("\n", $paths); $paths = array_unique($paths); $repository_phid = $this->loadOneRandom('PhabricatorRepository') diff --git a/src/applications/owners/phid/PhabricatorOwnersPackagePHIDType.php b/src/applications/owners/phid/PhabricatorOwnersPackagePHIDType.php --- a/src/applications/owners/phid/PhabricatorOwnersPackagePHIDType.php +++ b/src/applications/owners/phid/PhabricatorOwnersPackagePHIDType.php @@ -55,7 +55,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^O\d*[1-9]\d*$/i', $name); + return @preg_match('/^O\d*[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -64,7 +64,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/owners/query/PhabricatorOwnersPackageSearchEngine.php b/src/applications/owners/query/PhabricatorOwnersPackageSearchEngine.php --- a/src/applications/owners/query/PhabricatorOwnersPackageSearchEngine.php +++ b/src/applications/owners/query/PhabricatorOwnersPackageSearchEngine.php @@ -73,7 +73,7 @@ $query->withStatuses($map['statuses']); } - if (strlen($map['name'])) { + if (@strlen($map['name'])) { $query->withNameNgrams($map['name']); } diff --git a/src/applications/owners/storage/PhabricatorOwnersPackage.php b/src/applications/owners/storage/PhabricatorOwnersPackage.php --- a/src/applications/owners/storage/PhabricatorOwnersPackage.php +++ b/src/applications/owners/storage/PhabricatorOwnersPackage.php @@ -364,7 +364,7 @@ foreach ($rows as $row) { $id = $row['id']; $path = $row['path']; - $length = strlen($path); + $length = @strlen($path); $excluded = $row['excluded']; if ($row['dominion'] === self::DOMINION_WEAK) { @@ -485,10 +485,10 @@ '/', ); - $parts = explode('/', $path); + $parts = @explode('/', $path); $buffer = '/'; foreach ($parts as $part) { - if (!strlen($part)) { + if (!@strlen($part)) { continue; } diff --git a/src/applications/owners/storage/__tests__/PhabricatorOwnersPackageTestCase.php b/src/applications/owners/storage/__tests__/PhabricatorOwnersPackageTestCase.php --- a/src/applications/owners/storage/__tests__/PhabricatorOwnersPackageTestCase.php +++ b/src/applications/owners/storage/__tests__/PhabricatorOwnersPackageTestCase.php @@ -30,8 +30,8 @@ ); $this->assertEqual( array( - 1 => strlen('src/'), - 2 => strlen('src/releeph/'), + 1 => @strlen('src/'), + 2 => @strlen('src/releeph/'), ), PhabricatorOwnersPackage::findLongestPathsPerPackage($rows, $paths)); @@ -41,7 +41,7 @@ ); $this->assertEqual( array( - 2 => strlen('src/releeph/'), + 2 => @strlen('src/releeph/'), ), PhabricatorOwnersPackage::findLongestPathsPerPackage($rows, $paths)); @@ -75,7 +75,7 @@ $this->assertEqual( array( - 2 => strlen('src/applications/'), + 2 => @strlen('src/applications/'), ), PhabricatorOwnersPackage::findLongestPathsPerPackage($rows, $paths)); @@ -95,7 +95,7 @@ $this->assertEqual( array( - 1 => strlen('src/applications/main/'), + 1 => @strlen('src/applications/main/'), ), PhabricatorOwnersPackage::findLongestPathsPerPackage($rows, $paths)); @@ -177,7 +177,7 @@ $expect = $weak; } - $expect = array_fill_keys($expect, strlen($main_c)); + $expect = array_fill_keys($expect, @strlen($main_c)); $actual = PhabricatorOwnersPackage::findLongestPathsPerPackage( $rows, $paths); diff --git a/src/applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php b/src/applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php --- a/src/applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php +++ b/src/applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php @@ -26,7 +26,7 @@ // If the user is querying by monogram explicitly, like "O123", do an ID // search. Otherwise, do an ngram substring search. - if (preg_match('/^[oO]\d+\z/', $raw_query)) { + if (@preg_match('/^[oO]\d+\z/', $raw_query)) { $id = trim($raw_query, 'oO'); $id = (int)$id; $query->withIDs(array($id)); diff --git a/src/applications/owners/xaction/PhabricatorOwnersPackageNameTransaction.php b/src/applications/owners/xaction/PhabricatorOwnersPackageNameTransaction.php --- a/src/applications/owners/xaction/PhabricatorOwnersPackageNameTransaction.php +++ b/src/applications/owners/xaction/PhabricatorOwnersPackageNameTransaction.php @@ -24,7 +24,7 @@ foreach ($xactions as $xaction) { $new = $xaction->getNewValue(); - if (preg_match('([,!])', $new)) { + if (@preg_match('([,!])', $new)) { $errors[] = $this->newInvalidError( pht( 'Package names may not contain commas (",") or exclamation '. diff --git a/src/applications/packages/query/PhabricatorPackagesQuery.php b/src/applications/packages/query/PhabricatorPackagesQuery.php --- a/src/applications/packages/query/PhabricatorPackagesQuery.php +++ b/src/applications/packages/query/PhabricatorPackagesQuery.php @@ -13,7 +13,7 @@ $parts = array(); foreach ($full_keys as $full_key) { - $key_parts = explode('/', $full_key, 2); + $key_parts = @explode('/', $full_key, 2); if (count($key_parts) != 2) { continue; diff --git a/src/applications/packages/storage/PhabricatorPackagesPackage.php b/src/applications/packages/storage/PhabricatorPackagesPackage.php --- a/src/applications/packages/storage/PhabricatorPackagesPackage.php +++ b/src/applications/packages/storage/PhabricatorPackagesPackage.php @@ -79,7 +79,7 @@ } public static function assertValidPackageName($value) { - $length = phutil_utf8_strlen($value); + $length = phutil_utf8strlen($value); if (!$length) { throw new Exception( pht( @@ -99,7 +99,7 @@ } public static function assertValidPackageKey($value) { - $length = phutil_utf8_strlen($value); + $length = phutil_utf8strlen($value); if (!$length) { throw new Exception( pht( @@ -117,7 +117,7 @@ new PhutilNumber($max_length))); } - if (!preg_match('/^[a-z]+\z/', $value)) { + if (!@preg_match('/^[a-z]+\z/', $value)) { throw new Exception( pht( 'Package key "%s" is not valid: package keys may only contain '. diff --git a/src/applications/packages/storage/PhabricatorPackagesPublisher.php b/src/applications/packages/storage/PhabricatorPackagesPublisher.php --- a/src/applications/packages/storage/PhabricatorPackagesPublisher.php +++ b/src/applications/packages/storage/PhabricatorPackagesPublisher.php @@ -55,7 +55,7 @@ } public static function assertValidPublisherName($value) { - $length = phutil_utf8_strlen($value); + $length = phutil_utf8strlen($value); if (!$length) { throw new Exception( pht( @@ -75,7 +75,7 @@ } public static function assertValidPublisherKey($value) { - $length = phutil_utf8_strlen($value); + $length = phutil_utf8strlen($value); if (!$length) { throw new Exception( pht( @@ -93,7 +93,7 @@ new PhutilNumber($max_length))); } - if (!preg_match('/^[a-z]+\z/', $value)) { + if (!@preg_match('/^[a-z]+\z/', $value)) { throw new Exception( pht( 'Publisher key "%s" is not valid: publisher keys may only contain '. diff --git a/src/applications/packages/storage/PhabricatorPackagesVersion.php b/src/applications/packages/storage/PhabricatorPackagesVersion.php --- a/src/applications/packages/storage/PhabricatorPackagesVersion.php +++ b/src/applications/packages/storage/PhabricatorPackagesVersion.php @@ -59,7 +59,7 @@ } public static function assertValidVersionName($value) { - $length = phutil_utf8_strlen($value); + $length = phutil_utf8strlen($value); if (!$length) { throw new Exception( pht( @@ -77,7 +77,7 @@ new PhutilNumber($max_length))); } - if (!preg_match('/^[A-Za-z0-9.-]+\z/', $value)) { + if (!@preg_match('/^[A-Za-z0-9.-]+\z/', $value)) { throw new Exception( pht( 'Version name "%s" is not valid: version names may only contain '. @@ -85,7 +85,7 @@ $value)); } - if (preg_match('/^[.-]|[.-]$/', $value)) { + if (@preg_match('/^[.-]|[.-]$/', $value)) { throw new Exception( pht( 'Version name "%s" is not valid: version names may not start or '. diff --git a/src/applications/passphrase/controller/PassphraseCredentialEditController.php b/src/applications/passphrase/controller/PassphraseCredentialEditController.php --- a/src/applications/passphrase/controller/PassphraseCredentialEditController.php +++ b/src/applications/passphrase/controller/PassphraseCredentialEditController.php @@ -98,7 +98,7 @@ $env_secret = new PhutilOpaqueEnvelope($v_secret); $env_password = new PhutilOpaqueEnvelope($v_password); - $has_secret = !preg_match('/^('.$bullet.')+$/', trim($v_decrypt)); + $has_secret = !@preg_match('/^('.$bullet.')+$/', trim($v_decrypt)); // Validate and repair SSH private keys, and apply passwords if they // are provided. See T13454 for discussion. @@ -112,7 +112,7 @@ if ($is_ssh && $has_secret) { $old_object = PhabricatorAuthSSHPrivateKey::newFromRawKey($env_secret); - if (strlen($v_password)) { + if (@strlen($v_password)) { $old_object->setPassphrase($env_password); } diff --git a/src/applications/passphrase/controller/PassphraseCredentialRevealController.php b/src/applications/passphrase/controller/PassphraseCredentialRevealController.php --- a/src/applications/passphrase/controller/PassphraseCredentialRevealController.php +++ b/src/applications/passphrase/controller/PassphraseCredentialRevealController.php @@ -39,7 +39,7 @@ $secret = $credential->getSecret(); if (!$secret) { $body = pht('This credential has no associated secret.'); - } else if (!strlen($secret->openEnvelope())) { + } else if (!@strlen($secret->openEnvelope())) { $body = pht('This credential has an empty secret.'); } else { $body = id(new PHUIFormLayoutView()) diff --git a/src/applications/passphrase/controller/PassphraseCredentialViewController.php b/src/applications/passphrase/controller/PassphraseCredentialViewController.php --- a/src/applications/passphrase/controller/PassphraseCredentialViewController.php +++ b/src/applications/passphrase/controller/PassphraseCredentialViewController.php @@ -196,7 +196,7 @@ } $description = $credential->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $properties->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); diff --git a/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php b/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php --- a/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php +++ b/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php @@ -45,7 +45,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^K\d*[1-9]\d*$/i', $name); + return @preg_match('/^K\d*[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -54,7 +54,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/passphrase/query/PassphraseCredentialQuery.php b/src/applications/passphrase/query/PassphraseCredentialQuery.php --- a/src/applications/passphrase/query/PassphraseCredentialQuery.php +++ b/src/applications/passphrase/query/PassphraseCredentialQuery.php @@ -148,7 +148,7 @@ (int)$this->allowConduit); } - if (strlen($this->nameContains)) { + if (@strlen($this->nameContains)) { $where[] = qsprintf( $conn, 'LOWER(c.name) LIKE %~', diff --git a/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php b/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php --- a/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php +++ b/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php @@ -37,7 +37,7 @@ $query->withIsDestroyed($map['isDestroyed']); } - if (strlen($map['name'])) { + if (@strlen($map['name'])) { $query->withNameContains($map['name']); } diff --git a/src/applications/passphrase/view/PassphraseCredentialControl.php b/src/applications/passphrase/view/PassphraseCredentialControl.php --- a/src/applications/passphrase/view/PassphraseCredentialControl.php +++ b/src/applications/passphrase/view/PassphraseCredentialControl.php @@ -50,7 +50,7 @@ // credential. Populate it into the menu to allow them to save the form // without making any changes. $current_phid = $this->getValue(); - if (strlen($current_phid) && empty($options_map[$current_phid])) { + if (@strlen($current_phid) && empty($options_map[$current_phid])) { $viewer = $this->getViewer(); $current_name = null; diff --git a/src/applications/passphrase/xaction/PassphraseCredentialDescriptionTransaction.php b/src/applications/passphrase/xaction/PassphraseCredentialDescriptionTransaction.php --- a/src/applications/passphrase/xaction/PassphraseCredentialDescriptionTransaction.php +++ b/src/applications/passphrase/xaction/PassphraseCredentialDescriptionTransaction.php @@ -15,7 +15,7 @@ public function shouldHide() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return true; } return false; diff --git a/src/applications/passphrase/xaction/PassphraseCredentialNameTransaction.php b/src/applications/passphrase/xaction/PassphraseCredentialNameTransaction.php --- a/src/applications/passphrase/xaction/PassphraseCredentialNameTransaction.php +++ b/src/applications/passphrase/xaction/PassphraseCredentialNameTransaction.php @@ -15,7 +15,7 @@ public function getTitle() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s created this credential.', $this->renderAuthor()); @@ -30,7 +30,7 @@ public function getTitleForFeed() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s created %s.', $this->renderAuthor(), @@ -57,7 +57,7 @@ foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The name can be no longer than %s characters.', diff --git a/src/applications/passphrase/xaction/PassphraseCredentialUsernameTransaction.php b/src/applications/passphrase/xaction/PassphraseCredentialUsernameTransaction.php --- a/src/applications/passphrase/xaction/PassphraseCredentialUsernameTransaction.php +++ b/src/applications/passphrase/xaction/PassphraseCredentialUsernameTransaction.php @@ -42,7 +42,7 @@ $max_length = $object->getColumnMaximumByteLength('username'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The username can be no longer than %s characters.', diff --git a/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php b/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php --- a/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php +++ b/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php @@ -43,7 +43,7 @@ $title = $request->getValue('title'); $language = $request->getValue('language'); - if (!strlen($content)) { + if (!@strlen($content)) { throw new ConduitException('ERR-NO-PASTE'); } @@ -64,7 +64,7 @@ ->setTransactionType(PhabricatorPasteTitleTransaction::TRANSACTIONTYPE) ->setNewValue($title); - if (strlen($language)) { + if (@strlen($language)) { $xactions[] = id(new PhabricatorPasteTransaction()) ->setTransactionType( PhabricatorPasteLanguageTransaction::TRANSACTIONTYPE) diff --git a/src/applications/paste/lipsum/PhabricatorPasteTestDataGenerator.php b/src/applications/paste/lipsum/PhabricatorPasteTestDataGenerator.php --- a/src/applications/paste/lipsum/PhabricatorPasteTestDataGenerator.php +++ b/src/applications/paste/lipsum/PhabricatorPasteTestDataGenerator.php @@ -22,7 +22,7 @@ PhabricatorPasteTitleTransaction::TRANSACTIONTYPE, $name); - if (strlen($language) > 0) { + if (@strlen($language) > 0) { $xactions[] = $this->newTransaction( PhabricatorPasteLanguageTransaction::TRANSACTIONTYPE, $language); diff --git a/src/applications/paste/mail/PasteMailReceiver.php b/src/applications/paste/mail/PasteMailReceiver.php --- a/src/applications/paste/mail/PasteMailReceiver.php +++ b/src/applications/paste/mail/PasteMailReceiver.php @@ -12,7 +12,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 1); + $id = (int)@substr($pattern, 1); return id(new PhabricatorPasteQuery()) ->setViewer($viewer) diff --git a/src/applications/paste/phid/PhabricatorPastePastePHIDType.php b/src/applications/paste/phid/PhabricatorPastePastePHIDType.php --- a/src/applications/paste/phid/PhabricatorPastePastePHIDType.php +++ b/src/applications/paste/phid/PhabricatorPastePastePHIDType.php @@ -42,7 +42,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^P\d*[1-9]\d*$/i', $name); + return @preg_match('/^P\d*[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -51,7 +51,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/paste/query/PhabricatorPasteQuery.php b/src/applications/paste/query/PhabricatorPasteQuery.php --- a/src/applications/paste/query/PhabricatorPasteQuery.php +++ b/src/applications/paste/query/PhabricatorPasteQuery.php @@ -359,7 +359,7 @@ $lines = phutil_split_lines($snippet); $line_count = count($lines); - if (strlen($snippet) > 1024) { + if (@strlen($snippet) > 1024) { $snippet_type = PhabricatorPasteSnippet::FIRST_BYTES; $snippet = id(new PhutilUTF8StringTruncator()) ->setMaximumBytes(1024) diff --git a/src/applications/paste/remarkup/PhabricatorPasteRemarkupRule.php b/src/applications/paste/remarkup/PhabricatorPasteRemarkupRule.php --- a/src/applications/paste/remarkup/PhabricatorPasteRemarkupRule.php +++ b/src/applications/paste/remarkup/PhabricatorPasteRemarkupRule.php @@ -26,9 +26,9 @@ ->setPaste($object) ->setHandle($handle); - if (strlen($options)) { + if (@strlen($options)) { $parser = new PhutilSimpleOptions(); - $opts = $parser->parse(substr($options, 1)); + $opts = $parser->parse(@substr($options, 1)); foreach ($opts as $key => $value) { if ($key == 'lines') { @@ -38,7 +38,7 @@ $to_highlight = array(); foreach ($highlights as $highlight) { - $highlight = explode('-', $highlight); + $highlight = @explode('-', $highlight); if (!empty($highlight)) { sort($highlight); diff --git a/src/applications/paste/xaction/PhabricatorPasteContentTransaction.php b/src/applications/paste/xaction/PhabricatorPasteContentTransaction.php --- a/src/applications/paste/xaction/PhabricatorPasteContentTransaction.php +++ b/src/applications/paste/xaction/PhabricatorPasteContentTransaction.php @@ -53,7 +53,7 @@ $editor = $this->getEditor(); $file_name = $editor->getNewPasteTitle(); - if (!strlen($file_name)) { + if (!@strlen($file_name)) { $file_name = 'raw-paste-data.txt'; } diff --git a/src/applications/paste/xaction/PhabricatorPasteLanguageTransaction.php b/src/applications/paste/xaction/PhabricatorPasteLanguageTransaction.php --- a/src/applications/paste/xaction/PhabricatorPasteLanguageTransaction.php +++ b/src/applications/paste/xaction/PhabricatorPasteLanguageTransaction.php @@ -14,7 +14,7 @@ } private function renderLanguageValue($value) { - if (!strlen($value)) { + if (!@strlen($value)) { return $this->renderValue(pht('autodetect')); } else { return $this->renderValue($value); @@ -44,7 +44,7 @@ foreach ($xactions as $xaction) { $new = $xaction->getNewValue(); - if ($new !== null && !strlen($new)) { + if ($new !== null && !@strlen($new)) { $errors[] = $this->newInvalidError( pht('Paste language must be null or a nonempty string.'), $xaction); diff --git a/src/applications/paste/xaction/PhabricatorPasteTitleTransaction.php b/src/applications/paste/xaction/PhabricatorPasteTitleTransaction.php --- a/src/applications/paste/xaction/PhabricatorPasteTitleTransaction.php +++ b/src/applications/paste/xaction/PhabricatorPasteTitleTransaction.php @@ -17,13 +17,13 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (strlen($old) && strlen($new)) { + if (@strlen($old) && @strlen($new)) { return pht( '%s changed the title of this paste from %s to %s.', $this->renderAuthor(), $this->renderOldValue(), $this->renderNewValue()); - } else if (strlen($new)) { + } else if (@strlen($new)) { return pht( '%s changed the title of this paste from untitled to %s.', $this->renderAuthor(), @@ -40,14 +40,14 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (strlen($old) && strlen($new)) { + if (@strlen($old) && @strlen($new)) { return pht( '%s updated the title for %s from %s to %s.', $this->renderAuthor(), $this->renderObject(), $this->renderOldValue(), $this->renderNewValue()); - } else if (strlen($new)) { + } else if (@strlen($new)) { return pht( '%s updated the title for %s from untitled to %s.', $this->renderAuthor(), diff --git a/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php b/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php --- a/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php +++ b/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php @@ -82,7 +82,7 @@ } public function getValueFromStorage($value) { - $parts = explode(',', $value, 2); + $parts = @explode(',', $value, 2); return end($parts); } @@ -91,7 +91,7 @@ } public function isRawCacheDataValid(PhabricatorUser $user, $key, $data) { - $parts = explode(',', $data, 2); + $parts = @explode(',', $data, 2); $version = reset($parts); return ($version === $this->getCacheVersion($user)); } diff --git a/src/applications/people/controller/PhabricatorPeopleInviteSendController.php b/src/applications/people/controller/PhabricatorPeopleInviteSendController.php --- a/src/applications/people/controller/PhabricatorPeopleInviteSendController.php +++ b/src/applications/people/controller/PhabricatorPeopleInviteSendController.php @@ -22,7 +22,7 @@ // addresses with names often include spaces. $email_list = preg_split('/[,;\n]+/', $emails); foreach ($email_list as $key => $email) { - if (!strlen(trim($email))) { + if (!@strlen(trim($email))) { unset($email_list[$key]); } } @@ -80,7 +80,7 @@ '%s has invited you to join Phabricator.', $viewer->getFullName()); - if (strlen(trim($message))) { + if (@strlen(trim($message))) { $template[] = $message; } diff --git a/src/applications/people/controller/PhabricatorPeopleNewController.php b/src/applications/people/controller/PhabricatorPeopleNewController.php --- a/src/applications/people/controller/PhabricatorPeopleNewController.php +++ b/src/applications/people/controller/PhabricatorPeopleNewController.php @@ -47,7 +47,7 @@ $user->setUsername($request->getStr('username')); $new_email = $request->getStr('email'); - if (!strlen($new_email)) { + if (!@strlen($new_email)) { $errors[] = pht('Email is required.'); $e_email = pht('Required'); } else if (!PhabricatorUserEmail::isValidAddress($new_email)) { @@ -62,7 +62,7 @@ $user->setRealName($request->getStr('realname')); - if (!strlen($user->getUsername())) { + if (!@strlen($user->getUsername())) { $errors[] = pht('Username is required.'); $e_username = pht('Required'); } else if (!PhabricatorUser::validateUsername($user->getUsername())) { @@ -72,7 +72,7 @@ $e_username = null; } - if (!strlen($user->getRealName()) && $require_real_name) { + if (!@strlen($user->getRealName()) && $require_real_name) { $errors[] = pht('Real name is required.'); $e_realname = pht('Required'); } else { diff --git a/src/applications/people/controller/PhabricatorPeopleRenameController.php b/src/applications/people/controller/PhabricatorPeopleRenameController.php --- a/src/applications/people/controller/PhabricatorPeopleRenameController.php +++ b/src/applications/people/controller/PhabricatorPeopleRenameController.php @@ -34,7 +34,7 @@ $message_body = PhabricatorAuthMessage::loadMessageText( $viewer, PhabricatorAuthChangeUsernameMessageType::MESSAGEKEY); - if (strlen($message_body)) { + if (@strlen($message_body)) { $dialog->appendRemarkup($message_body); } diff --git a/src/applications/people/controller/PhabricatorPeopleWelcomeController.php b/src/applications/people/controller/PhabricatorPeopleWelcomeController.php --- a/src/applications/people/controller/PhabricatorPeopleWelcomeController.php +++ b/src/applications/people/controller/PhabricatorPeopleWelcomeController.php @@ -40,7 +40,7 @@ $v_message = $request->getStr('message'); if ($request->isFormPost()) { - if (strlen($v_message)) { + if (@strlen($v_message)) { $welcome_engine->setWelcomeMessage($v_message); } @@ -51,7 +51,7 @@ $default_message = PhabricatorAuthMessage::loadMessage( $admin, PhabricatorAuthWelcomeMailMessageType::MESSAGEKEY); - if ($default_message && strlen($default_message->getMessageText())) { + if ($default_message && @strlen($default_message->getMessageText())) { $message_instructions = pht( 'The email will identify you as the sender. You may optionally '. 'replace the [[ %s | default custom mail body ]] with different text '. diff --git a/src/applications/people/customfield/PhabricatorUserBlurbField.php b/src/applications/people/customfield/PhabricatorUserBlurbField.php --- a/src/applications/people/customfield/PhabricatorUserBlurbField.php +++ b/src/applications/people/customfield/PhabricatorUserBlurbField.php @@ -84,7 +84,7 @@ public function renderPropertyViewValue(array $handles) { $blurb = $this->getObject()->loadUserProfile()->getBlurb(); - if (!strlen($blurb)) { + if (!@strlen($blurb)) { return null; } diff --git a/src/applications/people/engineextension/PhabricatorPeopleDatasourceEngineExtension.php b/src/applications/people/engineextension/PhabricatorPeopleDatasourceEngineExtension.php --- a/src/applications/people/engineextension/PhabricatorPeopleDatasourceEngineExtension.php +++ b/src/applications/people/engineextension/PhabricatorPeopleDatasourceEngineExtension.php @@ -13,13 +13,13 @@ $viewer = $this->getViewer(); // Send "u" to the user directory. - if (preg_match('/^u\z/i', $query)) { + if (@preg_match('/^u\z/i', $query)) { return '/people/'; } // Send "u " to the user's profile page. $matches = null; - if (preg_match('/^u\s+(.+)\z/i', $query, $matches)) { + if (@preg_match('/^u\s+(.+)\z/i', $query, $matches)) { $raw_query = $matches[1]; // TODO: We could test that this is a valid username and jump to diff --git a/src/applications/people/lipsum/PhabricatorPeopleTestDataGenerator.php b/src/applications/people/lipsum/PhabricatorPeopleTestDataGenerator.php --- a/src/applications/people/lipsum/PhabricatorPeopleTestDataGenerator.php +++ b/src/applications/people/lipsum/PhabricatorPeopleTestDataGenerator.php @@ -42,10 +42,10 @@ } protected function generateUsername($random_real_name) { - $name = strtolower($random_real_name); + $name = @strtolower($random_real_name); $name = preg_replace('/[^a-z]/s' , ' ', $name); $name = preg_replace('/\s+/', ' ', $name); - $words = explode(' ', $name); + $words = @explode(' ', $name); $random = rand(0, 4); $reduced = ''; if ($random == 0) { diff --git a/src/applications/people/mail/PhabricatorPeopleEmailLoginMailEngine.php b/src/applications/people/mail/PhabricatorPeopleEmailLoginMailEngine.php --- a/src/applications/people/mail/PhabricatorPeopleEmailLoginMailEngine.php +++ b/src/applications/people/mail/PhabricatorPeopleEmailLoginMailEngine.php @@ -60,7 +60,7 @@ $message_body = PhabricatorAuthMessage::loadMessageText( $recipient, $message_key); - if (strlen($message_body)) { + if (@strlen($message_body)) { $body[] = $this->newRemarkupText($message_body); } diff --git a/src/applications/people/mail/PhabricatorPeopleWelcomeMailEngine.php b/src/applications/people/mail/PhabricatorPeopleWelcomeMailEngine.php --- a/src/applications/people/mail/PhabricatorPeopleWelcomeMailEngine.php +++ b/src/applications/people/mail/PhabricatorPeopleWelcomeMailEngine.php @@ -112,14 +112,14 @@ $recipient = $this->getRecipient(); $custom_body = $this->getWelcomeMessage(); - if (strlen($custom_body)) { + if (@strlen($custom_body)) { return $this->newRemarkupText($custom_body); } $default_body = PhabricatorAuthMessage::loadMessageText( $recipient, PhabricatorAuthWelcomeMailMessageType::MESSAGEKEY); - if (strlen($default_body)) { + if (@strlen($default_body)) { return $this->newRemarkupText($default_body); } diff --git a/src/applications/people/management/PhabricatorPeopleManagementWorkflow.php b/src/applications/people/management/PhabricatorPeopleManagementWorkflow.php --- a/src/applications/people/management/PhabricatorPeopleManagementWorkflow.php +++ b/src/applications/people/management/PhabricatorPeopleManagementWorkflow.php @@ -16,7 +16,7 @@ final protected function selectUser(PhutilArgumentParser $argv) { $username = $argv->getArg('user'); - if (!strlen($username)) { + if (!@strlen($username)) { throw new PhutilArgumentUsageException( pht( 'Select a user account to act on with "--user ".')); diff --git a/src/applications/people/markup/PhabricatorMentionRemarkupRule.php b/src/applications/people/markup/PhabricatorMentionRemarkupRule.php --- a/src/applications/people/markup/PhabricatorMentionRemarkupRule.php +++ b/src/applications/people/markup/PhabricatorMentionRemarkupRule.php @@ -44,7 +44,7 @@ $metadata_key = self::KEY_RULE_MENTION; $metadata = $engine->getTextMetadata($metadata_key, array()); - $username = strtolower($matches[1]); + $username = @strtolower($matches[1]); if (empty($metadata[$username])) { $metadata[$username] = array(); } @@ -80,7 +80,7 @@ $mentioned_key = self::KEY_MENTIONED; $mentioned = $engine->getTextMetadata($mentioned_key, array()); foreach ($users as $row) { - $actual_users[strtolower($row->getUserName())] = $row; + $actual_users[@strtolower($row->getUserName())] = $row; $mentioned[$row->getPHID()] = $row->getPHID(); } diff --git a/src/applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php --- a/src/applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php +++ b/src/applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php @@ -22,7 +22,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php --- a/src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php +++ b/src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php @@ -22,7 +22,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php --- a/src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php +++ b/src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php @@ -17,7 +17,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/people/menuitem/PhabricatorPeopleManageProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleManageProfileMenuItem.php --- a/src/applications/people/menuitem/PhabricatorPeopleManageProfileMenuItem.php +++ b/src/applications/people/menuitem/PhabricatorPeopleManageProfileMenuItem.php @@ -22,7 +22,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/people/menuitem/PhabricatorPeopleRevisionsProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleRevisionsProfileMenuItem.php --- a/src/applications/people/menuitem/PhabricatorPeopleRevisionsProfileMenuItem.php +++ b/src/applications/people/menuitem/PhabricatorPeopleRevisionsProfileMenuItem.php @@ -22,7 +22,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php --- a/src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php +++ b/src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php @@ -22,7 +22,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php b/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php --- a/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php +++ b/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php @@ -87,7 +87,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^@.+/', $name); + return @preg_match('/^@.+/', $name); } public function loadNamedObjects( @@ -96,7 +96,7 @@ $id_map = array(); foreach ($names as $name) { - $id = substr($name, 1); + $id = @substr($name, 1); $id = phutil_utf8_strtolower($id); $id_map[$id][] = $name; } diff --git a/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php b/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php --- a/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php +++ b/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php @@ -46,7 +46,7 @@ $query->withActions($map['actions']); } - if (strlen($map['ip'])) { + if (@strlen($map['ip'])) { $query->withRemoteAddressPrefix($map['ip']); } @@ -227,7 +227,7 @@ 'user' => $user_name, 'action' => $action, 'actionName' => $action_name, - 'session' => substr($log->getSession(), 0, 6), + 'session' => @substr($log->getSession(), 0, 6), 'old' => $log->getOldValue(), 'new' => $log->getNewValue(), ); diff --git a/src/applications/people/query/PhabricatorPeopleQuery.php b/src/applications/people/query/PhabricatorPeopleQuery.php --- a/src/applications/people/query/PhabricatorPeopleQuery.php +++ b/src/applications/people/query/PhabricatorPeopleQuery.php @@ -341,7 +341,7 @@ (int)$this->isMailingList); } - if (strlen($this->nameLike)) { + if (@strlen($this->nameLike)) { $where[] = qsprintf( $conn, 'user.username LIKE %~ OR user.realname LIKE %~', diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -275,7 +275,7 @@ $this->setConduitCertificate($this->generateConduitCertificate()); } - if (!strlen($this->getAccountSecret())) { + if (!@strlen($this->getAccountSecret())) { $this->setAccountSecret(Filesystem::readRandomCharacters(64)); } @@ -522,11 +522,11 @@ // - Unit tests, obviously. // - describeValidUsername() method, above. - if (strlen($username) > self::MAXIMUM_USERNAME_LENGTH) { + if (@strlen($username) > self::MAXIMUM_USERNAME_LENGTH) { return false; } - return (bool)preg_match('/^[a-zA-Z0-9._-]*[a-zA-Z0-9_-]\z/', $username); + return (bool)@preg_match('/^[a-zA-Z0-9._-]*[a-zA-Z0-9_-]\z/', $username); } public static function getDefaultProfileImageURI() { @@ -554,7 +554,7 @@ } public function getFullName() { - if (strlen($this->getRealName())) { + if (@strlen($this->getRealName())) { return $this->getUsername().' ('.$this->getRealName().')'; } else { return $this->getUsername(); diff --git a/src/applications/people/storage/PhabricatorUserEmail.php b/src/applications/people/storage/PhabricatorUserEmail.php --- a/src/applications/people/storage/PhabricatorUserEmail.php +++ b/src/applications/people/storage/PhabricatorUserEmail.php @@ -73,7 +73,7 @@ * @task restrictions */ public static function isValidAddress($address) { - if (strlen($address) > self::MAX_ADDRESS_LENGTH) { + if (@strlen($address) > self::MAX_ADDRESS_LENGTH) { return false; } @@ -90,7 +90,7 @@ // "@" symbol, and then some more normal text. $email_regex = '(^[a-z0-9_+.!-]+@[a-z0-9_+:.-]+\z)i'; - if (!preg_match($email_regex, $address)) { + if (!@preg_match($email_regex, $address)) { return false; } diff --git a/src/applications/people/storage/PhabricatorUserProfile.php b/src/applications/people/storage/PhabricatorUserProfile.php --- a/src/applications/people/storage/PhabricatorUserProfile.php +++ b/src/applications/people/storage/PhabricatorUserProfile.php @@ -37,7 +37,7 @@ public function getDisplayTitle() { $title = $this->getTitle(); - if (strlen($title)) { + if (@strlen($title)) { return $title; } diff --git a/src/applications/people/view/PhabricatorUserLogView.php b/src/applications/people/view/PhabricatorUserLogView.php --- a/src/applications/people/view/PhabricatorUserLogView.php +++ b/src/applications/people/view/PhabricatorUserLogView.php @@ -36,7 +36,7 @@ $rows = array(); foreach ($logs as $log) { - $session = substr($log->getSession(), 0, 6); + $session = @substr($log->getSession(), 0, 6); $actor_phid = $log->getActorPHID(); $user_phid = $log->getUserPHID(); diff --git a/src/applications/people/xaction/PhabricatorUserUsernameTransaction.php b/src/applications/people/xaction/PhabricatorUserUsernameTransaction.php --- a/src/applications/people/xaction/PhabricatorUserUsernameTransaction.php +++ b/src/applications/people/xaction/PhabricatorUserUsernameTransaction.php @@ -70,7 +70,7 @@ pht('You must be an administrator to rename users.')); } - if (!strlen($new)) { + if (!@strlen($new)) { $errors[] = $this->newInvalidError( pht('New username is required.'), $xaction); diff --git a/src/applications/phame/controller/PhameLiveController.php b/src/applications/phame/controller/PhameLiveController.php --- a/src/applications/phame/controller/PhameLiveController.php +++ b/src/applications/phame/controller/PhameLiveController.php @@ -87,7 +87,7 @@ $this->isExternal = $is_external; $this->isLive = $is_live; - if (strlen($post_id)) { + if (@strlen($post_id)) { $post_query = id(new PhamePostQuery()) ->setViewer($viewer) ->needHeaderImage(true) diff --git a/src/applications/phame/controller/blog/PhameBlogManageController.php b/src/applications/phame/controller/blog/PhameBlogManageController.php --- a/src/applications/phame/controller/blog/PhameBlogManageController.php +++ b/src/applications/phame/controller/blog/PhameBlogManageController.php @@ -149,7 +149,7 @@ ->process(); $description = $blog->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $description = new PHUIRemarkupView($viewer, $description); $properties->addSectionHeader( pht('Description'), diff --git a/src/applications/phame/controller/blog/PhameBlogViewController.php b/src/applications/phame/controller/blog/PhameBlogViewController.php --- a/src/applications/phame/controller/blog/PhameBlogViewController.php +++ b/src/applications/phame/controller/blog/PhameBlogViewController.php @@ -90,7 +90,7 @@ ->appendChild($post_list); $description = null; - if (strlen($blog->getDescription())) { + if (@strlen($blog->getDescription())) { $description = new PHUIRemarkupView( $viewer, $blog->getDescription()); diff --git a/src/applications/phame/mail/PhamePostMailReceiver.php b/src/applications/phame/mail/PhamePostMailReceiver.php --- a/src/applications/phame/mail/PhamePostMailReceiver.php +++ b/src/applications/phame/mail/PhamePostMailReceiver.php @@ -13,7 +13,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 1); + $id = (int)@substr($pattern, 1); return id(new PhamePostQuery()) ->setViewer($viewer) diff --git a/src/applications/phame/site/PhameSite.php b/src/applications/phame/site/PhameSite.php --- a/src/applications/phame/site/PhameSite.php +++ b/src/applications/phame/site/PhameSite.php @@ -4,7 +4,7 @@ protected function isPhameActive() { $base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri'); - if (!strlen($base_uri)) { + if (!@strlen($base_uri)) { // Don't activate Phame if we don't have a base URI configured. return false; } diff --git a/src/applications/phame/storage/PhameBlog.php b/src/applications/phame/storage/PhameBlog.php --- a/src/applications/phame/storage/PhameBlog.php +++ b/src/applications/phame/storage/PhameBlog.php @@ -134,7 +134,7 @@ $example_domain); } - if (strlen($path) && $path != '/') { + if (@strlen($path) && $path != '/') { return pht( 'The custom domain should not specify a path (hosting a Phame '. 'blog at a path is currently not supported). Instead, just provide '. @@ -142,7 +142,7 @@ $example_domain); } - if (strpos($domain, '.') === false) { + if (@strpos($domain, '.') === false) { return pht( 'The custom domain should contain at least one dot (.) because '. 'some browsers fail to set cookies on domains without a dot. '. @@ -169,7 +169,7 @@ } public function getLiveURI() { - if (strlen($this->getDomain())) { + if (@strlen($this->getDomain())) { return $this->getExternalLiveURI(); } else { return $this->getInternalLiveURI(); diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php --- a/src/applications/phame/storage/PhamePost.php +++ b/src/applications/phame/storage/PhamePost.php @@ -63,7 +63,7 @@ $blog = $this->getBlog(); $is_draft = $this->isDraft(); $is_archived = $this->isArchived(); - if (strlen($blog->getDomain()) && !$is_draft && !$is_archived) { + if (@strlen($blog->getDomain()) && !$is_draft && !$is_archived) { return $this->getExternalLiveURI(); } else { return $this->getInternalLiveURI(); diff --git a/src/applications/phame/xaction/PhameBlogFullDomainTransaction.php b/src/applications/phame/xaction/PhameBlogFullDomainTransaction.php --- a/src/applications/phame/xaction/PhameBlogFullDomainTransaction.php +++ b/src/applications/phame/xaction/PhameBlogFullDomainTransaction.php @@ -10,7 +10,7 @@ } public function applyInternalEffects($object, $value) { - if (strlen($value)) { + if (@strlen($value)) { $uri = new PhutilURI($value); $domain = $uri->getDomain(); $object->setDomain($domain); @@ -22,7 +22,7 @@ public function getTitle() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s set this blog\'s full domain to %s.', $this->renderAuthor(), @@ -38,7 +38,7 @@ public function getTitleForFeed() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s set %s blog\'s full domain to %s.', $this->renderAuthor(), diff --git a/src/applications/phame/xaction/PhameBlogNameTransaction.php b/src/applications/phame/xaction/PhameBlogNameTransaction.php --- a/src/applications/phame/xaction/PhameBlogNameTransaction.php +++ b/src/applications/phame/xaction/PhameBlogNameTransaction.php @@ -41,7 +41,7 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The name can be no longer than %s characters.', diff --git a/src/applications/phame/xaction/PhameBlogParentDomainTransaction.php b/src/applications/phame/xaction/PhameBlogParentDomainTransaction.php --- a/src/applications/phame/xaction/PhameBlogParentDomainTransaction.php +++ b/src/applications/phame/xaction/PhameBlogParentDomainTransaction.php @@ -15,7 +15,7 @@ public function getTitle() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s set this blog\'s parent domain to %s.', $this->renderAuthor(), @@ -31,7 +31,7 @@ public function getTitleForFeed() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s set %s blog\'s parent domain to %s.', $this->renderAuthor(), @@ -69,7 +69,7 @@ $max_length = $object->getColumnMaximumByteLength('parentDomain'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The parent domain can be no longer than %s characters.', diff --git a/src/applications/phame/xaction/PhameBlogParentSiteTransaction.php b/src/applications/phame/xaction/PhameBlogParentSiteTransaction.php --- a/src/applications/phame/xaction/PhameBlogParentSiteTransaction.php +++ b/src/applications/phame/xaction/PhameBlogParentSiteTransaction.php @@ -15,7 +15,7 @@ public function getTitle() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s set this blog\'s parent site to %s.', $this->renderAuthor(), @@ -31,7 +31,7 @@ public function getTitleForFeed() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s set %s blog\'s parent site to %s.', $this->renderAuthor(), @@ -53,7 +53,7 @@ $max_length = $object->getColumnMaximumByteLength('parentSite'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The parent site can be no longer than %s characters.', diff --git a/src/applications/phame/xaction/PhameBlogSubtitleTransaction.php b/src/applications/phame/xaction/PhameBlogSubtitleTransaction.php --- a/src/applications/phame/xaction/PhameBlogSubtitleTransaction.php +++ b/src/applications/phame/xaction/PhameBlogSubtitleTransaction.php @@ -49,7 +49,7 @@ $max_length = $object->getColumnMaximumByteLength('subtitle'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The subtitle can be no longer than %s characters.', diff --git a/src/applications/phame/xaction/PhamePostSubtitleTransaction.php b/src/applications/phame/xaction/PhamePostSubtitleTransaction.php --- a/src/applications/phame/xaction/PhamePostSubtitleTransaction.php +++ b/src/applications/phame/xaction/PhamePostSubtitleTransaction.php @@ -49,7 +49,7 @@ $max_length = $object->getColumnMaximumByteLength('subtitle'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The subtitle can be no longer than %s characters.', diff --git a/src/applications/phame/xaction/PhamePostTitleTransaction.php b/src/applications/phame/xaction/PhamePostTitleTransaction.php --- a/src/applications/phame/xaction/PhamePostTitleTransaction.php +++ b/src/applications/phame/xaction/PhamePostTitleTransaction.php @@ -41,7 +41,7 @@ $max_length = $object->getColumnMaximumByteLength('title'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The title can be no longer than %s characters.', diff --git a/src/applications/phid/handle/pool/PhabricatorHandleList.php b/src/applications/phid/handle/pool/PhabricatorHandleList.php --- a/src/applications/phid/handle/pool/PhabricatorHandleList.php +++ b/src/applications/phid/handle/pool/PhabricatorHandleList.php @@ -150,6 +150,7 @@ /* -( ArrayAccess )-------------------------------------------------------- */ + #[\ReturnTypeWillChange] public function offsetExists($offset) { // NOTE: We're intentionally not loading handles here so that isset() // checks do not trigger fetches. This gives us better bulk loading @@ -162,6 +163,7 @@ return isset($this->map[$offset]); } + #[\ReturnTypeWillChange] public function offsetGet($offset) { if ($this->handles === null) { $this->loadHandles(); @@ -169,10 +171,12 @@ return $this->handles[$offset]; } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->raiseImmutableException(); } + #[\ReturnTypeWillChange] public function offsetUnset($offset) { $this->raiseImmutableException(); } @@ -189,6 +193,7 @@ /* -( Countable )---------------------------------------------------------- */ + #[\ReturnTypeWillChange] public function count() { return $this->count; } diff --git a/src/applications/phid/query/PhabricatorObjectListQuery.php b/src/applications/phid/query/PhabricatorObjectListQuery.php --- a/src/applications/phid/query/PhabricatorObjectListQuery.php +++ b/src/applications/phid/query/PhabricatorObjectListQuery.php @@ -61,13 +61,13 @@ $names = preg_replace('/\s+/', ' ', $names); // Split the list on commas. - $names = explode(',', $names); + $names = @explode(',', $names); // Trim and remove empty tokens. foreach ($names as $key => $name) { $name = trim($name); - if (!strlen($name)) { + if (!@strlen($name)) { unset($names[$key]); continue; } @@ -80,12 +80,12 @@ $name_map = array(); foreach ($names as $name) { - $parts = explode(' ', $name); + $parts = @explode(' ', $name); // If this looks like a monogram, ignore anything after the first token. // This allows us to parse "O123 Package Name" as though it was "O123", // which we can look up. - if (preg_match('/^[A-Z]\d+\z/', $parts[0])) { + if (@preg_match('/^[A-Z]\d+\z/', $parts[0])) { $name_map[$parts[0]] = $name; } else { // For anything else, split it on spaces and use each token as a @@ -252,12 +252,12 @@ } private function hasSuffix($key, $suffix) { - return (substr($key, -strlen($suffix)) === $suffix); + return (@substr($key, -@strlen($suffix)) === $suffix); } private function stripSuffix($key, $suffix) { if ($this->hasSuffix($key, $suffix)) { - return substr($key, 0, -strlen($suffix)); + return @substr($key, 0, -@strlen($suffix)); } return $key; diff --git a/src/applications/phid/resolver/PhabricatorProjectPHIDResolver.php b/src/applications/phid/resolver/PhabricatorProjectPHIDResolver.php --- a/src/applications/phid/resolver/PhabricatorProjectPHIDResolver.php +++ b/src/applications/phid/resolver/PhabricatorProjectPHIDResolver.php @@ -19,7 +19,7 @@ $results = array(); foreach ($projects as $hashtag => $project) { - $results[substr($hashtag, 1)] = $project->getPHID(); + $results[@substr($hashtag, 1)] = $project->getPHID(); } return $results; diff --git a/src/applications/phid/resolver/PhabricatorUserPHIDResolver.php b/src/applications/phid/resolver/PhabricatorUserPHIDResolver.php --- a/src/applications/phid/resolver/PhabricatorUserPHIDResolver.php +++ b/src/applications/phid/resolver/PhabricatorUserPHIDResolver.php @@ -18,7 +18,7 @@ $results = array(); foreach ($users as $at_username => $user) { - $results[substr($at_username, 1)] = $user->getPHID(); + $results[@substr($at_username, 1)] = $user->getPHID(); } return $results; diff --git a/src/applications/phid/type/PhabricatorPHIDType.php b/src/applications/phid/type/PhabricatorPHIDType.php --- a/src/applications/phid/type/PhabricatorPHIDType.php +++ b/src/applications/phid/type/PhabricatorPHIDType.php @@ -5,7 +5,7 @@ final public function getTypeConstant() { $const = $this->getPhobjectClassConstant('TYPECONST'); - if (!is_string($const) || !preg_match('/^[A-Z]{4}$/', $const)) { + if (!is_string($const) || !@preg_match('/^[A-Z]{4}$/', $const)) { throw new Exception( pht( '%s class "%s" has an invalid %s property. PHID '. diff --git a/src/applications/phid/utils.php b/src/applications/phid/utils.php --- a/src/applications/phid/utils.php +++ b/src/applications/phid/utils.php @@ -9,7 +9,7 @@ */ function phid_get_type($phid) { $matches = null; - if (is_string($phid) && preg_match('/^PHID-([^-]{4})-/', $phid, $matches)) { + if (is_string($phid) && @preg_match('/^PHID-([^-]{4})-/', $phid, $matches)) { return $matches[1]; } return PhabricatorPHIDConstants::PHID_TYPE_UNKNOWN; @@ -32,7 +32,7 @@ function phid_get_subtype($phid) { if (isset($phid[14]) && ($phid[14] == '-')) { - return substr($phid, 10, 4); + return @substr($phid, 10, 4); } return null; } diff --git a/src/applications/phid/view/PHUIHandleTagListView.php b/src/applications/phid/view/PHUIHandleTagListView.php --- a/src/applications/phid/view/PHUIHandleTagListView.php +++ b/src/applications/phid/view/PHUIHandleTagListView.php @@ -54,7 +54,7 @@ // If the list is empty, we may render a "No Projects" tag. if (!count($handles)) { - if (strlen($this->noDataString)) { + if (@strlen($this->noDataString)) { $no_data_tag = $this->newPlaceholderTag() ->setName($this->noDataString); return $this->newItem($no_data_tag); diff --git a/src/applications/phlux/controller/PhluxEditController.php b/src/applications/phlux/controller/PhluxEditController.php --- a/src/applications/phlux/controller/PhluxEditController.php +++ b/src/applications/phlux/controller/PhluxEditController.php @@ -39,10 +39,10 @@ if ($request->isFormPost()) { if ($is_new) { $key = $request->getStr('key'); - if (!strlen($key)) { + if (!@strlen($key)) { $errors[] = pht('Variable key is required.'); $e_key = pht('Required'); - } else if (!preg_match('/^[a-z0-9.-]+\z/', $key)) { + } else if (!@preg_match('/^[a-z0-9.-]+\z/', $key)) { $errors[] = pht( 'Variable key "%s" must contain only lowercase letters, digits, '. 'period, and hyphen.', @@ -53,7 +53,7 @@ $raw_value = $request->getStr('value'); $value = json_decode($raw_value, true); - if ($value === null && strtolower($raw_value) !== 'null') { + if ($value === null && @strtolower($raw_value) !== 'null') { $e_value = pht('Invalid'); $errors[] = pht('Variable value must be valid JSON.'); $display_value = $raw_value; diff --git a/src/applications/pholio/controller/PholioImageUploadController.php b/src/applications/pholio/controller/PholioImageUploadController.php --- a/src/applications/pholio/controller/PholioImageUploadController.php +++ b/src/applications/pholio/controller/PholioImageUploadController.php @@ -18,7 +18,7 @@ return new Aphront404Response(); } - if (!strlen($title)) { + if (!@strlen($title)) { $title = $file->getName(); } diff --git a/src/applications/pholio/controller/PholioInlineController.php b/src/applications/pholio/controller/PholioInlineController.php --- a/src/applications/pholio/controller/PholioInlineController.php +++ b/src/applications/pholio/controller/PholioInlineController.php @@ -105,7 +105,7 @@ if ($request->isFormPost()) { $v_content = $request->getStr('content'); - if (strlen($v_content)) { + if (@strlen($v_content)) { $inline->setContent($v_content); $inline->save(); $dictionary = $inline->toDictionary(); diff --git a/src/applications/pholio/controller/PholioMockCommentController.php b/src/applications/pholio/controller/PholioMockCommentController.php --- a/src/applications/pholio/controller/PholioMockCommentController.php +++ b/src/applications/pholio/controller/PholioMockCommentController.php @@ -35,7 +35,7 @@ $viewer->getPHID(), mpull($mock->getActiveImages(), 'getID')); - if (!$inline_comments || strlen($comment)) { + if (!$inline_comments || @strlen($comment)) { $xactions[] = id(new PholioTransaction()) ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) ->attachComment( diff --git a/src/applications/pholio/controller/PholioMockEditController.php b/src/applications/pholio/controller/PholioMockEditController.php --- a/src/applications/pholio/controller/PholioMockEditController.php +++ b/src/applications/pholio/controller/PholioMockEditController.php @@ -145,7 +145,7 @@ ->setReplacesImagePHID($replaces_image_phid) ->setFilePHID($file_phid) ->attachFile($file) - ->setName(strlen($title) ? $title : $file->getName()) + ->setName(@strlen($title) ? $title : $file->getName()) ->setDescription($description) ->setSequence($sequence) ->save(); @@ -160,7 +160,7 @@ ->setAuthorPHID($viewer->getPHID()) ->setFilePHID($file_phid) ->attachFile($file) - ->setName(strlen($title) ? $title : $file->getName()) + ->setName(@strlen($title) ? $title : $file->getName()) ->setDescription($description) ->setSequence($sequence) ->save(); diff --git a/src/applications/pholio/controller/PholioMockViewController.php b/src/applications/pholio/controller/PholioMockViewController.php --- a/src/applications/pholio/controller/PholioMockViewController.php +++ b/src/applications/pholio/controller/PholioMockViewController.php @@ -179,7 +179,7 @@ ->setUser($viewer); $description = $mock->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $properties->addTextContent( new PHUIRemarkupView($viewer, $description)); return id(new PHUIObjectBoxView()) diff --git a/src/applications/pholio/mail/PholioMockMailReceiver.php b/src/applications/pholio/mail/PholioMockMailReceiver.php --- a/src/applications/pholio/mail/PholioMockMailReceiver.php +++ b/src/applications/pholio/mail/PholioMockMailReceiver.php @@ -12,7 +12,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 1); + $id = (int)@substr($pattern, 1); return id(new PholioMockQuery()) ->setViewer($viewer) diff --git a/src/applications/pholio/phid/PholioMockPHIDType.php b/src/applications/pholio/phid/PholioMockPHIDType.php --- a/src/applications/pholio/phid/PholioMockPHIDType.php +++ b/src/applications/pholio/phid/PholioMockPHIDType.php @@ -46,7 +46,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^M\d*[1-9]\d*$/i', $name); + return @preg_match('/^M\d*[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -55,7 +55,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/pholio/remarkup/PholioRemarkupRule.php b/src/applications/pholio/remarkup/PholioRemarkupRule.php --- a/src/applications/pholio/remarkup/PholioRemarkupRule.php +++ b/src/applications/pholio/remarkup/PholioRemarkupRule.php @@ -20,7 +20,7 @@ $href = $handle->getURI(); // If the ID has a `M123/456` component, link to that specific image. - $id = explode('/', $id); + $id = @explode('/', $id); if (isset($id[1])) { $href = $href.'/'.$id[1].'/'; } @@ -36,7 +36,7 @@ // Strip off any image ID components of the URI. $map = array(); foreach ($ids as $id) { - $map[head(explode('/', $id))][] = $id; + $map[head(@explode('/', $id))][] = $id; } $viewer = $this->getEngine()->getConfig('viewer'); @@ -70,13 +70,13 @@ ->setUser($viewer) ->setMock($object); - if (strlen($options)) { + if (@strlen($options)) { $parser = new PhutilSimpleOptions(); - $opts = $parser->parse(substr($options, 1)); + $opts = $parser->parse(@substr($options, 1)); if (isset($opts['image'])) { $images = array_unique( - explode('&', preg_replace('/\s+/', '', $opts['image']))); + @explode('&', preg_replace('/\s+/', '', $opts['image']))); $embed_mock->setImages($images); } diff --git a/src/applications/pholio/view/PholioMockImagesView.php b/src/applications/pholio/view/PholioMockImagesView.php --- a/src/applications/pholio/view/PholioMockImagesView.php +++ b/src/applications/pholio/view/PholioMockImagesView.php @@ -86,7 +86,7 @@ } $description = $image->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $description = new PHUIRemarkupView($viewer, $description); } diff --git a/src/applications/pholio/xaction/PholioImageNameTransaction.php b/src/applications/pholio/xaction/PholioImageNameTransaction.php --- a/src/applications/pholio/xaction/PholioImageNameTransaction.php +++ b/src/applications/pholio/xaction/PholioImageNameTransaction.php @@ -69,7 +69,7 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new_value = head(array_values($xaction->getNewValue())); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/pholio/xaction/PholioMockNameTransaction.php b/src/applications/pholio/xaction/PholioMockNameTransaction.php --- a/src/applications/pholio/xaction/PholioMockNameTransaction.php +++ b/src/applications/pholio/xaction/PholioMockNameTransaction.php @@ -74,7 +74,7 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/phortune/controller/account/PhortuneAccountDetailsController.php b/src/applications/phortune/controller/account/PhortuneAccountDetailsController.php --- a/src/applications/phortune/controller/account/PhortuneAccountDetailsController.php +++ b/src/applications/phortune/controller/account/PhortuneAccountDetailsController.php @@ -132,12 +132,12 @@ $view->addProperty(pht('Account Name'), $account->getName()); $display_name = $account->getBillingName(); - if (!strlen($display_name)) { + if (!@strlen($display_name)) { $display_name = phutil_tag('em', array(), pht('None')); } $display_address = $account->getBillingAddress(); - if (!strlen($display_address)) { + if (!@strlen($display_address)) { $display_address = phutil_tag('em', array(), pht('None')); } else { $display_address = phutil_escape_html_newlines($display_address); diff --git a/src/applications/phortune/controller/account/PhortuneAccountEmailViewController.php b/src/applications/phortune/controller/account/PhortuneAccountEmailViewController.php --- a/src/applications/phortune/controller/account/PhortuneAccountEmailViewController.php +++ b/src/applications/phortune/controller/account/PhortuneAccountEmailViewController.php @@ -158,10 +158,10 @@ // Key" actually does something. $prefix_length = 4; - $visible_part = substr($access_key, 0, $prefix_length); + $visible_part = @substr($access_key, 0, $prefix_length); $masked_part = str_repeat( "\xE2\x80\xA2", - strlen($access_key) - $prefix_length); + @strlen($access_key) - $prefix_length); $access_display = $visible_part.$masked_part; $access_display = phutil_tag('tt', array(), $access_display); diff --git a/src/applications/phortune/controller/account/PhortuneAccountPaymentMethodViewController.php b/src/applications/phortune/controller/account/PhortuneAccountPaymentMethodViewController.php --- a/src/applications/phortune/controller/account/PhortuneAccountPaymentMethodViewController.php +++ b/src/applications/phortune/controller/account/PhortuneAccountPaymentMethodViewController.php @@ -110,7 +110,7 @@ $view = id(new PHUIPropertyListView()) ->setUser($viewer); - if (strlen($method->getName())) { + if (@strlen($method->getName())) { $view->addProperty(pht('Name'), $method->getDisplayName()); } diff --git a/src/applications/phortune/controller/merchant/PhortuneMerchantDetailsController.php b/src/applications/phortune/controller/merchant/PhortuneMerchantDetailsController.php --- a/src/applications/phortune/controller/merchant/PhortuneMerchantDetailsController.php +++ b/src/applications/phortune/controller/merchant/PhortuneMerchantDetailsController.php @@ -63,7 +63,7 @@ $view->addProperty(pht('Invoice From'), $invoice_from); $description = $merchant->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $description = new PHUIRemarkupView($viewer, $description); $view->addSectionHeader( pht('Description'), @@ -72,7 +72,7 @@ } $contact_info = $merchant->getContactInfo(); - if (strlen($contact_info)) { + if (@strlen($contact_info)) { $contact_info = new PHUIRemarkupView($viewer, $contact_info); $view->addSectionHeader( pht('Contact Information'), @@ -81,7 +81,7 @@ } $footer_info = $merchant->getInvoiceFooter(); - if (strlen($footer_info)) { + if (@strlen($footer_info)) { $footer_info = new PHUIRemarkupView($viewer, $footer_info); $view->addSectionHeader( pht('Invoice Footer'), diff --git a/src/applications/phortune/controller/merchant/PhortuneMerchantInvoiceCreateController.php b/src/applications/phortune/controller/merchant/PhortuneMerchantInvoiceCreateController.php --- a/src/applications/phortune/controller/merchant/PhortuneMerchantInvoiceCreateController.php +++ b/src/applications/phortune/controller/merchant/PhortuneMerchantInvoiceCreateController.php @@ -122,17 +122,17 @@ $e_cost = null; $e_quantity = null; - if (!strlen($v_title)) { + if (!@strlen($v_title)) { $e_title = pht('Required'); $errors[] = pht('You must title this invoice.'); } - if (!strlen($v_name)) { + if (!@strlen($v_name)) { $e_name = pht('Required'); $errors[] = pht('You must provide a name for this purchase.'); } - if (!strlen($v_cost)) { + if (!@strlen($v_cost)) { $e_cost = pht('Required'); $errors[] = pht('You must provide a cost for this purchase.'); } else { diff --git a/src/applications/phortune/controller/merchant/PhortuneMerchantOverviewController.php b/src/applications/phortune/controller/merchant/PhortuneMerchantOverviewController.php --- a/src/applications/phortune/controller/merchant/PhortuneMerchantOverviewController.php +++ b/src/applications/phortune/controller/merchant/PhortuneMerchantOverviewController.php @@ -110,7 +110,7 @@ $view->addProperty(pht('Status'), $status_view); $description = $merchant->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $description = new PHUIRemarkupView($viewer, $description); $view->addSectionHeader( pht('Description'), @@ -119,7 +119,7 @@ } $contact_info = $merchant->getContactInfo(); - if (strlen($contact_info)) { + if (@strlen($contact_info)) { $contact_info = new PHUIRemarkupView($viewer, $contact_info); $view->addSectionHeader( pht('Contact Information'), diff --git a/src/applications/phortune/currency/PhortuneCurrency.php b/src/applications/phortune/currency/PhortuneCurrency.php --- a/src/applications/phortune/currency/PhortuneCurrency.php +++ b/src/applications/phortune/currency/PhortuneCurrency.php @@ -24,7 +24,7 @@ public static function newFromString($string, $default = null) { $matches = null; - $ok = preg_match( + $ok = @preg_match( '/^([-$]*(?:\d+)?(?:[.]\d{0,2})?)(?:\s+([A-Z]+))?$/', trim($string), $matches); diff --git a/src/applications/phortune/editor/PhortuneCartEditor.php b/src/applications/phortune/editor/PhortuneCartEditor.php --- a/src/applications/phortune/editor/PhortuneCartEditor.php +++ b/src/applications/phortune/editor/PhortuneCartEditor.php @@ -302,7 +302,7 @@ $origin_username = $origin_user->getUsername(); $origin_realname = $origin_user->getRealName(); - if (strlen($origin_realname)) { + if (@strlen($origin_realname)) { $origin_display = pht('%s (%s)', $origin_username, $origin_realname); } else { $origin_display = pht('%s', $origin_username); diff --git a/src/applications/phortune/pdf/PhabricatorPDFIterator.php b/src/applications/phortune/pdf/PhabricatorPDFIterator.php --- a/src/applications/phortune/pdf/PhabricatorPDFIterator.php +++ b/src/applications/phortune/pdf/PhabricatorPDFIterator.php @@ -64,7 +64,7 @@ $bytes = $fragment->getAsBytes(); $this->fragmentBytes = $bytes; - $this->byteLength += strlen($bytes); + $this->byteLength += @strlen($bytes); } public function rewind() { diff --git a/src/applications/phortune/pdf/PhabricatorPDFObject.php b/src/applications/phortune/pdf/PhabricatorPDFObject.php --- a/src/applications/phortune/pdf/PhabricatorPDFObject.php +++ b/src/applications/phortune/pdf/PhabricatorPDFObject.php @@ -89,7 +89,7 @@ $this->streams[] = $stream_data; - return strlen($stream_data); + return @strlen($stream_data); } } diff --git a/src/applications/phortune/provider/PhortunePayPalPaymentProvider.php b/src/applications/phortune/provider/PhortunePayPalPaymentProvider.php --- a/src/applications/phortune/provider/PhortunePayPalPaymentProvider.php +++ b/src/applications/phortune/provider/PhortunePayPalPaymentProvider.php @@ -69,22 +69,22 @@ $errors = array(); $issues = array(); - if (!strlen($values[self::PAYPAL_API_USERNAME])) { + if (!@strlen($values[self::PAYPAL_API_USERNAME])) { $errors[] = pht('PayPal API Username is required.'); $issues[self::PAYPAL_API_USERNAME] = pht('Required'); } - if (!strlen($values[self::PAYPAL_API_PASSWORD])) { + if (!@strlen($values[self::PAYPAL_API_PASSWORD])) { $errors[] = pht('PayPal API Password is required.'); $issues[self::PAYPAL_API_PASSWORD] = pht('Required'); } - if (!strlen($values[self::PAYPAL_API_SIGNATURE])) { + if (!@strlen($values[self::PAYPAL_API_SIGNATURE])) { $errors[] = pht('PayPal API Signature is required.'); $issues[self::PAYPAL_API_SIGNATURE] = pht('Required'); } - if (!strlen($values[self::PAYPAL_MODE])) { + if (!@strlen($values[self::PAYPAL_MODE])) { $errors[] = pht('Mode is required.'); $issues[self::PAYPAL_MODE] = pht('Required'); } diff --git a/src/applications/phortune/provider/PhortunePaymentProvider.php b/src/applications/phortune/provider/PhortunePaymentProvider.php --- a/src/applications/phortune/provider/PhortunePaymentProvider.php +++ b/src/applications/phortune/provider/PhortunePaymentProvider.php @@ -96,14 +96,14 @@ array $issues); protected function renderConfigurationSecret($value) { - if (strlen($value)) { - return str_repeat('*', strlen($value)); + if (@strlen($value)) { + return str_repeat('*', @strlen($value)); } return ''; } public function isConfigurationSecret($value) { - return preg_match('/^\*+\z/', trim($value)); + return @preg_match('/^\*+\z/', trim($value)); } abstract public function canRunConfigurationTest(); diff --git a/src/applications/phortune/provider/PhortuneStripePaymentProvider.php b/src/applications/phortune/provider/PhortuneStripePaymentProvider.php --- a/src/applications/phortune/provider/PhortuneStripePaymentProvider.php +++ b/src/applications/phortune/provider/PhortuneStripePaymentProvider.php @@ -6,7 +6,7 @@ const STRIPE_SECRET_KEY = 'stripe.secret-key'; public function isAcceptingLivePayments() { - return preg_match('/_live_/', $this->getPublishableKey()); + return @preg_match('/_live_/', $this->getPublishableKey()); } public function getName() { @@ -64,12 +64,12 @@ $errors = array(); $issues = array(); - if (!strlen($values[self::STRIPE_SECRET_KEY])) { + if (!@strlen($values[self::STRIPE_SECRET_KEY])) { $errors[] = pht('Stripe Secret Key is required.'); $issues[self::STRIPE_SECRET_KEY] = pht('Required'); } - if (!strlen($values[self::STRIPE_PUBLISHABLE_KEY])) { + if (!@strlen($values[self::STRIPE_PUBLISHABLE_KEY])) { $errors[] = pht('Stripe Publishable Key is required.'); $issues[self::STRIPE_PUBLISHABLE_KEY] = pht('Required'); } @@ -304,10 +304,10 @@ private function getStripeShortErrorCode($error_code) { $prefix = 'cc:stripe:'; - if (strncmp($error_code, $prefix, strlen($prefix))) { + if (strncmp($error_code, $prefix, @strlen($prefix))) { return null; } - return substr($error_code, strlen($prefix)); + return @substr($error_code, @strlen($prefix)); } public function validateCreatePaymentMethodToken(array $token) { @@ -426,7 +426,7 @@ ); $param = idx($map, 'param'); - if (strlen($param)) { + if (@strlen($param)) { $rows[] = array( pht('Error Param'), $param, @@ -434,7 +434,7 @@ } $decline_code = idx($map, 'decline_code'); - if (strlen($decline_code)) { + if (@strlen($decline_code)) { $rows[] = array( pht('Decline Code'), $decline_code, diff --git a/src/applications/phortune/storage/PhortunePaymentMethod.php b/src/applications/phortune/storage/PhortunePaymentMethod.php --- a/src/applications/phortune/storage/PhortunePaymentMethod.php +++ b/src/applications/phortune/storage/PhortunePaymentMethod.php @@ -109,7 +109,7 @@ } public function getDisplayName() { - if (strlen($this->name)) { + if (@strlen($this->name)) { return $this->name; } @@ -131,9 +131,9 @@ } public function getDisplayExpires() { - list($year, $month) = explode('-', $this->getExpires()); + list($year, $month) = @explode('-', $this->getExpires()); $month = sprintf('%02d', $month); - $year = substr($year, -2); + $year = @substr($year, -2); return $month.'/'.$year; } diff --git a/src/applications/phortune/view/PhortuneOrderDescriptionView.php b/src/applications/phortune/view/PhortuneOrderDescriptionView.php --- a/src/applications/phortune/view/PhortuneOrderDescriptionView.php +++ b/src/applications/phortune/view/PhortuneOrderDescriptionView.php @@ -19,7 +19,7 @@ $order = $this->getOrder(); $description = $order->getDescription(); - if (!strlen($description)) { + if (!@strlen($description)) { return null; } diff --git a/src/applications/phortune/view/PhortuneOrderSummaryView.php b/src/applications/phortune/view/PhortuneOrderSummaryView.php --- a/src/applications/phortune/view/PhortuneOrderSummaryView.php +++ b/src/applications/phortune/view/PhortuneOrderSummaryView.php @@ -261,14 +261,14 @@ $account_name = $account->getBillingName(); $account_contact = $account->getBillingAddress(); - if (strlen($account_contact)) { + if (@strlen($account_contact)) { $account_contact = new PHUIRemarkupView( $viewer, $account_contact); } $merchant_contact = $merchant->getContactInfo(); - if (strlen($merchant_contact)) { + if (@strlen($merchant_contact)) { $merchant_contact = new PHUIRemarkupView( $viewer, $merchant->getContactInfo()); @@ -355,7 +355,7 @@ $merchant = $order->getMerchant(); $footer = $merchant->getInvoiceFooter(); - if (!strlen($footer)) { + if (!@strlen($footer)) { return null; } diff --git a/src/applications/phortune/xaction/PhortuneAccountBillingNameTransaction.php b/src/applications/phortune/xaction/PhortuneAccountBillingNameTransaction.php --- a/src/applications/phortune/xaction/PhortuneAccountBillingNameTransaction.php +++ b/src/applications/phortune/xaction/PhortuneAccountBillingNameTransaction.php @@ -17,13 +17,13 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (strlen($old) && strlen($new)) { + if (@strlen($old) && @strlen($new)) { return pht( '%s changed the billing name for this account from %s to %s.', $this->renderAuthor(), $this->renderOldValue(), $this->renderNewValue()); - } else if (strlen($old)) { + } else if (@strlen($old)) { return pht( '%s removed the billing name for this account (was %s).', $this->renderAuthor(), @@ -42,7 +42,7 @@ $max_length = $object->getColumnMaximumByteLength('billingName'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newRequiredError( pht('The billing name can be no longer than %s characters.', diff --git a/src/applications/phortune/xaction/PhortuneAccountEmailAddressTransaction.php b/src/applications/phortune/xaction/PhortuneAccountEmailAddressTransaction.php --- a/src/applications/phortune/xaction/PhortuneAccountEmailAddressTransaction.php +++ b/src/applications/phortune/xaction/PhortuneAccountEmailAddressTransaction.php @@ -26,7 +26,7 @@ $old_value = $xaction->getOldValue(); $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/phortune/xaction/PhortuneAccountNameTransaction.php b/src/applications/phortune/xaction/PhortuneAccountNameTransaction.php --- a/src/applications/phortune/xaction/PhortuneAccountNameTransaction.php +++ b/src/applications/phortune/xaction/PhortuneAccountNameTransaction.php @@ -17,7 +17,7 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (strlen($old) && strlen($new)) { + if (@strlen($old) && @strlen($new)) { return pht( '%s renamed this account from %s to %s.', $this->renderAuthor(), @@ -41,7 +41,7 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newRequiredError( pht('The name can be no longer than %s characters.', diff --git a/src/applications/phortune/xaction/PhortuneMerchantInvoiceEmailTransaction.php b/src/applications/phortune/xaction/PhortuneMerchantInvoiceEmailTransaction.php --- a/src/applications/phortune/xaction/PhortuneMerchantInvoiceEmailTransaction.php +++ b/src/applications/phortune/xaction/PhortuneMerchantInvoiceEmailTransaction.php @@ -17,13 +17,13 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (strlen($old) && strlen($new)) { + if (@strlen($old) && @strlen($new)) { return pht( '%s updated the invoice email from %s to %s.', $this->renderAuthor(), $this->renderOldValue(), $this->renderNewValue()); - } else if (strlen($old)) { + } else if (@strlen($old)) { return pht( '%s removed the invoice email.', $this->renderAuthor()); @@ -39,14 +39,14 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (strlen($old) && strlen($new)) { + if (@strlen($old) && @strlen($new)) { return pht( '%s updated %s invoice email from %s to %s.', $this->renderAuthor(), $this->renderObject(), $this->renderOldValue(), $this->renderNewValue()); - } else if (strlen($old)) { + } else if (@strlen($old)) { return pht( '%s removed the invoice email for %s.', $this->renderAuthor(), @@ -69,17 +69,17 @@ $max_length = $object->getColumnMaximumByteLength('invoiceEmail'); foreach ($xactions as $xaction) { - if (strlen($xaction->getNewValue())) { + if (@strlen($xaction->getNewValue())) { $email = new PhutilEmailAddress($xaction->getNewValue()); $domain = $email->getDomainName(); - if (!strlen($domain)) { + if (!@strlen($domain)) { $errors[] = $this->newInvalidError( pht('Invoice email "%s" must be a valid email.', $xaction->getNewValue())); } $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The email can be no longer than %s characters.', diff --git a/src/applications/phortune/xaction/PhortuneMerchantNameTransaction.php b/src/applications/phortune/xaction/PhortuneMerchantNameTransaction.php --- a/src/applications/phortune/xaction/PhortuneMerchantNameTransaction.php +++ b/src/applications/phortune/xaction/PhortuneMerchantNameTransaction.php @@ -41,7 +41,7 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The name can be no longer than %s characters.', diff --git a/src/applications/phortune/xaction/paymentmethod/PhortunePaymentMethodNameTransaction.php b/src/applications/phortune/xaction/paymentmethod/PhortunePaymentMethodNameTransaction.php --- a/src/applications/phortune/xaction/paymentmethod/PhortunePaymentMethodNameTransaction.php +++ b/src/applications/phortune/xaction/paymentmethod/PhortunePaymentMethodNameTransaction.php @@ -17,13 +17,13 @@ $old_value = $this->getOldValue(); $new_value = $this->getNewValue(); - if (strlen($old_value) && strlen($new_value)) { + if (@strlen($old_value) && @strlen($new_value)) { return pht( '%s renamed this payment method from %s to %s.', $this->renderAuthor(), $this->renderOldValue(), $this->renderNewValue()); - } else if (strlen($new_value)) { + } else if (@strlen($new_value)) { return pht( '%s set the name of this payment method to %s.', $this->renderAuthor(), diff --git a/src/applications/phragment/conduit/PhragmentGetPatchConduitAPIMethod.php b/src/applications/phragment/conduit/PhragmentGetPatchConduitAPIMethod.php --- a/src/applications/phragment/conduit/PhragmentGetPatchConduitAPIMethod.php +++ b/src/applications/phragment/conduit/PhragmentGetPatchConduitAPIMethod.php @@ -70,7 +70,7 @@ if ($file_phid !== null) { // If the file PHID is present, then we need to check the // hashes to see if they are the same. - $hash_caller = strtolower($state[$path]); + $hash_caller = @strtolower($state[$path]); $hash_current = $files[$file_phid]->getContentHash(); if ($hash_caller === $hash_current) { // The user's version is identical to our version, so diff --git a/src/applications/phragment/conduit/PhragmentQueryFragmentsConduitAPIMethod.php b/src/applications/phragment/conduit/PhragmentQueryFragmentsConduitAPIMethod.php --- a/src/applications/phragment/conduit/PhragmentQueryFragmentsConduitAPIMethod.php +++ b/src/applications/phragment/conduit/PhragmentQueryFragmentsConduitAPIMethod.php @@ -67,7 +67,7 @@ } $file = $files[$file_phid]; - $cpath = substr($child->getPath(), strlen($fragment->getPath()) + 1); + $cpath = @substr($child->getPath(), @strlen($fragment->getPath()) + 1); $result[] = array( 'phid' => $child->getPHID(), 'phidVersion' => $child->getLatestVersionPHID(), diff --git a/src/applications/phragment/controller/PhragmentController.php b/src/applications/phragment/controller/PhragmentController.php --- a/src/applications/phragment/controller/PhragmentController.php +++ b/src/applications/phragment/controller/PhragmentController.php @@ -3,7 +3,7 @@ abstract class PhragmentController extends PhabricatorController { protected function loadParentFragments($path) { - $components = explode('/', $path); + $components = @explode('/', $path); $combinations = array(); $current = ''; diff --git a/src/applications/phragment/controller/PhragmentCreateController.php b/src/applications/phragment/controller/PhragmentCreateController.php --- a/src/applications/phragment/controller/PhragmentCreateController.php +++ b/src/applications/phragment/controller/PhragmentCreateController.php @@ -33,7 +33,7 @@ $v_viewpolicy = $request->getStr('viewPolicy'); $v_editpolicy = $request->getStr('editPolicy'); - if (strpos($v_name, '/') !== false) { + if (@strpos($v_name, '/') !== false) { $errors[] = pht("The fragment name can not contain '/'."); } diff --git a/src/applications/phragment/controller/PhragmentSnapshotCreateController.php b/src/applications/phragment/controller/PhragmentSnapshotCreateController.php --- a/src/applications/phragment/controller/PhragmentSnapshotCreateController.php +++ b/src/applications/phragment/controller/PhragmentSnapshotCreateController.php @@ -30,10 +30,10 @@ if ($request->isFormPost()) { $v_name = $request->getStr('name'); - if (strlen($v_name) === 0) { + if (@strlen($v_name) === 0) { $errors[] = pht('You must specify a name.'); } - if (strpos($v_name, '/') !== false) { + if (@strpos($v_name, '/') !== false) { $errors[] = pht('Snapshot names can not contain "/".'); } diff --git a/src/applications/phragment/controller/PhragmentZIPController.php b/src/applications/phragment/controller/PhragmentZIPController.php --- a/src/applications/phragment/controller/PhragmentZIPController.php +++ b/src/applications/phragment/controller/PhragmentZIPController.php @@ -95,7 +95,7 @@ $zip->close(); $zip_name = $fragment->getName(); - if (substr($zip_name, -4) !== '.zip') { + if (@substr($zip_name, -4) !== '.zip') { $zip_name .= '.zip'; } diff --git a/src/applications/phragment/storage/PhragmentFragment.php b/src/applications/phragment/storage/PhragmentFragment.php --- a/src/applications/phragment/storage/PhragmentFragment.php +++ b/src/applications/phragment/storage/PhragmentFragment.php @@ -85,7 +85,7 @@ $fragment = id(new PhragmentFragment()); $fragment->setPath($path); - $fragment->setDepth(count(explode('/', $path))); + $fragment->setDepth(count(@explode('/', $path))); $fragment->setLatestVersionPHID(null); $fragment->setViewPolicy($view_policy); $fragment->setEditPolicy($edit_policy); @@ -228,7 +228,7 @@ // Iterate over the existing fragments. foreach ($children as $full_path => $child) { - $path = substr($full_path, strlen($base_path) + 1); + $path = @substr($full_path, @strlen($base_path) + 1); if (array_key_exists($path, $mappings)) { if ($child->isDirectory() && $mappings[$path] === null) { // Don't create a version entry for a directory @@ -306,7 +306,7 @@ ->execute(); if (count($children) === 0) { - $path = substr($this->getPath(), strlen($base_path) + 1); + $path = @substr($this->getPath(), @strlen($base_path) + 1); return array($path => $this); } else { $mappings = array(); diff --git a/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php b/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php --- a/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php +++ b/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php @@ -25,7 +25,7 @@ protected function execute(ConduitAPIRequest $request) { $slug = $request->getValue('slug'); - if (!strlen($slug)) { + if (!@strlen($slug)) { throw new Exception(pht('No such document.')); } $doc = id(new PhrictionDocumentQuery()) diff --git a/src/applications/phriction/controller/PhrictionDiffController.php b/src/applications/phriction/controller/PhrictionDiffController.php --- a/src/applications/phriction/controller/PhrictionDiffController.php +++ b/src/applications/phriction/controller/PhrictionDiffController.php @@ -26,7 +26,7 @@ $ref = $request->getStr('ref'); if ($ref) { - list($l, $r) = explode(',', $ref); + list($l, $r) = @explode(',', $ref); } $content = id(new PhrictionContentQuery()) diff --git a/src/applications/phriction/controller/PhrictionHistoryController.php b/src/applications/phriction/controller/PhrictionHistoryController.php --- a/src/applications/phriction/controller/PhrictionHistoryController.php +++ b/src/applications/phriction/controller/PhrictionHistoryController.php @@ -90,7 +90,7 @@ ->setStatusIcon($icon.' '.$color); $description = $content->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $item->addAttribute($description); } diff --git a/src/applications/phriction/controller/PhrictionMoveController.php b/src/applications/phriction/controller/PhrictionMoveController.php --- a/src/applications/phriction/controller/PhrictionMoveController.php +++ b/src/applications/phriction/controller/PhrictionMoveController.php @@ -35,7 +35,7 @@ // If what the user typed isn't what we're actually using, warn them // about it. - if (strlen($v_slug)) { + if (@strlen($v_slug)) { $no_slash_slug = rtrim($normal_slug, '/'); if ($normal_slug !== $v_slug && $no_slash_slug !== $v_slug) { return $this->newDialog() diff --git a/src/applications/phriction/editor/PhrictionTransactionEditor.php b/src/applications/phriction/editor/PhrictionTransactionEditor.php --- a/src/applications/phriction/editor/PhrictionTransactionEditor.php +++ b/src/applications/phriction/editor/PhrictionTransactionEditor.php @@ -307,7 +307,7 @@ } $description = $object->getContent()->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $body->addTextSection( pht('EDIT NOTES'), $description); @@ -556,7 +556,7 @@ ->setContent($this->getOldContent()->getContent()) ->setDescription(''); - if (strlen($this->getDescription())) { + if (@strlen($this->getDescription())) { $content->setDescription($this->getDescription()); } diff --git a/src/applications/phriction/engineextension/PhrictionDatasourceEngineExtension.php b/src/applications/phriction/engineextension/PhrictionDatasourceEngineExtension.php --- a/src/applications/phriction/engineextension/PhrictionDatasourceEngineExtension.php +++ b/src/applications/phriction/engineextension/PhrictionDatasourceEngineExtension.php @@ -13,13 +13,13 @@ $viewer = $this->getViewer(); // Send "w" to Phriction. - if (preg_match('/^w\z/i', $query)) { + if (@preg_match('/^w\z/i', $query)) { return '/w/'; } // Send "w " to a search for similar wiki documents. $matches = null; - if (preg_match('/^w\s+(.+)\z/i', $query, $matches)) { + if (@preg_match('/^w\s+(.+)\z/i', $query, $matches)) { $raw_query = $matches[1]; $engine = id(new PhrictionDocument()) diff --git a/src/applications/phriction/markup/PhrictionRemarkupRule.php b/src/applications/phriction/markup/PhrictionRemarkupRule.php --- a/src/applications/phriction/markup/PhrictionRemarkupRule.php +++ b/src/applications/phriction/markup/PhrictionRemarkupRule.php @@ -32,7 +32,7 @@ } // If the link contains an anchor, separate that off first. - $parts = explode('#', $path, 2); + $parts = @explode('#', $path, 2); if (count($parts) == 2) { $link = $parts[0]; $anchor = $parts[1]; @@ -42,11 +42,11 @@ } // Handle relative links. - if ((substr($link, 0, 2) === './') || (substr($link, 0, 3) === '../')) { + if ((@substr($link, 0, 2) === './') || (@substr($link, 0, 3) === '../')) { $base = $this->getRelativeBaseURI(); if ($base !== null) { - $base_parts = explode('/', rtrim($base, '/')); - $rel_parts = explode('/', rtrim($link, '/')); + $base_parts = @explode('/', rtrim($base, '/')); + $rel_parts = @explode('/', rtrim($link, '/')); foreach ($rel_parts as $part) { if ($part === '.') { // Consume standalone dots in a relative path, and do @@ -191,21 +191,21 @@ // If the name is something meaningful to humans, we'll render this // in text as: "Title" . Otherwise, we'll just render: . - $is_interesting_name = (bool)strlen($name); + $is_interesting_name = (bool)@strlen($name); $target = idx($document_map, $key, null); if ($target === null) { // The target document doesn't exist. if ($name === null) { - $name = explode('/', trim($link, '/')); + $name = @explode('/', trim($link, '/')); $name = end($name); } $class = 'phriction-link-missing'; } else if (!$target['visible']) { // The document exists, but the user can't see it. if ($name === null) { - $name = explode('/', trim($link, '/')); + $name = @explode('/', trim($link, '/')); $name = end($name); } $class = 'phriction-link-lock'; diff --git a/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php b/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php --- a/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php +++ b/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php @@ -139,7 +139,7 @@ $url->getAlias()); $description = $url->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $description = new PHUIRemarkupView($viewer, $description); $properties->addSectionHeader(pht('Description')); $properties->addTextContent($description); diff --git a/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php b/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php --- a/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php +++ b/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php @@ -78,7 +78,7 @@ $description = $object->getDescription(); $body = parent::buildMailBody($object, $xactions); - if (strlen($description)) { + if (@strlen($description)) { $body->addRemarkupSection( pht('URL DESCRIPTION'), $object->getDescription()); diff --git a/src/applications/phurl/mail/PhabricatorPhurlURLMailReceiver.php b/src/applications/phurl/mail/PhabricatorPhurlURLMailReceiver.php --- a/src/applications/phurl/mail/PhabricatorPhurlURLMailReceiver.php +++ b/src/applications/phurl/mail/PhabricatorPhurlURLMailReceiver.php @@ -13,7 +13,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 1); + $id = (int)@substr($pattern, 1); return id(new PhabricatorPhurlURLQuery()) ->setViewer($viewer) diff --git a/src/applications/phurl/phid/PhabricatorPhurlURLPHIDType.php b/src/applications/phurl/phid/PhabricatorPhurlURLPHIDType.php --- a/src/applications/phurl/phid/PhabricatorPhurlURLPHIDType.php +++ b/src/applications/phurl/phid/PhabricatorPhurlURLPHIDType.php @@ -44,7 +44,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^U[1-9]\d*$/i', $name); + return @preg_match('/^U[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -53,7 +53,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/phurl/remarkup/PhabricatorPhurlLinkRemarkupRule.php b/src/applications/phurl/remarkup/PhabricatorPhurlLinkRemarkupRule.php --- a/src/applications/phurl/remarkup/PhabricatorPhurlLinkRemarkupRule.php +++ b/src/applications/phurl/remarkup/PhabricatorPhurlLinkRemarkupRule.php @@ -33,7 +33,7 @@ $query = id(new PhabricatorPhurlURLQuery()) ->setViewer($viewer); - if (preg_match($is_monogram, $ref, $monogram)) { + if (@preg_match($is_monogram, $ref, $monogram)) { $query->withIDs(array($monogram[1])); } else if (ctype_digit($ref)) { $query->withIDs(array($ref)); diff --git a/src/applications/phurl/storage/PhabricatorPhurlURL.php b/src/applications/phurl/storage/PhabricatorPhurlURL.php --- a/src/applications/phurl/storage/PhabricatorPhurlURL.php +++ b/src/applications/phurl/storage/PhabricatorPhurlURL.php @@ -100,7 +100,7 @@ } public function getRedirectURI() { - if (strlen($this->getAlias())) { + if (@strlen($this->getAlias())) { $path = '/u/'.$this->getAlias(); } else { $path = '/u/'.$this->getID(); diff --git a/src/applications/phurl/xaction/PhabricatorPhurlURLAliasTransaction.php b/src/applications/phurl/xaction/PhabricatorPhurlURLAliasTransaction.php --- a/src/applications/phurl/xaction/PhabricatorPhurlURLAliasTransaction.php +++ b/src/applications/phurl/xaction/PhabricatorPhurlURLAliasTransaction.php @@ -43,7 +43,7 @@ $new_alias = $xaction->getNewValue(); // Check length - $new_length = strlen($new_alias); + $new_length = @strlen($new_alias); if ($new_length > $max_length) { $errors[] = $this->newRequiredError( pht('The alias can be no longer than %d characters.', $max_length)); @@ -52,13 +52,13 @@ // Check characters if ($xaction->getOldValue() != $xaction->getNewValue()) { $debug_alias = new PHUIInvisibleCharacterView($new_alias); - if (!preg_match('/[a-zA-Z]/', $new_alias)) { + if (!@preg_match('/[a-zA-Z]/', $new_alias)) { $errors[] = $this->newRequiredError( pht('The alias you provided (%s) must contain at least one '. 'letter.', $debug_alias)); } - if (preg_match('/[^a-z0-9]/i', $new_alias)) { + if (@preg_match('/[^a-z0-9]/i', $new_alias)) { $errors[] = $this->newRequiredError( pht('The alias you provided (%s) may only contain letters and '. 'numbers.', diff --git a/src/applications/policy/management/PhabricatorPolicyManagementUnlockWorkflow.php b/src/applications/policy/management/PhabricatorPolicyManagementUnlockWorkflow.php --- a/src/applications/policy/management/PhabricatorPolicyManagementUnlockWorkflow.php +++ b/src/applications/policy/management/PhabricatorPolicyManagementUnlockWorkflow.php @@ -125,7 +125,7 @@ pht('Modified object policies.')); $uri = $handle->getURI(); - if (strlen($uri)) { + if (@strlen($uri)) { echo tsprintf( "\n **%s**: __%s__\n\n", pht('Object URI'), diff --git a/src/applications/policy/query/PhabricatorPolicyQuery.php b/src/applications/policy/query/PhabricatorPolicyQuery.php --- a/src/applications/policy/query/PhabricatorPolicyQuery.php +++ b/src/applications/policy/query/PhabricatorPolicyQuery.php @@ -307,7 +307,7 @@ public static function isObjectPolicy($identifier) { $prefix = self::OBJECT_POLICY_PREFIX; - return !strncmp($identifier, $prefix, strlen($prefix)); + return !strncmp($identifier, $prefix, @strlen($prefix)); } public static function getObjectPolicy($identifier) { diff --git a/src/applications/ponder/controller/PonderAnswerEditController.php b/src/applications/ponder/controller/PonderAnswerEditController.php --- a/src/applications/ponder/controller/PonderAnswerEditController.php +++ b/src/applications/ponder/controller/PonderAnswerEditController.php @@ -34,7 +34,7 @@ $v_content = $request->getStr('content'); $v_status = $request->getStr('status'); - if (!strlen($v_content)) { + if (!@strlen($v_content)) { $errors[] = pht('You must provide some substance in your answer.'); $e_content = pht('Required'); } diff --git a/src/applications/ponder/controller/PonderAnswerSaveController.php b/src/applications/ponder/controller/PonderAnswerSaveController.php --- a/src/applications/ponder/controller/PonderAnswerSaveController.php +++ b/src/applications/ponder/controller/PonderAnswerSaveController.php @@ -21,7 +21,7 @@ $content = $request->getStr('answer'); - if (!strlen(trim($content))) { + if (!@strlen(trim($content))) { $dialog = id(new AphrontDialogView()) ->setUser($viewer) ->setTitle(pht('Empty Answer')) diff --git a/src/applications/ponder/mail/PonderAnswerMailReceiver.php b/src/applications/ponder/mail/PonderAnswerMailReceiver.php --- a/src/applications/ponder/mail/PonderAnswerMailReceiver.php +++ b/src/applications/ponder/mail/PonderAnswerMailReceiver.php @@ -12,7 +12,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 4); + $id = (int)@substr($pattern, 4); return id(new PonderAnswerQuery()) ->setViewer($viewer) diff --git a/src/applications/ponder/mail/PonderQuestionCreateMailReceiver.php b/src/applications/ponder/mail/PonderQuestionCreateMailReceiver.php --- a/src/applications/ponder/mail/PonderQuestionCreateMailReceiver.php +++ b/src/applications/ponder/mail/PonderQuestionCreateMailReceiver.php @@ -13,7 +13,7 @@ $author = $this->getAuthor(); $title = $mail->getSubject(); - if (!strlen($title)) { + if (!@strlen($title)) { $title = pht('New Question'); } diff --git a/src/applications/ponder/mail/PonderQuestionMailReceiver.php b/src/applications/ponder/mail/PonderQuestionMailReceiver.php --- a/src/applications/ponder/mail/PonderQuestionMailReceiver.php +++ b/src/applications/ponder/mail/PonderQuestionMailReceiver.php @@ -12,7 +12,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 1); + $id = (int)@substr($pattern, 1); return id(new PonderQuestionQuery()) ->setViewer($viewer) diff --git a/src/applications/ponder/phid/PonderQuestionPHIDType.php b/src/applications/ponder/phid/PonderQuestionPHIDType.php --- a/src/applications/ponder/phid/PonderQuestionPHIDType.php +++ b/src/applications/ponder/phid/PonderQuestionPHIDType.php @@ -41,7 +41,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^Q\d*[1-9]\d*$/i', $name); + return @preg_match('/^Q\d*[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -50,7 +50,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/ponder/xaction/PonderAnswerContentTransaction.php b/src/applications/ponder/xaction/PonderAnswerContentTransaction.php --- a/src/applications/ponder/xaction/PonderAnswerContentTransaction.php +++ b/src/applications/ponder/xaction/PonderAnswerContentTransaction.php @@ -16,7 +16,7 @@ public function getTitle() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s added an answer.', $this->renderAuthor()); @@ -30,7 +30,7 @@ public function getTitleForFeed() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s added %s.', $this->renderAuthor(), diff --git a/src/applications/ponder/xaction/PonderQuestionTitleTransaction.php b/src/applications/ponder/xaction/PonderQuestionTitleTransaction.php --- a/src/applications/ponder/xaction/PonderQuestionTitleTransaction.php +++ b/src/applications/ponder/xaction/PonderQuestionTitleTransaction.php @@ -41,7 +41,7 @@ $max_length = $object->getColumnMaximumByteLength('title'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The title can be no longer than %s characters.', diff --git a/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php b/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php --- a/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php +++ b/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php @@ -1435,7 +1435,7 @@ $task = ManiphestTask::initializeNewTask($viewer); - if (!strlen($name)) { + if (!@strlen($name)) { $name = pht('Test Task'); } diff --git a/src/applications/project/constants/PhabricatorProjectWorkboardBackgroundColor.php b/src/applications/project/constants/PhabricatorProjectWorkboardBackgroundColor.php --- a/src/applications/project/constants/PhabricatorProjectWorkboardBackgroundColor.php +++ b/src/applications/project/constants/PhabricatorProjectWorkboardBackgroundColor.php @@ -110,7 +110,7 @@ foreach ($options as $key => $option) { if (empty($option['group'])) { - if (preg_match('/^gradient/', $option['key'])) { + if (@preg_match('/^gradient/', $option['key'])) { $option['group'] = 'gradient'; } else { $option['group'] = 'solid'; diff --git a/src/applications/project/controller/PhabricatorProjectBoardReloadController.php b/src/applications/project/controller/PhabricatorProjectBoardReloadController.php --- a/src/applications/project/controller/PhabricatorProjectBoardReloadController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardReloadController.php @@ -12,7 +12,7 @@ } $order = $request->getStr('order'); - if (!strlen($order)) { + if (!@strlen($order)) { $order = PhabricatorProjectColumnNaturalOrder::ORDERKEY; } diff --git a/src/applications/project/controller/PhabricatorProjectMoveController.php b/src/applications/project/controller/PhabricatorProjectMoveController.php --- a/src/applications/project/controller/PhabricatorProjectMoveController.php +++ b/src/applications/project/controller/PhabricatorProjectMoveController.php @@ -16,7 +16,7 @@ $before_phids = $request->getStrList('beforePHIDs'); $order = $request->getStr('order'); - if (!strlen($order)) { + if (!@strlen($order)) { $order = PhabricatorProjectColumnNaturalOrder::ORDERKEY; } @@ -26,7 +26,7 @@ $edit_header = null; $raw_header = $request->getStr('header'); - if (strlen($raw_header)) { + if (@strlen($raw_header)) { $edit_header = phutil_json_decode($raw_header); } else { $edit_header = array(); diff --git a/src/applications/project/engineextension/ProjectDatasourceEngineExtension.php b/src/applications/project/engineextension/ProjectDatasourceEngineExtension.php --- a/src/applications/project/engineextension/ProjectDatasourceEngineExtension.php +++ b/src/applications/project/engineextension/ProjectDatasourceEngineExtension.php @@ -13,13 +13,13 @@ $viewer = $this->getViewer(); // Send "p" to Projects. - if (preg_match('/^p\z/i', $query)) { + if (@preg_match('/^p\z/i', $query)) { return '/diffusion/'; } // Send "p " to a search for similar projects. $matches = null; - if (preg_match('/^p\s+(.+)\z/i', $query, $matches)) { + if (@preg_match('/^p\s+(.+)\z/i', $query, $matches)) { $raw_query = $matches[1]; $engine = id(new PhabricatorProject()) diff --git a/src/applications/project/icon/PhabricatorProjectIconSet.php b/src/applications/project/icon/PhabricatorProjectIconSet.php --- a/src/applications/project/icon/PhabricatorProjectIconSet.php +++ b/src/applications/project/icon/PhabricatorProjectIconSet.php @@ -218,7 +218,7 @@ 'default' => 'optional bool', )); - if (!preg_match('/^[a-z]{1,32}\z/', $value['key'])) { + if (!@preg_match('/^[a-z]{1,32}\z/', $value['key'])) { throw new Exception( pht( 'Icon key "%s" is not a valid icon key. Icon keys must be 1-32 '. diff --git a/src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php --- a/src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php +++ b/src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php @@ -31,7 +31,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php --- a/src/applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php +++ b/src/applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php @@ -31,7 +31,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php --- a/src/applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php +++ b/src/applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php @@ -21,7 +21,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/project/menuitem/PhabricatorProjectReportsProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectReportsProfileMenuItem.php --- a/src/applications/project/menuitem/PhabricatorProjectReportsProfileMenuItem.php +++ b/src/applications/project/menuitem/PhabricatorProjectReportsProfileMenuItem.php @@ -46,7 +46,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/project/menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php --- a/src/applications/project/menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php +++ b/src/applications/project/menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php @@ -29,7 +29,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php --- a/src/applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php +++ b/src/applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php @@ -38,7 +38,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php b/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php --- a/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php +++ b/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php @@ -43,7 +43,7 @@ $handle->setName($name); - if (strlen($slug)) { + if (@strlen($slug)) { $handle->setObjectName('#'.$slug); $handle->setMailStampName('#'.$slug); $handle->setURI("/tag/{$slug}/"); @@ -72,7 +72,7 @@ public function canLoadNamedObject($name) { $fragment = self::getProjectMonogramPatternFragment(); - return preg_match('/^#'.$fragment.'$/i', $name); + return @preg_match('/^#'.$fragment.'$/i', $name); } public function loadNamedObjects( @@ -84,7 +84,7 @@ $map = array(); foreach ($names as $key => $slug) { - $map[$this->normalizeSlug(substr($slug, 1))][] = $slug; + $map[$this->normalizeSlug(@substr($slug, 1))][] = $slug; } $projects = id(new PhabricatorProjectQuery()) diff --git a/src/applications/project/query/PhabricatorProjectQuery.php b/src/applications/project/query/PhabricatorProjectQuery.php --- a/src/applications/project/query/PhabricatorProjectQuery.php +++ b/src/applications/project/query/PhabricatorProjectQuery.php @@ -889,7 +889,7 @@ $length_map = array(); foreach ($tokens as $token) { - $length_map[$token] = strlen($token); + $length_map[$token] = @strlen($token); } arsort($length_map); diff --git a/src/applications/project/query/PhabricatorProjectSearchEngine.php b/src/applications/project/query/PhabricatorProjectSearchEngine.php --- a/src/applications/project/query/PhabricatorProjectSearchEngine.php +++ b/src/applications/project/query/PhabricatorProjectSearchEngine.php @@ -130,7 +130,7 @@ protected function buildQueryFromParameters(array $map) { $query = $this->newQuery(); - if (strlen($map['name'])) { + if (@strlen($map['name'])) { $tokens = PhabricatorTypeaheadDatasource::tokenizeString($map['name']); $query->withNameTokens($tokens); } diff --git a/src/applications/project/remarkup/ProjectRemarkupRule.php b/src/applications/project/remarkup/ProjectRemarkupRule.php --- a/src/applications/project/remarkup/ProjectRemarkupRule.php +++ b/src/applications/project/remarkup/ProjectRemarkupRule.php @@ -67,7 +67,7 @@ // Slice the "#" off again. $result = array(); foreach ($projects as $name => $project) { - $result[substr($name, 1)] = $project; + $result[@substr($name, 1)] = $project; } return $result; diff --git a/src/applications/project/state/PhabricatorWorkboardViewState.php b/src/applications/project/state/PhabricatorWorkboardViewState.php --- a/src/applications/project/state/PhabricatorWorkboardViewState.php +++ b/src/applications/project/state/PhabricatorWorkboardViewState.php @@ -41,7 +41,7 @@ $this->requestState['filter'] = $request->getStr('filter'); } - if (strlen($request->getURIData('queryKey'))) { + if (@strlen($request->getURIData('queryKey'))) { $this->requestState['filter'] = $request->getURIData('queryKey'); } @@ -169,7 +169,7 @@ public function getQueryKey() { $request_query = idx($this->requestState, 'filter'); - if (strlen($request_query)) { + if (@strlen($request_query)) { return $request_query; } @@ -203,7 +203,7 @@ $default_query = $project->getDefaultWorkboardFilter(); - if (strlen($default_query)) { + if (@strlen($default_query)) { return $default_query; } diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -407,13 +407,13 @@ $this->setMailKey(Filesystem::readRandomCharacters(20)); } - if (!strlen($this->getPHID())) { + if (!@strlen($this->getPHID())) { $this->setPHID($this->generatePHID()); } - if (!strlen($this->getProjectPathKey())) { + if (!@strlen($this->getProjectPathKey())) { $hash = PhabricatorHash::digestForIndex($this->getPHID()); - $hash = substr($hash, 0, 4); + $hash = @substr($hash, 0, 4); $this->setProjectPathKey($hash); } @@ -505,10 +505,10 @@ $parts = array(); $path = $this->getProjectPath(); - $parent_length = (strlen($path) - 4); + $parent_length = (@strlen($path) - 4); for ($ii = $parent_length; $ii > 0; $ii -= 4) { - $parts[] = substr($path, 0, $ii); + $parts[] = @substr($path, 0, $ii); } return $parts; diff --git a/src/applications/project/storage/PhabricatorProjectColumn.php b/src/applications/project/storage/PhabricatorProjectColumn.php --- a/src/applications/project/storage/PhabricatorProjectColumn.php +++ b/src/applications/project/storage/PhabricatorProjectColumn.php @@ -105,7 +105,7 @@ } $name = $this->getName(); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/project/storage/PhabricatorProjectTrigger.php b/src/applications/project/storage/PhabricatorProjectTrigger.php --- a/src/applications/project/storage/PhabricatorProjectTrigger.php +++ b/src/applications/project/storage/PhabricatorProjectTrigger.php @@ -53,7 +53,7 @@ public function getDisplayName() { $name = $this->getName(); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/project/typeahead/PhabricatorProjectDatasource.php b/src/applications/project/typeahead/PhabricatorProjectDatasource.php --- a/src/applications/project/typeahead/PhabricatorProjectDatasource.php +++ b/src/applications/project/typeahead/PhabricatorProjectDatasource.php @@ -83,10 +83,10 @@ } $slug = $proj->getPrimarySlug(); - if (!strlen($slug)) { + if (!@strlen($slug)) { foreach ($proj->getSlugs() as $slug_object) { $slug = $slug_object->getSlug(); - if (strlen($slug)) { + if (@strlen($slug)) { break; } } @@ -94,7 +94,7 @@ // If we're building results for the autocompleter and this project // doesn't have any usable slugs, don't return it as a result. - if ($for_autocomplete && !strlen($slug)) { + if ($for_autocomplete && !@strlen($slug)) { continue; } @@ -132,7 +132,7 @@ ->setPriorityType('proj') ->setClosed($closed); - if (strlen($slug)) { + if (@strlen($slug)) { $proj_result->setAutocomplete('#'.$slug); } @@ -142,7 +142,7 @@ $proj_result->addAttribute($proj->getDisplayIconName()); $description = idx($descriptions, $phid); - if (strlen($description)) { + if (@strlen($description)) { $summary = PhabricatorMarkupEngine::summarizeSentence($description); $proj_result->addAttribute($summary); } diff --git a/src/applications/project/xaction/PhabricatorProjectNameTransaction.php b/src/applications/project/xaction/PhabricatorProjectNameTransaction.php --- a/src/applications/project/xaction/PhabricatorProjectNameTransaction.php +++ b/src/applications/project/xaction/PhabricatorProjectNameTransaction.php @@ -72,7 +72,7 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/project/xaction/column/PhabricatorProjectColumnLimitTransaction.php b/src/applications/project/xaction/column/PhabricatorProjectColumnLimitTransaction.php --- a/src/applications/project/xaction/column/PhabricatorProjectColumnLimitTransaction.php +++ b/src/applications/project/xaction/column/PhabricatorProjectColumnLimitTransaction.php @@ -10,7 +10,7 @@ } public function generateNewValue($object, $value) { - if (strlen($value)) { + if (@strlen($value)) { return (int)$value; } else { return null; @@ -48,7 +48,7 @@ foreach ($xactions as $xaction) { $value = $xaction->getNewValue(); - if (strlen($value) && !preg_match('/^\d+\z/', $value)) { + if (@strlen($value) && !@preg_match('/^\d+\z/', $value)) { $errors[] = $this->newInvalidError( pht( 'Column point limit must either be empty or a nonnegative '. diff --git a/src/applications/project/xaction/column/PhabricatorProjectColumnNameTransaction.php b/src/applications/project/xaction/column/PhabricatorProjectColumnNameTransaction.php --- a/src/applications/project/xaction/column/PhabricatorProjectColumnNameTransaction.php +++ b/src/applications/project/xaction/column/PhabricatorProjectColumnNameTransaction.php @@ -17,12 +17,12 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s named this column %s.', $this->renderAuthor(), $this->renderNewValue()); - } else if (strlen($new)) { + } else if (@strlen($new)) { return pht( '%s renamed this column from %s to %s.', $this->renderAuthor(), @@ -53,7 +53,7 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/project/xaction/trigger/PhabricatorProjectTriggerNameTransaction.php b/src/applications/project/xaction/trigger/PhabricatorProjectTriggerNameTransaction.php --- a/src/applications/project/xaction/trigger/PhabricatorProjectTriggerNameTransaction.php +++ b/src/applications/project/xaction/trigger/PhabricatorProjectTriggerNameTransaction.php @@ -17,13 +17,13 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (strlen($old) && strlen($new)) { + if (@strlen($old) && @strlen($new)) { return pht( '%s renamed this trigger from %s to %s.', $this->renderAuthor(), $this->renderOldValue(), $this->renderNewValue()); - } else if (strlen($new)) { + } else if (@strlen($new)) { return pht( '%s named this trigger %s.', $this->renderAuthor(), @@ -42,7 +42,7 @@ $max_length = $object->getColumnMaximumByteLength('name'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht( diff --git a/src/applications/releeph/commitfinder/ReleephCommitFinder.php b/src/applications/releeph/commitfinder/ReleephCommitFinder.php --- a/src/applications/releeph/commitfinder/ReleephCommitFinder.php +++ b/src/applications/releeph/commitfinder/ReleephCommitFinder.php @@ -28,7 +28,7 @@ // Look for diffs $matches = array(); - if (preg_match('/^D([1-9]\d*)$/', $partial_string, $matches)) { + if (@preg_match('/^D([1-9]\d*)$/', $partial_string, $matches)) { $diff_id = $matches[1]; $diff_rev = id(new DifferentialRevisionQuery()) ->setViewer($this->getUser()) @@ -64,7 +64,7 @@ $repository = $this->releephProject->getRepository(); $dr_data = null; $matches = array(); - if (preg_match('/^r(?P[A-Z]+)(?P\w+)$/', + if (@preg_match('/^r(?P[A-Z]+)(?P\w+)$/', $partial_string, $matches)) { $callsign = $matches['callsign']; if ($callsign != $repository->getCallsign()) { diff --git a/src/applications/releeph/conduit/work/ReleephWorkGetBranchCommitMessageConduitAPIMethod.php b/src/applications/releeph/conduit/work/ReleephWorkGetBranchCommitMessageConduitAPIMethod.php --- a/src/applications/releeph/conduit/work/ReleephWorkGetBranchCommitMessageConduitAPIMethod.php +++ b/src/applications/releeph/conduit/work/ReleephWorkGetBranchCommitMessageConduitAPIMethod.php @@ -64,7 +64,7 @@ $cut_point_pr_commit = id(new PhabricatorRepositoryCommit()) ->loadOneWhere('phid = %s', $cut_phid); - $cut_point_commit_date = strftime( + $cut_point_commit_date = @strftime( '%Y-%m-%d %H:%M:%S%z', $cut_point_pr_commit->getEpoch()); $commit_message[] = pht('Cut Point Date: %s', $cut_point_commit_date); diff --git a/src/applications/releeph/conduit/work/ReleephWorkGetCommitMessageConduitAPIMethod.php b/src/applications/releeph/conduit/work/ReleephWorkGetCommitMessageConduitAPIMethod.php --- a/src/applications/releeph/conduit/work/ReleephWorkGetCommitMessageConduitAPIMethod.php +++ b/src/applications/releeph/conduit/work/ReleephWorkGetCommitMessageConduitAPIMethod.php @@ -78,8 +78,8 @@ } if ($label && $value) { - if (strpos($value, "\n") !== false || - substr($value, 0, 2) === ' ') { + if (@strpos($value, "\n") !== false || + @substr($value, 0, 2) === ' ') { $commit_message[] = "{$label}:\n{$value}"; } else { $commit_message[] = "{$label}: {$value}"; diff --git a/src/applications/releeph/constants/ReleephRequestStatus.php b/src/applications/releeph/constants/ReleephRequestStatus.php --- a/src/applications/releeph/constants/ReleephRequestStatus.php +++ b/src/applications/releeph/constants/ReleephRequestStatus.php @@ -25,7 +25,7 @@ public static function getStatusClassSuffixFor($status) { $description = self::getStatusDescriptionFor($status); - $class = str_replace(' ', '-', strtolower($description)); + $class = str_replace(' ', '-', @strtolower($description)); return $class; } diff --git a/src/applications/releeph/controller/product/ReleephProductEditController.php b/src/applications/releeph/controller/product/ReleephProductEditController.php --- a/src/applications/releeph/controller/product/ReleephProductEditController.php +++ b/src/applications/releeph/controller/product/ReleephProductEditController.php @@ -36,7 +36,7 @@ $product->getDetail('pick_failure_instructions')); $test_paths = $request->getStr('testPaths'); if ($test_paths !== null) { - $test_paths = array_filter(explode("\n", $test_paths)); + $test_paths = array_filter(@explode("\n", $test_paths)); } else { $test_paths = $product->getDetail('testPaths', array()); } @@ -69,7 +69,7 @@ } foreach ($test_paths as $test_path) { - $result = @preg_match($test_path, ''); + $result = @@preg_match($test_path, ''); $is_a_valid_regexp = $result !== false; if (!$is_a_valid_regexp) { $errors[] = pht('Please provide a valid regular expression: '. diff --git a/src/applications/releeph/controller/request/ReleephRequestTypeaheadController.php b/src/applications/releeph/controller/request/ReleephRequestTypeaheadController.php --- a/src/applications/releeph/controller/request/ReleephRequestTypeaheadController.php +++ b/src/applications/releeph/controller/request/ReleephRequestTypeaheadController.php @@ -48,7 +48,7 @@ foreach ($rows as $row) { $full_commit_id = $row['commitIdentifier']; - $short_commit_id = substr($full_commit_id, 0, 12); + $short_commit_id = @substr($full_commit_id, 0, 12); $first_line = $this->getFirstLine($row['shortMessage']); $data[] = array( $full_commit_id, @@ -79,8 +79,8 @@ $string = ltrim($commit_message_fragment); $first_line = $string; foreach ($separators as $separator) { - if ($pos = strpos($string, $separator)) { - $first_line = substr($string, 0, $pos); + if ($pos = @strpos($string, $separator)) { + $first_line = @substr($string, 0, $pos); break; } } diff --git a/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php b/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php --- a/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php +++ b/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php @@ -152,11 +152,11 @@ * To hack around this, just consider the first line of $value when * determining what Releeph actions the parsed commit is performing. */ - $first_line = head(array_filter(explode("\n", $value))); + $first_line = head(array_filter(@explode("\n", $value))); $tokens = preg_split('/\s*,?\s+/', $first_line); $raw_action = array_shift($tokens); - $action = strtolower($raw_action); + $action = @strtolower($raw_action); if (!$action) { return null; @@ -178,7 +178,7 @@ $releeph_requests = array(); foreach ($tokens as $token) { $match = array(); - if (!preg_match('/^(?:RQ)?(\d+)$/i', $token, $match)) { + if (!@preg_match('/^(?:RQ)?(\d+)$/i', $token, $match)) { $label = $this->renderLabelForCommitMessage(); throw new DifferentialFieldParseException( pht( @@ -330,11 +330,11 @@ $remote_prefix = 'remotes/origin/'; $branches = array(); - foreach (array_filter(explode("\n", $output)) as $line) { - $tokens = explode(' ', $line); + foreach (array_filter(@explode("\n", $output)) as $line) { + $tokens = @explode(' ', $line); $ref = last($tokens); - if (strncmp($ref, $remote_prefix, strlen($remote_prefix)) === 0) { - $branch = substr($ref, strlen($remote_prefix)); + if (strncmp($ref, $remote_prefix, @strlen($remote_prefix)) === 0) { + $branch = @substr($ref, @strlen($remote_prefix)); $branches[$branch] = $branch; } } @@ -357,7 +357,7 @@ $in_branch = array(); $ex_branch = array(); foreach ($commit_paths as $path) { - if (strncmp($path, $branch_path, strlen($branch_path)) === 0) { + if (strncmp($path, $branch_path, @strlen($branch_path)) === 0) { $in_branch[] = $path; } else { $ex_branch[] = $path; diff --git a/src/applications/releeph/editor/ReleephBranchEditor.php b/src/applications/releeph/editor/ReleephBranchEditor.php --- a/src/applications/releeph/editor/ReleephBranchEditor.php +++ b/src/applications/releeph/editor/ReleephBranchEditor.php @@ -36,7 +36,7 @@ ->setReleephProjectName($this->releephProject->getName()) ->interpolate($template); - $basename = last(explode('/', $name)); + $basename = last(@explode('/', $name)); $table = id(new ReleephBranch()); $transaction = $table->openTransaction(); diff --git a/src/applications/releeph/field/specification/ReleephFieldSpecification.php b/src/applications/releeph/field/specification/ReleephFieldSpecification.php --- a/src/applications/releeph/field/specification/ReleephFieldSpecification.php +++ b/src/applications/releeph/field/specification/ReleephFieldSpecification.php @@ -43,7 +43,7 @@ if ($key === null) { throw new PhabricatorCustomFieldImplementationIncompleteException($this); } - if (strpos($key, '.') !== false) { + if (@strpos($key, '.') !== false) { /** * Storage keys are reused for form controls, and periods in form control * names break HTML forms. diff --git a/src/applications/releeph/field/specification/ReleephSummaryFieldSpecification.php b/src/applications/releeph/field/specification/ReleephSummaryFieldSpecification.php --- a/src/applications/releeph/field/specification/ReleephSummaryFieldSpecification.php +++ b/src/applications/releeph/field/specification/ReleephSummaryFieldSpecification.php @@ -40,7 +40,7 @@ } public function validate($summary) { - if ($summary && strlen($summary) > self::MAX_SUMMARY_LENGTH) { + if ($summary && @strlen($summary) > self::MAX_SUMMARY_LENGTH) { $this->error = pht('Too long!'); throw new ReleephFieldParseException( $this, diff --git a/src/applications/releeph/mail/ReleephRequestMailReceiver.php b/src/applications/releeph/mail/ReleephRequestMailReceiver.php --- a/src/applications/releeph/mail/ReleephRequestMailReceiver.php +++ b/src/applications/releeph/mail/ReleephRequestMailReceiver.php @@ -12,7 +12,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 1); + $id = (int)@substr($pattern, 1); return id(new ReleephRequestQuery()) ->setViewer($viewer) diff --git a/src/applications/releeph/storage/ReleephProject.php b/src/applications/releeph/storage/ReleephProject.php --- a/src/applications/releeph/storage/ReleephProject.php +++ b/src/applications/releeph/storage/ReleephProject.php @@ -104,7 +104,7 @@ $test_paths = $this->getDetail('testPaths', array()); foreach ($test_paths as $test_path) { - if (preg_match($test_path, $filename)) { + if (@preg_match($test_path, $filename)) { return true; } } diff --git a/src/applications/releeph/storage/ReleephRequest.php b/src/applications/releeph/storage/ReleephRequest.php --- a/src/applications/releeph/storage/ReleephRequest.php +++ b/src/applications/releeph/storage/ReleephRequest.php @@ -240,14 +240,14 @@ public function getSummaryForDisplay() { $summary = $this->getDetail('summary'); - if (!strlen($summary)) { + if (!@strlen($summary)) { $commit = $this->loadPhabricatorRepositoryCommit(); if ($commit) { $summary = $commit->getSummary(); } } - if (!strlen($summary)) { + if (!@strlen($summary)) { $summary = pht('None'); } diff --git a/src/applications/releeph/view/branch/ReleephBranchTemplate.php b/src/applications/releeph/view/branch/ReleephBranchTemplate.php --- a/src/applications/releeph/view/branch/ReleephBranchTemplate.php +++ b/src/applications/releeph/view/branch/ReleephBranchTemplate.php @@ -96,13 +96,13 @@ preg_split('/r[A-Z]+/', $this->commitHandle->getName())); $interpolations = array(); - for ($ii = 0; $ii < strlen($name); $ii++) { - $char = substr($name, $ii, 1); + for ($ii = 0; $ii < @strlen($name); $ii++) { + $char = @substr($name, $ii, 1); $prev = null; if ($ii > 0) { - $prev = substr($name, $ii - 1, 1); + $prev = @substr($name, $ii - 1, 1); } - $next = substr($name, $ii + 1, 1); + $next = @substr($name, $ii + 1, 1); if ($next && $char == '%' && $prev != '%') { $interpolations[$ii] = $next; } @@ -138,13 +138,13 @@ break; case 'p': - $replacement = strtolower($safe_project_name); + $replacement = @strtolower($safe_project_name); $is_variable = false; break; default: // Format anything else using strftime() - $replacement = strftime("%{$code}", $branch_date); + $replacement = @strftime("%{$code}", $branch_date); $is_variable = true; break; } @@ -165,22 +165,22 @@ private function validateAsBranchName($name) { $errors = array(); - if (preg_match('{^/}', $name) || preg_match('{/$}', $name)) { + if (@preg_match('{^/}', $name) || @preg_match('{/$}', $name)) { $errors[] = pht("Branches cannot begin or end with '%s'", '/'); } - if (preg_match('{//+}', $name)) { + if (@preg_match('{//+}', $name)) { $errors[] = pht("Branches cannot contain multiple consecutive '%s'", '/'); } - $parts = array_filter(explode('/', $name)); + $parts = array_filter(@explode('/', $name)); foreach ($parts as $index => $part) { $part_error = null; - if (preg_match('{^\.}', $part) || preg_match('{\.$}', $part)) { + if (@preg_match('{^\.}', $part) || @preg_match('{\.$}', $part)) { $errors[] = pht("Path components cannot begin or end with '%s'", '.'); - } else if (preg_match('{^(?!\w)}', $part)) { + } else if (@preg_match('{^(?!\w)}', $part)) { $errors[] = pht('Path components must begin with an alphanumeric.'); - } else if (!preg_match('{^\w ([\w-_%\.]* [\w-_%])?$}x', $part)) { + } else if (!@preg_match('{^\w ([\w-_%\.]* [\w-_%])?$}x', $part)) { $errors[] = pht( "Path components may only contain alphanumerics ". "or '%s', '%s' or '%s'.", diff --git a/src/applications/repository/daemon/PhabricatorGitGraphStream.php b/src/applications/repository/daemon/PhabricatorGitGraphStream.php --- a/src/applications/repository/daemon/PhabricatorGitGraphStream.php +++ b/src/applications/repository/daemon/PhabricatorGitGraphStream.php @@ -64,13 +64,13 @@ $gitlog->next(); $line = trim($line); - if (!strlen($line)) { + if (!@strlen($line)) { break; } - list($hash, $parents, $epoch) = explode("\1", $line); + list($hash, $parents, $epoch) = @explode("\1", $line); if ($parents) { - $parents = explode(' ', $parents); + $parents = @explode(' ', $parents); } else { // First commit. $parents = array(); diff --git a/src/applications/repository/daemon/PhabricatorMercurialGraphStream.php b/src/applications/repository/daemon/PhabricatorMercurialGraphStream.php --- a/src/applications/repository/daemon/PhabricatorMercurialGraphStream.php +++ b/src/applications/repository/daemon/PhabricatorMercurialGraphStream.php @@ -82,13 +82,13 @@ $hglog->next(); $line = trim($line); - if (!strlen($line)) { + if (!@strlen($line)) { break; } - list($rev, $node, $date, $parents) = explode("\1", $line); + list($rev, $node, $date, $parents) = @explode("\1", $line); $rev = (int)$rev; - $date = (int)head(explode('.', $date)); + $date = (int)head(@explode('.', $date)); $this->dates[$node] = $date; $this->local[$rev] = $node; @@ -119,12 +119,12 @@ // 151:1f6c61a60586 154:1d5f799ebe1e $parents = trim($parents); - if (strlen($parents)) { + if (@strlen($parents)) { $local = array(); - $parents = explode(' ', $parents); + $parents = @explode(' ', $parents); foreach ($parents as $key => $parent) { - $parent = (int)head(explode(':', $parent)); + $parent = (int)head(@explode(':', $parent)); if ($parent == -1) { // Initial commits will sometimes have "-1" as a parent. continue; diff --git a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php --- a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php +++ b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php @@ -506,7 +506,7 @@ return PhabricatorTime::getNow() + $smart_wait; } - if (strlen($stderr)) { + if (@strlen($stderr)) { $stderr_msg = pht( 'Unexpected output while updating repository "%s": %s', $display_name, diff --git a/src/applications/repository/editor/PhabricatorRepositoryEditor.php b/src/applications/repository/editor/PhabricatorRepositoryEditor.php --- a/src/applications/repository/editor/PhabricatorRepositoryEditor.php +++ b/src/applications/repository/editor/PhabricatorRepositoryEditor.php @@ -50,7 +50,7 @@ // If the repository does not have a local path yet, assign it one based // on its ID. We can't do this earlier because we won't have an ID yet. $local_path = $object->getLocalPath(); - if (!strlen($local_path)) { + if (!@strlen($local_path)) { $local_key = 'repository.default-local-path'; $local_root = PhabricatorEnv::getEnvConfig($local_key); diff --git a/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php b/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php --- a/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php +++ b/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php @@ -259,7 +259,7 @@ $repository->getSubversionBaseURI($at_rev)); } catch (CommandException $ex) { $stderr = $ex->getStderr(); - if (preg_match('/(path|File) not found/', $stderr)) { + if (@preg_match('/(path|File) not found/', $stderr)) { // We've gone all the way back through history and this path was not // affected by earlier commits. break; @@ -442,7 +442,7 @@ // If the epoch is not present at all, treat it as though it stores the // value "0". For discussion, see T12062. This behavior is consistent // with the behavior of "git show". - if (!strlen($epoch)) { + if (!@strlen($epoch)) { $epoch = 0; } diff --git a/src/applications/repository/engine/PhabricatorRepositoryMirrorEngine.php b/src/applications/repository/engine/PhabricatorRepositoryMirrorEngine.php --- a/src/applications/repository/engine/PhabricatorRepositoryMirrorEngine.php +++ b/src/applications/repository/engine/PhabricatorRepositoryMirrorEngine.php @@ -86,7 +86,7 @@ list($stdout) = $repository->execxLocalCommand( 'for-each-ref --count 1 --'); - if (!strlen($stdout)) { + if (!@strlen($stdout)) { return; } @@ -122,7 +122,7 @@ ->setCWD($repository->getLocalPath()) ->resolvex(); } catch (CommandException $ex) { - if (preg_match('/no changes found/', $ex->getStdout())) { + if (@preg_match('/no changes found/', $ex->getStdout())) { // mercurial says nothing changed, but that's good } else { throw $ex; diff --git a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php --- a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php +++ b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php @@ -238,7 +238,7 @@ $identifier = $repository->getPHID(); $instance = PhabricatorEnv::getEnvConfig('cluster.instance'); - if (strlen($instance)) { + if (@strlen($instance)) { $identifier = "{$identifier}:{$instance}"; } @@ -559,7 +559,7 @@ // refuse to list any refs beginning with "-" just in case. foreach ($ref_rules as $ref_rule) { - if (preg_match('/^-/', $ref_rule)) { + if (@preg_match('/^-/', $ref_rule)) { throw new Exception( pht( 'Refusing to list potentially dangerous ref ("%s") beginning '. @@ -575,7 +575,7 @@ $ref_rules); // Empty repositories don't have any refs. - if (!strlen(rtrim($stdout))) { + if (!@strlen(rtrim($stdout))) { return array(); } @@ -590,7 +590,7 @@ } // If the remote ref is itself a remote ref, ignore it. - if (preg_match('(^refs/remotes/)', $name)) { + if (@preg_match('(^refs/remotes/)', $name)) { continue; } @@ -733,7 +733,7 @@ // TODO: Remove this once we're far enough in the future that deployment // of 2.1 is exceedingly rare? - if ($err == 1 && preg_match('/no changes found/', $stdout)) { + if ($err == 1 && @preg_match('/no changes found/', $stdout)) { return; } else { $message = $ex->getMessage(); diff --git a/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php b/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php --- a/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php +++ b/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php @@ -458,7 +458,7 @@ } $stdout = trim($stdout); - if (!strlen($stdout)) { + if (!@strlen($stdout)) { return array(); } return phutil_split_lines($stdout, $retain_newlines = false); @@ -492,7 +492,7 @@ } $stdout = trim($stdout); - if (!strlen($stdout)) { + if (!@strlen($stdout)) { return array(); } return phutil_split_lines($stdout, $retain_newlines = false); diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementMaintenanceWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementMaintenanceWorkflow.php --- a/src/applications/repository/management/PhabricatorRepositoryManagementMaintenanceWorkflow.php +++ b/src/applications/repository/management/PhabricatorRepositoryManagementMaintenanceWorkflow.php @@ -42,7 +42,7 @@ } $message = $args->getArg('start'); - $is_start = (bool)strlen($message); + $is_start = (bool)@strlen($message); $is_stop = $args->getArg('stop'); if (!$is_start && !$is_stop) { diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementMovePathsWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementMovePathsWorkflow.php --- a/src/applications/repository/management/PhabricatorRepositoryManagementMovePathsWorkflow.php +++ b/src/applications/repository/management/PhabricatorRepositoryManagementMovePathsWorkflow.php @@ -38,14 +38,14 @@ } $from = $args->getArg('from'); - if (!strlen($from)) { + if (!@strlen($from)) { throw new Exception( pht( 'You must specify a path prefix to move from with --from.')); } $to = $args->getArg('to'); - if (!strlen($to)) { + if (!@strlen($to)) { throw new Exception( pht( 'You must specify a path prefix to move to with --to.')); @@ -67,10 +67,10 @@ 'dst' => '', ); - if (strncmp($src, $from, strlen($from))) { + if (strncmp($src, $from, @strlen($from))) { $row['action'] = pht('Ignore'); } else { - $dst = $to.substr($src, strlen($from)); + $dst = $to.@substr($src, @strlen($from)); $row['action'] = tsprintf('**%s**', pht('Move')); $row['dst'] = $dst; diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementRebuildIdentitiesWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementRebuildIdentitiesWorkflow.php --- a/src/applications/repository/management/PhabricatorRepositoryManagementRebuildIdentitiesWorkflow.php +++ b/src/applications/repository/management/PhabricatorRepositoryManagementRebuildIdentitiesWorkflow.php @@ -220,7 +220,7 @@ $committer_name = $data->getCommitterString(); $committer_phid = $commit->getCommitterIdentityPHID(); - if (strlen($committer_name)) { + if (@strlen($committer_name)) { $committer_identity = $this->getIdentityForCommit( $commit, $committer_name); diff --git a/src/applications/repository/phid/PhabricatorRepositoryCommitPHIDType.php b/src/applications/repository/phid/PhabricatorRepositoryCommitPHIDType.php --- a/src/applications/repository/phid/PhabricatorRepositoryCommitPHIDType.php +++ b/src/applications/repository/phid/PhabricatorRepositoryCommitPHIDType.php @@ -71,7 +71,7 @@ } $summary = $commit->getSummary(); - if (strlen($summary)) { + if (@strlen($summary)) { $full_name = $name.': '.$summary; } else { $full_name = $name; @@ -98,7 +98,7 @@ public function canLoadNamedObject($name) { $pattern = self::getCommitObjectNamePattern(); - return preg_match('(^'.$pattern.'$)', $name); + return @preg_match('(^'.$pattern.'$)', $name); } public function loadNamedObjects( diff --git a/src/applications/repository/phid/PhabricatorRepositoryRepositoryPHIDType.php b/src/applications/repository/phid/PhabricatorRepositoryRepositoryPHIDType.php --- a/src/applications/repository/phid/PhabricatorRepositoryRepositoryPHIDType.php +++ b/src/applications/repository/phid/PhabricatorRepositoryRepositoryPHIDType.php @@ -54,7 +54,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^(r[A-Z]+|R[1-9]\d*)\z/', $name); + return @preg_match('/^(r[A-Z]+|R[1-9]\d*)\z/', $name); } public function loadNamedObjects( @@ -64,9 +64,9 @@ $results = array(); $id_map = array(); foreach ($names as $key => $name) { - $id = substr($name, 1); + $id = @substr($name, 1); $id_map[$id][] = $name; - $names[$key] = substr($name, 1); + $names[$key] = @substr($name, 1); } $query = id(new PhabricatorRepositoryQuery()) diff --git a/src/applications/repository/query/PhabricatorRepositoryQuery.php b/src/applications/repository/query/PhabricatorRepositoryQuery.php --- a/src/applications/repository/query/PhabricatorRepositoryQuery.php +++ b/src/applications/repository/query/PhabricatorRepositoryQuery.php @@ -67,7 +67,7 @@ continue; } - if (preg_match('/^(r[A-Z]+|R[1-9]\d*)\z/', $identifier)) { + if (@preg_match('/^(r[A-Z]+|R[1-9]\d*)\z/', $identifier)) { $monograms[$identifier] = $identifier; continue; } @@ -78,7 +78,7 @@ continue; } - if (preg_match('/^[A-Z]+\z/', $identifier)) { + if (@preg_match('/^[A-Z]+\z/', $identifier)) { $callsigns[$identifier] = $identifier; continue; } @@ -588,9 +588,9 @@ foreach ($this->monogramIdentifiers as $identifier) { if ($identifier[0] == 'r') { - $monogram_callsigns[] = substr($identifier, 1); + $monogram_callsigns[] = @substr($identifier, 1); } else { - $monogram_ids[] = substr($identifier, 1); + $monogram_ids[] = @substr($identifier, 1); } } @@ -633,11 +633,11 @@ $this->uuids); } - if (strlen($this->datasourceQuery)) { + if (@strlen($this->datasourceQuery)) { // This handles having "rP" match callsigns starting with "P...". $query = trim($this->datasourceQuery); - if (preg_match('/^r/', $query)) { - $callsign = substr($query, 1); + if (@preg_match('/^r/', $query)) { + $callsign = @substr($query, 1); } else { $callsign = $query; } diff --git a/src/applications/repository/query/PhabricatorRepositoryRefCursorQuery.php b/src/applications/repository/query/PhabricatorRepositoryRefCursorQuery.php --- a/src/applications/repository/query/PhabricatorRepositoryRefCursorQuery.php +++ b/src/applications/repository/query/PhabricatorRepositoryRefCursorQuery.php @@ -136,7 +136,7 @@ $name_hashes); } - if (strlen($this->datasourceQuery)) { + if (@strlen($this->datasourceQuery)) { $where[] = qsprintf( $conn, 'refNameRaw LIKE %>', diff --git a/src/applications/repository/response/PhabricatorVCSResponse.php b/src/applications/repository/response/PhabricatorVCSResponse.php --- a/src/applications/repository/response/PhabricatorVCSResponse.php +++ b/src/applications/repository/response/PhabricatorVCSResponse.php @@ -47,7 +47,7 @@ } $message = $this->getMessage(); - if (strlen($message)) { + if (@strlen($message)) { foreach (phutil_split_lines($message, false) as $line) { $headers[] = array( 'X-Phabricator-Message', diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php --- a/src/applications/repository/storage/PhabricatorRepository.php +++ b/src/applications/repository/storage/PhabricatorRepository.php @@ -193,7 +193,7 @@ public function getMonogram() { $callsign = $this->getCallsign(); - if (strlen($callsign)) { + if (@strlen($callsign)) { return "r{$callsign}"; } @@ -203,7 +203,7 @@ public function getDisplayName() { $slug = $this->getRepositorySlug(); - if (strlen($slug)) { + if (@strlen($slug)) { return $slug; } @@ -216,7 +216,7 @@ $monograms[] = 'R'.$this->getID(); $callsign = $this->getCallsign(); - if (strlen($callsign)) { + if (@strlen($callsign)) { $monograms[] = 'r'.$callsign; } @@ -281,7 +281,7 @@ public function getSubversionBaseURI($commit = null) { $subpath = $this->getDetail('svn-subpath'); - if (!strlen($subpath)) { + if (!@strlen($subpath)) { $subpath = null; } return $this->getSubversionPathURI($subpath, $commit); @@ -301,7 +301,7 @@ $uri = rtrim($uri, '/'); - if (strlen($path)) { + if (@strlen($path)) { $path = rawurlencode($path); $path = str_replace('%2F', '/', $path); $uri = $uri.'/'.ltrim($path, '/'); @@ -342,12 +342,12 @@ // Make some reasonable effort to produce reasonable default directory // names from repository names. - if (!strlen($name)) { + if (!@strlen($name)) { $name = $this->getName(); $name = phutil_utf8_strtolower($name); $name = preg_replace('@[ -/:->]+@', '-', $name); $name = trim($name, '-'); - if (!strlen($name)) { + if (!@strlen($name)) { $name = $this->getCallsign(); } } @@ -365,14 +365,14 @@ } public static function assertValidRepositorySlug($slug) { - if (!strlen($slug)) { + if (!@strlen($slug)) { throw new Exception( pht( 'The empty string is not a valid repository short name. '. 'Repository short names must be at least one character long.')); } - if (strlen($slug) > 64) { + if (@strlen($slug) > 64) { throw new Exception( pht( 'The name "%s" is not a valid repository short name. Repository '. @@ -380,7 +380,7 @@ $slug)); } - if (preg_match('/[^a-zA-Z0-9._-]/', $slug)) { + if (@preg_match('/[^a-zA-Z0-9._-]/', $slug)) { throw new Exception( pht( 'The name "%s" is not a valid repository short name. Repository '. @@ -389,7 +389,7 @@ $slug)); } - if (!preg_match('/^[a-zA-Z0-9]/', $slug)) { + if (!@preg_match('/^[a-zA-Z0-9]/', $slug)) { throw new Exception( pht( 'The name "%s" is not a valid repository short name. Repository '. @@ -397,7 +397,7 @@ $slug)); } - if (!preg_match('/[a-zA-Z0-9]\z/', $slug)) { + if (!@preg_match('/[a-zA-Z0-9]\z/', $slug)) { throw new Exception( pht( 'The name "%s" is not a valid repository short name. Repository '. @@ -405,7 +405,7 @@ $slug)); } - if (preg_match('/__|--|\\.\\./', $slug)) { + if (@preg_match('/__|--|\\.\\./', $slug)) { throw new Exception( pht( 'The name "%s" is not a valid repository short name. Repository '. @@ -414,7 +414,7 @@ $slug)); } - if (preg_match('/^[A-Z]+\z/', $slug)) { + if (@preg_match('/^[A-Z]+\z/', $slug)) { throw new Exception( pht( 'The name "%s" is not a valid repository short name. Repository '. @@ -422,7 +422,7 @@ $slug)); } - if (preg_match('/^\d+\z/', $slug)) { + if (@preg_match('/^\d+\z/', $slug)) { throw new Exception( pht( 'The name "%s" is not a valid repository short name. Repository '. @@ -430,7 +430,7 @@ $slug)); } - if (preg_match('/\\.git/', $slug)) { + if (@preg_match('/\\.git/', $slug)) { throw new Exception( pht( 'The name "%s" is not a valid repository short name. Repository '. @@ -441,13 +441,13 @@ } public static function assertValidCallsign($callsign) { - if (!strlen($callsign)) { + if (!@strlen($callsign)) { throw new Exception( pht( 'A repository callsign must be at least one character long.')); } - if (strlen($callsign) > 32) { + if (@strlen($callsign) > 32) { throw new Exception( pht( 'The callsign "%s" is not a valid repository callsign. Callsigns '. @@ -455,7 +455,7 @@ $callsign)); } - if (!preg_match('/^[A-Z]+\z/', $callsign)) { + if (!@preg_match('/^[A-Z]+\z/', $callsign)) { throw new Exception( pht( 'The callsign "%s" is not a valid repository callsign. Callsigns '. @@ -574,12 +574,12 @@ public function getURI() { $short_name = $this->getRepositorySlug(); - if (strlen($short_name)) { + if (@strlen($short_name)) { return "/source/{$short_name}/"; } $callsign = $this->getCallsign(); - if (strlen($callsign)) { + if (@strlen($callsign)) { return "/diffusion/{$callsign}/"; } @@ -593,7 +593,7 @@ public function getCommitURI($identifier) { $callsign = $this->getCallsign(); - if (strlen($callsign)) { + if (@strlen($callsign)) { return "/r{$callsign}{$identifier}"; } @@ -614,7 +614,7 @@ $identifier = null; foreach ($patterns as $pattern) { $matches = null; - if (!preg_match($pattern, $request_path, $matches)) { + if (!@preg_match($pattern, $request_path, $matches)) { continue; } @@ -648,7 +648,7 @@ '\z)'; $matches = null; - if (preg_match($standard_pattern, $request_path, $matches)) { + if (@preg_match($standard_pattern, $request_path, $matches)) { $suffix = $matches['suffix']; return $this->getPathURI($suffix); } @@ -667,7 +667,7 @@ '\z)'; $matches = null; - if (preg_match($commit_pattern, $request_path, $matches)) { + if (@preg_match($commit_pattern, $request_path, $matches)) { $commit = $matches['commit']; return $this->getCommitURI($commit); } @@ -718,14 +718,14 @@ $head = idx($params, 'head'); $against = idx($params, 'against'); - if ($req_commit && !strlen($commit)) { + if ($req_commit && !@strlen($commit)) { throw new Exception( pht( 'Diffusion URI action "%s" requires commit!', $action)); } - if ($req_branch && !strlen($branch)) { + if ($req_branch && !@strlen($branch)) { throw new Exception( pht( 'Diffusion URI action "%s" requires branch!', @@ -736,25 +736,25 @@ return $this->getCommitURI($commit); } - if (strlen($path)) { + if (@strlen($path)) { $path = ltrim($path, '/'); $path = str_replace(array(';', '$'), array(';;', '$$'), $path); $path = phutil_escape_uri($path); } $raw_branch = $branch; - if (strlen($branch)) { + if (@strlen($branch)) { $branch = phutil_escape_uri_path_component($branch); $path = "{$branch}/{$path}"; } $raw_commit = $commit; - if (strlen($commit)) { + if (@strlen($commit)) { $commit = str_replace('$', '$$', $commit); $commit = ';'.phutil_escape_uri($commit); } - if (strlen($line)) { + if (@strlen($line)) { $line = '$'.phutil_escape_uri($line); } @@ -775,20 +775,20 @@ break; case 'compare': $uri = $this->getPathURI("/{$action}/"); - if (strlen($head)) { + if (@strlen($head)) { $query['head'] = $head; - } else if (strlen($raw_commit)) { + } else if (@strlen($raw_commit)) { $query['commit'] = $raw_commit; - } else if (strlen($raw_branch)) { + } else if (@strlen($raw_branch)) { $query['head'] = $raw_branch; } - if (strlen($against)) { + if (@strlen($against)) { $query['against'] = $against; } break; case 'branch': - if (strlen($path)) { + if (@strlen($path)) { $uri = $this->getPathURI("/repository/{$path}"); } else { $uri = $this->getPathURI('/'); @@ -862,7 +862,7 @@ public function getDefaultBranch() { $default = $this->getDetail('default-branch'); - if (strlen($default)) { + if (@strlen($default)) { return $default; } @@ -909,7 +909,7 @@ foreach ($filter as $pattern => $ignored) { $regexp = self::extractBranchRegexp($pattern); if ($regexp !== null) { - if (preg_match($regexp, $branch)) { + if (@preg_match($regexp, $branch)) { return true; } } @@ -921,7 +921,7 @@ public static function extractBranchRegexp($pattern) { $matches = null; - if (preg_match('/^regexp\\((.*)\\)\z/', $pattern, $matches)) { + if (@preg_match('/^regexp\\((.*)\\)\z/', $pattern, $matches)) { return $matches[1]; } return null; @@ -930,7 +930,7 @@ public function shouldTrackRef(DiffusionRepositoryRef $ref) { // At least for now, don't track the staging area tags. if ($ref->isTag()) { - if (preg_match('(^phabricator/)', $ref->getShortName())) { + if (@preg_match('(^phabricator/)', $ref->getShortName())) { return false; } } @@ -959,7 +959,7 @@ $is_git = ($vcs == $type_git); $is_hg = ($vcs == $type_hg); if ($is_git || $is_hg) { - $name = substr($commit_identifier, 0, 12); + $name = @substr($commit_identifier, 0, 12); $need_scope = false; } else { $name = $commit_identifier; @@ -1156,7 +1156,7 @@ */ public function getRemoteURIObject() { $raw_uri = $this->getDetail('remote-uri'); - if (!strlen($raw_uri)) { + if (!@strlen($raw_uri)) { return new PhutilURI(''); } @@ -1186,7 +1186,7 @@ // If the trailing "@" is not required to escape the URI, strip it for // readability. - if (!preg_match('/@.*@/', $path)) { + if (!@preg_match('/@.*@/', $path)) { $path = rtrim($path, '@'); } @@ -1645,7 +1645,7 @@ // for discussion. This is usually a user adding "ssh://" to an implicit // SSH Git URI. if ($protocol == 'ssh') { - if (preg_match('(^[^:@]+://[^/:]+:[^\d])', $uri)) { + if (@preg_match('(^[^:@]+://[^/:]+:[^\d])', $uri)) { throw new Exception( pht( "The remote URI is not formatted correctly. Remote URIs ". @@ -2299,14 +2299,14 @@ ); foreach ($git_env as $key) { $value = getenv($key); - if (strlen($value)) { + if (@strlen($value)) { $env[$key] = $value; } } $key = 'GIT_PUSH_OPTION_COUNT'; $git_count = getenv($key); - if (strlen($git_count)) { + if (@strlen($git_count)) { $git_count = (int)$git_count; $env[$key] = $git_count; for ($ii = 0; $ii < $git_count; $ii++) { @@ -2322,7 +2322,7 @@ // need to be preserved to allow `git` operations to work properly when // running from commit hooks. if ($this->isGit()) { - if (preg_match('/^GIT_/', $key)) { + if (@preg_match('/^GIT_/', $key)) { $result[$key] = $value; } } @@ -2477,7 +2477,7 @@ $has_https = false; } - $has_ssh = (bool)strlen(PhabricatorEnv::getEnvConfig('phd.user')); + $has_ssh = (bool)@strlen(PhabricatorEnv::getEnvConfig('phd.user')); $protocol_map = array( PhabricatorRepositoryURI::BUILTIN_PROTOCOL_SSH => $has_ssh, @@ -2815,7 +2815,7 @@ $permanent_rules = $this->getStringListForConduit($permanent_rules); $default_branch = $this->getDefaultBranch(); - if (!strlen($default_branch)) { + if (!@strlen($default_branch)) { $default_branch = null; } @@ -2846,7 +2846,7 @@ foreach ($list as $key => $value) { $value = (string)$value; - if (!strlen($value)) { + if (!@strlen($value)) { unset($list[$key]); } } diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php --- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php +++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php @@ -478,7 +478,7 @@ } $author = $this->getRawAuthorStringForDisplay(); - if (strlen($author)) { + if (@strlen($author)) { return DiffusionView::renderName($author); } @@ -493,7 +493,7 @@ } $committer = $this->getRawCommitterStringForDisplay(); - if (strlen($committer)) { + if (@strlen($committer)) { return DiffusionView::renderName($committer); } diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommitData.php b/src/applications/repository/storage/PhabricatorRepositoryCommitData.php --- a/src/applications/repository/storage/PhabricatorRepositoryCommitData.php +++ b/src/applications/repository/storage/PhabricatorRepositoryCommitData.php @@ -97,12 +97,12 @@ $ref = $this->getCommitRef(); $author = $ref->getAuthor(); - if (strlen($author)) { + if (@strlen($author)) { return $author; } $author = phutil_string_cast($this->authorName); - if (strlen($author)) { + if (@strlen($author)) { return $author; } @@ -131,7 +131,7 @@ $ref = $this->getCommitRef(); $committer = $ref->getCommitter(); - if (strlen($committer)) { + if (@strlen($committer)) { return $committer; } @@ -150,7 +150,7 @@ $string = $this->getCommitDetail($key); $string = phutil_string_cast($string); - if (strlen($string)) { + if (@strlen($string)) { return $string; } diff --git a/src/applications/repository/storage/PhabricatorRepositoryIdentity.php b/src/applications/repository/storage/PhabricatorRepositoryIdentity.php --- a/src/applications/repository/storage/PhabricatorRepositoryIdentity.php +++ b/src/applications/repository/storage/PhabricatorRepositoryIdentity.php @@ -121,7 +121,7 @@ $byte_limit = $this->getColumnMaximumByteLength('emailAddress'); $email_address = phutil_utf8ize($email_address); - if (strlen($email_address) > $byte_limit) { + if (@strlen($email_address) > $byte_limit) { $email_address = null; } diff --git a/src/applications/repository/storage/PhabricatorRepositoryPushLog.php b/src/applications/repository/storage/PhabricatorRepositoryPushLog.php --- a/src/applications/repository/storage/PhabricatorRepositoryPushLog.php +++ b/src/applications/repository/storage/PhabricatorRepositoryPushLog.php @@ -175,14 +175,14 @@ if ($this->getRepository()->isSVN()) { return $this->getRefOld(); } - return substr($this->getRefOld(), 0, 12); + return @substr($this->getRefOld(), 0, 12); } public function getRefNewShort() { if ($this->getRepository()->isSVN()) { return $this->getRefNew(); } - return substr($this->getRefNew(), 0, 12); + return @substr($this->getRefNew(), 0, 12); } public function hasChangeFlags($mask) { diff --git a/src/applications/repository/storage/PhabricatorRepositoryURI.php b/src/applications/repository/storage/PhabricatorRepositoryURI.php --- a/src/applications/repository/storage/PhabricatorRepositoryURI.php +++ b/src/applications/repository/storage/PhabricatorRepositoryURI.php @@ -754,7 +754,7 @@ // without requiring an index rebuild. $ssh_host = PhabricatorEnv::getEnvConfig('diffusion.ssh-host'); - if (strlen($ssh_host)) { + if (@strlen($ssh_host)) { $domain_map[''] = $ssh_host; } diff --git a/src/applications/repository/storage/PhabricatorRepositoryURIIndex.php b/src/applications/repository/storage/PhabricatorRepositoryURIIndex.php --- a/src/applications/repository/storage/PhabricatorRepositoryURIIndex.php +++ b/src/applications/repository/storage/PhabricatorRepositoryURIIndex.php @@ -32,7 +32,7 @@ $sql = array(); foreach ($uris as $key => $uri) { - if (!strlen($uri)) { + if (!@strlen($uri)) { unset($uris[$key]); continue; } diff --git a/src/applications/repository/storage/__tests__/PhabricatorRepositoryCommitTestCase.php b/src/applications/repository/storage/__tests__/PhabricatorRepositoryCommitTestCase.php --- a/src/applications/repository/storage/__tests__/PhabricatorRepositoryCommitTestCase.php +++ b/src/applications/repository/storage/__tests__/PhabricatorRepositoryCommitTestCase.php @@ -30,7 +30,7 @@ foreach ($map as $input => $expect) { $actual = PhabricatorRepositoryCommitData::summarizeCommitMessage( $input); - $this->assertEqual($expect, strlen($actual)); + $this->assertEqual($expect, @strlen($actual)); } } diff --git a/src/applications/repository/worker/PhabricatorRepositoryPushMailWorker.php b/src/applications/repository/worker/PhabricatorRepositoryPushMailWorker.php --- a/src/applications/repository/worker/PhabricatorRepositoryPushMailWorker.php +++ b/src/applications/repository/worker/PhabricatorRepositoryPushMailWorker.php @@ -216,7 +216,7 @@ } $summary = null; - if (strlen(idx($commit_info, 'summary'))) { + if (@strlen(idx($commit_info, 'summary'))) { $summary = ' '.$commit_info['summary']; } diff --git a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryGitCommitChangeParserWorker.php b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryGitCommitChangeParserWorker.php --- a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryGitCommitChangeParserWorker.php +++ b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryGitCommitChangeParserWorker.php @@ -23,9 +23,9 @@ $changes = array(); $move_away = array(); $copy_away = array(); - $lines = explode("\n", $raw); + $lines = @explode("\n", $raw); foreach ($lines as $line) { - if (!strlen(trim($line))) { + if (!@strlen(trim($line))) { continue; } list($old_mode, $new_mode, @@ -34,7 +34,7 @@ // We may only have two pieces here. list($action, $src_path, $dst_path) = array_merge( - explode("\t", $more_stuff), + @explode("\t", $more_stuff), array(null)); // Normalize the paths for consistency with the SVN workflow. diff --git a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php --- a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php +++ b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php @@ -87,7 +87,7 @@ $parents = $this->expandAllParentPaths($path, $include_self = true); foreach ($parents as $parent) { if (isset($add_paths[$parent])) { - $relative_path = substr($path, strlen($parent)); + $relative_path = @substr($path, @strlen($parent)); $lookup_here[$path] = array( 'rawPath' => $add_paths[$parent]['rawTargetPath'].$relative_path, 'rawCommit' => $add_paths[$parent]['rawTargetCommit'], @@ -180,7 +180,7 @@ case 'A': $copy_from = $raw_info['rawTargetPath']; $copy_rev = $raw_info['rawTargetCommit']; - if (!strlen($copy_from)) { + if (!@strlen($copy_from)) { $type = DifferentialChangeType::TYPE_ADD; } else { if (isset($deleted_paths[$copy_from])) { @@ -575,7 +575,7 @@ $parent, $lookup['rawCommit']); - $parent = escapeshellarg($parent); + $parent = @escapeshellarg($parent); $parents[$parent] = true; $path_mapping[$parent][] = dirname($path); } @@ -602,7 +602,7 @@ if ($list_path == $repository_uri) { $base = '/'; } else { - $base = substr($list_path, strlen($repository_uri)); + $base = @substr($list_path, @strlen($repository_uri)); } $mapping = array_pop($path_mapping); @@ -687,7 +687,7 @@ '(.*?)'. '((.*?))?@'; $matches = null; - if (!preg_match($pattern, $entry, $matches)) { + if (!@preg_match($pattern, $entry, $matches)) { throw new Exception(pht('Unable to parse entry!')); } $map[html_entity_decode($matches[2])] = @@ -715,7 +715,7 @@ break; case 'xml': $expect = '//'; - if (!preg_match($expect, $line)) { + if (!@preg_match($expect, $line)) { throw new Exception( pht( "Expected '%s', got %s.", @@ -747,7 +747,7 @@ $mode = 'list2'; break; case 'list2': - if (!preg_match('/^\s+path="/', $line)) { + if (!@preg_match('/^\s+path="/', $line)) { throw new Exception( pht( "Expected '%s', got %s.", @@ -781,7 +781,7 @@ if ($include_self) { $parents[] = '/'.rtrim($path, '/'); } - $parts = explode('/', trim($path, '/')); + $parts = @explode('/', trim($path, '/')); while (count($parts) >= 1) { array_pop($parts); $parents[] = '/'.implode('/', $parts); diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php --- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php @@ -36,7 +36,7 @@ $author = $ref->getAuthor(); $committer = $ref->getCommitter(); - $has_committer = (bool)strlen($committer); + $has_committer = (bool)@strlen($committer); $identity_engine = id(new DiffusionRepositoryIdentityEngine()) ->setViewer($viewer) diff --git a/src/applications/repository/xaction/PhabricatorRepositoryCallsignTransaction.php b/src/applications/repository/xaction/PhabricatorRepositoryCallsignTransaction.php --- a/src/applications/repository/xaction/PhabricatorRepositoryCallsignTransaction.php +++ b/src/applications/repository/xaction/PhabricatorRepositoryCallsignTransaction.php @@ -10,7 +10,7 @@ } public function generateNewValue($object, $value) { - if (strlen($value)) { + if (@strlen($value)) { return $value; } @@ -25,12 +25,12 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s set the callsign for this repository to %s.', $this->renderAuthor(), $this->renderNewValue()); - } else if (!strlen($new)) { + } else if (!@strlen($new)) { return pht( '%s removed the callsign (%s) for this repository.', $this->renderAuthor(), @@ -51,7 +51,7 @@ $old = $xaction->getOldValue(); $new = $xaction->getNewValue(); - if (!strlen($new)) { + if (!@strlen($new)) { continue; } diff --git a/src/applications/repository/xaction/PhabricatorRepositoryCopyTimeLimitTransaction.php b/src/applications/repository/xaction/PhabricatorRepositoryCopyTimeLimitTransaction.php --- a/src/applications/repository/xaction/PhabricatorRepositoryCopyTimeLimitTransaction.php +++ b/src/applications/repository/xaction/PhabricatorRepositoryCopyTimeLimitTransaction.php @@ -10,7 +10,7 @@ } public function generateNewValue($object, $value) { - if (!strlen($value)) { + if (!@strlen($value)) { return null; } @@ -57,11 +57,11 @@ foreach ($xactions as $xaction) { $new = $xaction->getNewValue(); - if (!strlen($new)) { + if (!@strlen($new)) { continue; } - if (!preg_match('/^\d+\z/', $new)) { + if (!@preg_match('/^\d+\z/', $new)) { $errors[] = $this->newInvalidError( pht( 'Unable to parse copy time limit, specify a positive number '. diff --git a/src/applications/repository/xaction/PhabricatorRepositoryDefaultBranchTransaction.php b/src/applications/repository/xaction/PhabricatorRepositoryDefaultBranchTransaction.php --- a/src/applications/repository/xaction/PhabricatorRepositoryDefaultBranchTransaction.php +++ b/src/applications/repository/xaction/PhabricatorRepositoryDefaultBranchTransaction.php @@ -17,12 +17,12 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (!strlen($new)) { + if (!@strlen($new)) { return pht( '%s removed %s as the default branch.', $this->renderAuthor(), $this->renderOldValue()); - } else if (!strlen($old)) { + } else if (!@strlen($old)) { return pht( '%s set the default branch to %s.', $this->renderAuthor(), diff --git a/src/applications/repository/xaction/PhabricatorRepositoryEncodingTransaction.php b/src/applications/repository/xaction/PhabricatorRepositoryEncodingTransaction.php --- a/src/applications/repository/xaction/PhabricatorRepositoryEncodingTransaction.php +++ b/src/applications/repository/xaction/PhabricatorRepositoryEncodingTransaction.php @@ -17,12 +17,12 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (strlen($old) && !strlen($new)) { + if (@strlen($old) && !@strlen($new)) { return pht( '%s removed the %s encoding configured for this repository.', $this->renderAuthor(), $this->renderOldValue()); - } else if (strlen($new) && !strlen($old)) { + } else if (@strlen($new) && !@strlen($old)) { return pht( '%s set the encoding for this repository to %s.', $this->renderAuthor(), @@ -46,7 +46,7 @@ // UTF-8 to the target encoding, because mbstring is fine with // converting from a nonsense encoding. $encoding = $xaction->getNewValue(); - if (!strlen($encoding)) { + if (!@strlen($encoding)) { continue; } diff --git a/src/applications/repository/xaction/PhabricatorRepositoryFetchRefsTransaction.php b/src/applications/repository/xaction/PhabricatorRepositoryFetchRefsTransaction.php --- a/src/applications/repository/xaction/PhabricatorRepositoryFetchRefsTransaction.php +++ b/src/applications/repository/xaction/PhabricatorRepositoryFetchRefsTransaction.php @@ -61,7 +61,7 @@ continue; } - if (!strlen($rule)) { + if (!@strlen($rule)) { $errors[] = $this->newInvalidError( pht( 'Fetch rule (at index "%s") is empty. Fetch rules must '. @@ -74,7 +74,7 @@ // Since we fetch ref "X" as "+X:X", don't allow rules to include // colons. This is specific to Git and may not be relevant if // Mercurial repositories eventually get fetch rules. - if (preg_match('/:/', $rule)) { + if (@preg_match('/:/', $rule)) { $errors[] = $this->newInvalidError( pht( 'Fetch rule ("%s", at index "%s") is invalid: fetch rules '. diff --git a/src/applications/repository/xaction/PhabricatorRepositoryFilesizeLimitTransaction.php b/src/applications/repository/xaction/PhabricatorRepositoryFilesizeLimitTransaction.php --- a/src/applications/repository/xaction/PhabricatorRepositoryFilesizeLimitTransaction.php +++ b/src/applications/repository/xaction/PhabricatorRepositoryFilesizeLimitTransaction.php @@ -10,7 +10,7 @@ } public function generateNewValue($object, $value) { - if (!strlen($value)) { + if (!@strlen($value)) { return null; } @@ -56,7 +56,7 @@ foreach ($xactions as $xaction) { $new = $xaction->getNewValue(); - if (!strlen($new)) { + if (!@strlen($new)) { continue; } diff --git a/src/applications/repository/xaction/PhabricatorRepositoryIdentityAssignTransaction.php b/src/applications/repository/xaction/PhabricatorRepositoryIdentityAssignTransaction.php --- a/src/applications/repository/xaction/PhabricatorRepositoryIdentityAssignTransaction.php +++ b/src/applications/repository/xaction/PhabricatorRepositoryIdentityAssignTransaction.php @@ -52,7 +52,7 @@ foreach ($xactions as $xaction) { $old = $xaction->getOldValue(); $new = $xaction->getNewValue(); - if (!strlen($new)) { + if (!@strlen($new)) { continue; } diff --git a/src/applications/repository/xaction/PhabricatorRepositoryMaintenanceTransaction.php b/src/applications/repository/xaction/PhabricatorRepositoryMaintenanceTransaction.php --- a/src/applications/repository/xaction/PhabricatorRepositoryMaintenanceTransaction.php +++ b/src/applications/repository/xaction/PhabricatorRepositoryMaintenanceTransaction.php @@ -25,11 +25,11 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (strlen($old) && !strlen($new)) { + if (@strlen($old) && !@strlen($new)) { return pht( '%s took this repository out of maintenance mode.', $this->renderAuthor()); - } else if (!strlen($old) && strlen($new)) { + } else if (!@strlen($old) && @strlen($new)) { return pht( '%s put this repository into maintenance mode.', $this->renderAuthor()); diff --git a/src/applications/repository/xaction/PhabricatorRepositorySVNSubpathTransaction.php b/src/applications/repository/xaction/PhabricatorRepositorySVNSubpathTransaction.php --- a/src/applications/repository/xaction/PhabricatorRepositorySVNSubpathTransaction.php +++ b/src/applications/repository/xaction/PhabricatorRepositorySVNSubpathTransaction.php @@ -17,12 +17,12 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (!strlen($new)) { + if (!@strlen($new)) { return pht( '%s removed %s as the "Import Only" path.', $this->renderAuthor(), $this->renderOldValue()); - } else if (!strlen($old)) { + } else if (!@strlen($old)) { return pht( '%s set the repository "Import Only" path to %s.', $this->renderAuthor(), diff --git a/src/applications/repository/xaction/PhabricatorRepositoryServiceTransaction.php b/src/applications/repository/xaction/PhabricatorRepositoryServiceTransaction.php --- a/src/applications/repository/xaction/PhabricatorRepositoryServiceTransaction.php +++ b/src/applications/repository/xaction/PhabricatorRepositoryServiceTransaction.php @@ -10,7 +10,7 @@ } public function generateNewValue($object, $value) { - if (strlen($value)) { + if (@strlen($value)) { return $value; } @@ -25,12 +25,12 @@ $old = $this->getOldValue(); $new = $this->getOldValue(); - if (strlen($old) && !strlen($new)) { + if (@strlen($old) && !@strlen($new)) { return pht( '%s moved storage for this repository from %s to local.', $this->renderAuthor(), $this->renderOldHandle()); - } else if (!strlen($old) && strlen($new)) { + } else if (!@strlen($old) && @strlen($new)) { // TODO: Possibly, we should distinguish between automatic assignment // on creation vs explicit adjustment. return pht( diff --git a/src/applications/repository/xaction/PhabricatorRepositorySlugTransaction.php b/src/applications/repository/xaction/PhabricatorRepositorySlugTransaction.php --- a/src/applications/repository/xaction/PhabricatorRepositorySlugTransaction.php +++ b/src/applications/repository/xaction/PhabricatorRepositorySlugTransaction.php @@ -10,7 +10,7 @@ } public function generateNewValue($object, $value) { - if (strlen($value)) { + if (@strlen($value)) { return $value; } @@ -25,11 +25,11 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (strlen($old) && !strlen($new)) { + if (@strlen($old) && !@strlen($new)) { return pht( '%s removed the short name of this repository.', $this->renderAuthor()); - } else if (strlen($new) && !strlen($old)) { + } else if (@strlen($new) && !@strlen($old)) { return pht( '%s set the short name of this repository to %s.', $this->renderAuthor(), @@ -50,7 +50,7 @@ $old = $xaction->getOldValue(); $new = $xaction->getNewValue(); - if (!strlen($new)) { + if (!@strlen($new)) { continue; } diff --git a/src/applications/repository/xaction/PhabricatorRepositoryStagingURITransaction.php b/src/applications/repository/xaction/PhabricatorRepositoryStagingURITransaction.php --- a/src/applications/repository/xaction/PhabricatorRepositoryStagingURITransaction.php +++ b/src/applications/repository/xaction/PhabricatorRepositoryStagingURITransaction.php @@ -17,12 +17,12 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s set %s as the staging area for this repository.', $this->renderAuthor(), $this->renderNewValue()); - } else if (!strlen($new)) { + } else if (!@strlen($new)) { return pht( '%s removed %s as the staging area for this repository.', $this->renderAuthor(), @@ -44,7 +44,7 @@ foreach ($xactions as $xaction) { $new = $xaction->getNewValue(); - if (!strlen($new)) { + if (!@strlen($new)) { continue; } diff --git a/src/applications/repository/xaction/PhabricatorRepositoryTouchLimitTransaction.php b/src/applications/repository/xaction/PhabricatorRepositoryTouchLimitTransaction.php --- a/src/applications/repository/xaction/PhabricatorRepositoryTouchLimitTransaction.php +++ b/src/applications/repository/xaction/PhabricatorRepositoryTouchLimitTransaction.php @@ -10,7 +10,7 @@ } public function generateNewValue($object, $value) { - if (!strlen($value)) { + if (!@strlen($value)) { return null; } @@ -56,11 +56,11 @@ foreach ($xactions as $xaction) { $new = $xaction->getNewValue(); - if (!strlen($new)) { + if (!@strlen($new)) { continue; } - if (!preg_match('/^\d+\z/', $new)) { + if (!@preg_match('/^\d+\z/', $new)) { $errors[] = $this->newInvalidError( pht( 'Unable to parse touch limit, specify a positive number of '. diff --git a/src/applications/repository/xaction/PhabricatorRepositoryTransactionType.php b/src/applications/repository/xaction/PhabricatorRepositoryTransactionType.php --- a/src/applications/repository/xaction/PhabricatorRepositoryTransactionType.php +++ b/src/applications/repository/xaction/PhabricatorRepositoryTransactionType.php @@ -11,7 +11,7 @@ // Check for invalid regular expressions. $regexp = PhabricatorRepository::extractBranchRegexp($pattern); if ($regexp !== null) { - $ok = @preg_match($regexp, ''); + $ok = @@preg_match($regexp, ''); if ($ok === false) { $errors[] = $this->newInvalidError( pht( @@ -26,7 +26,7 @@ // Check for formatting mistakes like `regex(...)` instead of // `regexp(...)`. $matches = null; - if (preg_match('/^([^(]+)\\(.*\\)\z/', $pattern, $matches)) { + if (@preg_match('/^([^(]+)\\(.*\\)\z/', $pattern, $matches)) { switch ($matches[1]) { case 'regexp': break; diff --git a/src/applications/search/compiler/PhutilSearchQueryCompiler.php b/src/applications/search/compiler/PhutilSearchQueryCompiler.php --- a/src/applications/search/compiler/PhutilSearchQueryCompiler.php +++ b/src/applications/search/compiler/PhutilSearchQueryCompiler.php @@ -104,7 +104,7 @@ private function tokenizeQuery($query) { $maximum_bytes = 1024; - $query_bytes = strlen($query); + $query_bytes = @strlen($query); if ($query_bytes > $maximum_bytes) { throw new PhutilSearchQueryCompilerSyntaxException( pht( @@ -135,7 +135,7 @@ $character = $query[$ii]; if ($mode == 'scan') { - if (preg_match('/^\s\z/u', $character)) { + if (@preg_match('/^\s\z/u', $character)) { continue; } @@ -148,7 +148,7 @@ if ($enable_functions) { $found = false; for ($jj = $ii; $jj < $length; $jj++) { - if (preg_match('/^[a-zA-Z-]\z/u', $query[$jj])) { + if (@preg_match('/^[a-zA-Z-]\z/u', $query[$jj])) { continue; } if ($query[$jj] == ':') { @@ -161,7 +161,7 @@ $function = array_slice($query, $ii, ($jj - $ii)); $current_function = implode('', $function); - if (!strlen($current_function)) { + if (!@strlen($current_function)) { $current_function = null; } @@ -173,12 +173,12 @@ if ($mode == 'operator') { if (!$current_operator) { - if (preg_match('/^\s\z/u', $character)) { + if (@preg_match('/^\s\z/u', $character)) { continue; } } - if (preg_match('/^'.$operator_characters.'\z/', $character)) { + if (@preg_match('/^'.$operator_characters.'\z/', $character)) { $current_operator[] = $character; continue; } @@ -187,7 +187,7 @@ } if ($mode == 'quote') { - if (preg_match('/^"\z/', $character)) { + if (@preg_match('/^"\z/', $character)) { $is_quoted = true; $mode = 'token'; continue; @@ -200,18 +200,18 @@ $capture = false; $was_quoted = $is_quoted; if ($is_quoted) { - if (preg_match('/^"\z/', $character)) { + if (@preg_match('/^"\z/', $character)) { $capture = true; $mode = 'scan'; $is_quoted = false; } } else { - if (preg_match('/^\s\z/u', $character)) { + if (@preg_match('/^\s\z/u', $character)) { $capture = true; $mode = 'scan'; } - if (preg_match('/^"\z/', $character)) { + if (@preg_match('/^"\z/', $character)) { $capture = true; $mode = 'token'; $is_quoted = true; @@ -293,7 +293,7 @@ // search mode is normally useless. if (phutil_utf8_is_cjk($value)) { $use_substring = true; - } else if (phutil_preg_match('/^_/', $value)) { + } else if (phutilpreg_match('/^_/', $value)) { // See T13632. Assume users searching for any term that begins // with an undescore intend to perform substring search if they // don't provide an explicit search function. @@ -314,7 +314,7 @@ $operator_string)); } - if (!strlen($value)) { + if (!@strlen($value)) { $require_value = $is_quoted; switch ($operator) { diff --git a/src/applications/search/compiler/PhutilSearchStemmer.php b/src/applications/search/compiler/PhutilSearchStemmer.php --- a/src/applications/search/compiler/PhutilSearchStemmer.php +++ b/src/applications/search/compiler/PhutilSearchStemmer.php @@ -16,7 +16,7 @@ foreach ($tokens as $key => $token) { $token = trim($token, '._'); - if (strlen($token) < 3) { + if (@strlen($token) < 3) { continue; } @@ -46,7 +46,7 @@ // If the token has internal punctuation, handle it literally. This // deals with things like domain names, Conduit API methods, and other // sorts of informal tokens. - if (preg_match('/[._]/', $normalized_token)) { + if (@preg_match('/[._]/', $normalized_token)) { return $normalized_token; } @@ -64,7 +64,7 @@ // If the stem is too short, it won't be a candidate for indexing. These // tokens are also likely to be acronyms (like "DNS") rather than real // English words. - if (strlen($stem) < 3) { + if (@strlen($stem) < 3) { return $normalized_token; } diff --git a/src/applications/search/controller/PhabricatorApplicationSearchController.php b/src/applications/search/controller/PhabricatorApplicationSearchController.php --- a/src/applications/search/controller/PhabricatorApplicationSearchController.php +++ b/src/applications/search/controller/PhabricatorApplicationSearchController.php @@ -115,7 +115,7 @@ if ($this->queryKey == 'advanced') { $run_query = false; $query_key = $request->getStr('query'); - } else if (!strlen($this->queryKey)) { + } else if (!@strlen($this->queryKey)) { $found_query_data = false; if ($request->isHTTPGet() || $request->isQuicksand()) { @@ -775,7 +775,7 @@ $force_nux) { // Don't render NUX if the user has clicked away from the default page. - if (strlen($this->getQueryKey())) { + if (@strlen($this->getQueryKey())) { return null; } @@ -1022,7 +1022,7 @@ $object_name = pht('%s %s', $object->getMonogram(), $object->getName()); // Likewise, the context object can only be a dashboard. - if (strlen($context_phid)) { + if (@strlen($context_phid)) { $context = id(new PhabricatorDashboardQuery()) ->setViewer($viewer) ->withPHIDs(array($context_phid)) diff --git a/src/applications/search/controller/PhabricatorSearchController.php b/src/applications/search/controller/PhabricatorSearchController.php --- a/src/applications/search/controller/PhabricatorSearchController.php +++ b/src/applications/search/controller/PhabricatorSearchController.php @@ -13,7 +13,7 @@ $viewer = $this->getViewer(); $query = $request->getStr('query'); - if ($request->getStr('jump') != 'no' && strlen($query)) { + if ($request->getStr('jump') != 'no' && @strlen($query)) { $jump_uri = id(new PhabricatorDatasourceEngine()) ->setViewer($viewer) ->newJumpURI($query); @@ -31,7 +31,7 @@ if ($request->getBool('search:primary')) { // If there's no query, just take the user to advanced search. - if (!strlen($query)) { + if (!@strlen($query)) { $advanced_uri = '/search/query/advanced/'; return id(new AphrontRedirectResponse())->setURI($advanced_uri); } diff --git a/src/applications/search/controller/PhabricatorSearchEditController.php b/src/applications/search/controller/PhabricatorSearchEditController.php --- a/src/applications/search/controller/PhabricatorSearchEditController.php +++ b/src/applications/search/controller/PhabricatorSearchEditController.php @@ -73,7 +73,7 @@ } $named_query->setQueryName($request->getStr('name')); - if (!strlen($named_query->getQueryName())) { + if (!@strlen($named_query->getQueryName())) { $e_name = pht('Required'); $errors[] = pht('You must name the query.'); } else { diff --git a/src/applications/search/controller/PhabricatorSearchRelationshipController.php b/src/applications/search/controller/PhabricatorSearchRelationshipController.php --- a/src/applications/search/controller/PhabricatorSearchRelationshipController.php +++ b/src/applications/search/controller/PhabricatorSearchRelationshipController.php @@ -42,7 +42,7 @@ $maximum = $relationship->getMaximumSelectionSize(); if ($request->isFormPost()) { - $phids = explode(';', $request->getStr('phids')); + $phids = @explode(';', $request->getStr('phids')); $phids = array_filter($phids); $phids = array_values($phids); diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php --- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php +++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php @@ -179,7 +179,7 @@ $order = $saved->getParameter('order'); $builtin = $query->getBuiltinOrderAliasMap(); - if (strlen($order) && isset($builtin[$order])) { + if (@strlen($order) && isset($builtin[$order])) { $query->setOrder($order); } else { // If the order is invalid or not available, we choose the first @@ -872,7 +872,7 @@ protected function readBoolFromRequest( AphrontRequest $request, $key) { - if (!strlen($request->getStr($key))) { + if (!@strlen($request->getStr($key))) { return null; } return $request->getBool($key); @@ -895,7 +895,7 @@ * @task dates */ protected function parseDateTime($date_time) { - if (!strlen($date_time)) { + if (!@strlen($date_time)) { return null; } @@ -916,7 +916,7 @@ $start_str = $saved_query->getParameter($start_key); $start = null; - if (strlen($start_str)) { + if (@strlen($start_str)) { $start = $this->parseDateTime($start_str); if (!$start) { $this->addError( @@ -929,7 +929,7 @@ $end_str = $saved_query->getParameter($end_key); $end = null; - if (strlen($end_str)) { + if (@strlen($end_str)) { $end = $this->parseDateTime($end_str); if (!$end) { $this->addError( @@ -1137,7 +1137,7 @@ $viewer = $this->requireViewer(); $query_key = $request->getValue('queryKey'); - if (!strlen($query_key)) { + if (!@strlen($query_key)) { $saved_query = new PhabricatorSavedQuery(); } else if ($this->isBuiltinQuery($query_key)) { $saved_query = $this->buildSavedQueryFromBuiltin($query_key); diff --git a/src/applications/search/engine/PhabricatorProfileMenuEngine.php b/src/applications/search/engine/PhabricatorProfileMenuEngine.php --- a/src/applications/search/engine/PhabricatorProfileMenuEngine.php +++ b/src/applications/search/engine/PhabricatorProfileMenuEngine.php @@ -135,7 +135,7 @@ if ($is_view) { $selected_item = $this->selectViewItem($view_list, $item_id); } else { - if (!strlen($item_id)) { + if (!@strlen($item_id)) { $item_id = self::ITEM_MANAGE; } $selected_item = $this->selectEditItem($view_list, $item_id); @@ -730,7 +730,7 @@ $name = $item->getDisplayName(); $type = $item->getMenuItemTypeName(); - if (!strlen(trim($name))) { + if (!@strlen(trim($name))) { $name = pht('Untitled "%s" Item', $type); } @@ -1308,7 +1308,7 @@ // render the default view instead. $selected_view = null; - if (strlen($item_id)) { + if (@strlen($item_id)) { $item_views = $view_list->getViewsWithItemIdentifier($item_id); if ($item_views) { $selected_view = head($item_views); diff --git a/src/applications/search/engine/PhabricatorProfileMenuItemView.php b/src/applications/search/engine/PhabricatorProfileMenuItemView.php --- a/src/applications/search/engine/PhabricatorProfileMenuItemView.php +++ b/src/applications/search/engine/PhabricatorProfileMenuItemView.php @@ -140,7 +140,7 @@ ->setName($this->getName()); $uri = $this->getURI(); - if (strlen($uri)) { + if (@strlen($uri)) { if ($this->getIsExternalLink()) { if (!PhabricatorEnv::isValidURIForLink($uri)) { $uri = '#'; @@ -176,7 +176,7 @@ } $tooltip = $this->getTooltip(); - if (strlen($tooltip)) { + if (@strlen($tooltip)) { $view->setTooltip($tooltip); } 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 @@ -43,7 +43,7 @@ $token_l = array(); for ($ii = 0; $ii < $length; $ii++) { - $token_l[$ii] = strlen($token_v[$ii]); + $token_l[$ii] = @strlen($token_v[$ii]); } $ngram_count = $length - 2; @@ -51,7 +51,7 @@ for ($ii = 0; $ii < $ngram_count; $ii++) { $ngram_l = $token_l[$ii] + $token_l[$ii + 1] + $token_l[$ii + 2]; - $ngram = substr($token, $cursor, $ngram_l); + $ngram = @substr($token, $cursor, $ngram_l); $ngrams[$ngram] = $ngram; $cursor += $token_l[$ii]; diff --git a/src/applications/search/engineextension/PhabricatorFerretFulltextEngineExtension.php b/src/applications/search/engineextension/PhabricatorFerretFulltextEngineExtension.php --- a/src/applications/search/engineextension/PhabricatorFerretFulltextEngineExtension.php +++ b/src/applications/search/engineextension/PhabricatorFerretFulltextEngineExtension.php @@ -83,7 +83,7 @@ foreach ($virtual_fields as $field) { list($key, $raw_corpus) = $field; - if (!strlen($raw_corpus)) { + if (!@strlen($raw_corpus)) { continue; } @@ -106,19 +106,19 @@ foreach ($ferret_corpus_map as $key => $fields) { $raw_corpus = $fields['raw']; $raw_corpus = implode("\n", $raw_corpus); - if (strlen($raw_corpus)) { + if (@strlen($raw_corpus)) { $ngrams_source[] = $raw_corpus; } $normal_corpus = $fields['normal']; $normal_corpus = implode("\n", $normal_corpus); - if (strlen($normal_corpus)) { + if (@strlen($normal_corpus)) { $ngrams_source[] = $normal_corpus; } $term_corpus = $fields['term']; $term_corpus = implode("\n", $term_corpus); - if (strlen($term_corpus)) { + if (@strlen($term_corpus)) { $ngrams_source[] = $term_corpus; } diff --git a/src/applications/search/engineextension/PhabricatorFerretSearchEngineExtension.php b/src/applications/search/engineextension/PhabricatorFerretSearchEngineExtension.php --- a/src/applications/search/engineextension/PhabricatorFerretSearchEngineExtension.php +++ b/src/applications/search/engineextension/PhabricatorFerretSearchEngineExtension.php @@ -27,7 +27,7 @@ PhabricatorSavedQuery $saved, array $map) { - if (!strlen($map['query'])) { + if (!@strlen($map['query'])) { return; } diff --git a/src/applications/search/ferret/PhabricatorFerretEngine.php b/src/applications/search/ferret/PhabricatorFerretEngine.php --- a/src/applications/search/ferret/PhabricatorFerretEngine.php +++ b/src/applications/search/ferret/PhabricatorFerretEngine.php @@ -99,7 +99,7 @@ $term_corpus = preg_replace('/\s+/u', ' ', $term_corpus); $term_corpus = trim($term_corpus, ' '); - if (strlen($term_corpus)) { + if (@strlen($term_corpus)) { $term_corpus = ' '.$term_corpus.' '; } diff --git a/src/applications/search/ferret/function/FerretSearchFunction.php b/src/applications/search/ferret/function/FerretSearchFunction.php --- a/src/applications/search/ferret/function/FerretSearchFunction.php +++ b/src/applications/search/ferret/function/FerretSearchFunction.php @@ -12,7 +12,7 @@ } final public static function validateFerretFunctionName($function_name) { - if (!preg_match('/^[a-zA-Z-]+\z/', $function_name)) { + if (!@preg_match('/^[a-zA-Z-]+\z/', $function_name)) { throw new Exception( pht( 'Ferret search engine function name ("%s") is invalid. Function '. @@ -23,7 +23,7 @@ } final public static function validateFerretFunctionFieldKey($field_key) { - if (!preg_match('/^[a-z]{4}\z/', $field_key)) { + if (!@preg_match('/^[a-z]{4}\z/', $field_key)) { throw new Exception( pht( 'Ferret search engine field key ("%s") is invalid. Field keys '. diff --git a/src/applications/search/field/PhabricatorIDsSearchField.php b/src/applications/search/field/PhabricatorIDsSearchField.php --- a/src/applications/search/field/PhabricatorIDsSearchField.php +++ b/src/applications/search/field/PhabricatorIDsSearchField.php @@ -12,7 +12,7 @@ } protected function newControl() { - if (strlen($this->getValueForControl())) { + if (@strlen($this->getValueForControl())) { return new AphrontFormTextControl(); } else { return null; diff --git a/src/applications/search/field/PhabricatorPHIDsSearchField.php b/src/applications/search/field/PhabricatorPHIDsSearchField.php --- a/src/applications/search/field/PhabricatorPHIDsSearchField.php +++ b/src/applications/search/field/PhabricatorPHIDsSearchField.php @@ -12,7 +12,7 @@ } protected function newControl() { - if (strlen($this->getValueForControl())) { + if (@strlen($this->getValueForControl())) { return new AphrontFormTextControl(); } else { return null; diff --git a/src/applications/search/field/PhabricatorSearchDateField.php b/src/applications/search/field/PhabricatorSearchDateField.php --- a/src/applications/search/field/PhabricatorSearchDateField.php +++ b/src/applications/search/field/PhabricatorSearchDateField.php @@ -17,7 +17,7 @@ } protected function validateControlValue($value) { - if (!strlen($value)) { + if (!@strlen($value)) { return; } @@ -32,7 +32,7 @@ } protected function parseDateTime($value) { - if (!strlen($value)) { + if (!@strlen($value)) { return null; } diff --git a/src/applications/search/field/PhabricatorSearchThreeStateField.php b/src/applications/search/field/PhabricatorSearchThreeStateField.php --- a/src/applications/search/field/PhabricatorSearchThreeStateField.php +++ b/src/applications/search/field/PhabricatorSearchThreeStateField.php @@ -23,7 +23,7 @@ } protected function getValueFromRequest(AphrontRequest $request, $key) { - if (!strlen($request->getStr($key))) { + if (!@strlen($request->getStr($key))) { return null; } return $request->getBool($key); diff --git a/src/applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php b/src/applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php --- a/src/applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php +++ b/src/applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php @@ -108,7 +108,7 @@ private function buildSpec(PhabricatorSavedQuery $query) { $q = new PhabricatorElasticsearchQueryBuilder('bool'); $query_string = $query->getParameter('query'); - if (strlen($query_string)) { + if (@strlen($query_string)) { $fields = $this->getTypeConstants('PhabricatorSearchDocumentFieldType'); // Build a simple_query_string query over all fields that must match all diff --git a/src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php b/src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php --- a/src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php +++ b/src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php @@ -370,7 +370,7 @@ } // If the selector isn't a substring of the class name, continue. - if (strpos($normalized_class, $normalized_type) === false) { + if (@strpos($normalized_class, $normalized_type) === false) { continue; } diff --git a/src/applications/search/management/PhabricatorSearchManagementQueryWorkflow.php b/src/applications/search/management/PhabricatorSearchManagementQueryWorkflow.php --- a/src/applications/search/management/PhabricatorSearchManagementQueryWorkflow.php +++ b/src/applications/search/management/PhabricatorSearchManagementQueryWorkflow.php @@ -21,7 +21,7 @@ public function execute(PhutilArgumentParser $args) { $viewer = $this->getViewer(); $raw_query = $args->getArg('query'); - if (!strlen($raw_query)) { + if (!@strlen($raw_query)) { throw new PhutilArgumentUsageException( pht('Specify a query with --query.')); } diff --git a/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php --- a/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php +++ b/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php @@ -27,7 +27,7 @@ } $name = $this->getName($config); - if (strlen($name)) { + if (@strlen($name)) { return $name; } @@ -90,7 +90,7 @@ // Don't show tooltip if they've set a custom name $name = $config->getMenuItemProperty('name'); - if (!strlen($name)) { + if (!@strlen($name)) { $item->setTooltip($app->getShortDescription()); } diff --git a/src/applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php --- a/src/applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php +++ b/src/applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php @@ -70,7 +70,7 @@ } $name = $this->getName($config); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php --- a/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php +++ b/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php @@ -117,7 +117,7 @@ return pht('Archived Dashboard'); } - if (strlen($this->getName($config))) { + if (@strlen($this->getName($config))) { return $this->getName($config); } else { return $dashboard->getName(); diff --git a/src/applications/search/menuitem/PhabricatorEditEngineProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorEditEngineProfileMenuItem.php --- a/src/applications/search/menuitem/PhabricatorEditEngineProfileMenuItem.php +++ b/src/applications/search/menuitem/PhabricatorEditEngineProfileMenuItem.php @@ -71,7 +71,7 @@ if (!$form) { return pht('(Restricted/Invalid Form)'); } - if (strlen($this->getName($config))) { + if (@strlen($this->getName($config))) { return $this->getName($config); } else { return $form->getName(); diff --git a/src/applications/search/menuitem/PhabricatorManageProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorManageProfileMenuItem.php --- a/src/applications/search/menuitem/PhabricatorManageProfileMenuItem.php +++ b/src/applications/search/menuitem/PhabricatorManageProfileMenuItem.php @@ -31,7 +31,7 @@ PhabricatorProfileMenuItemConfiguration $config) { $name = $config->getMenuItemProperty('name'); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/search/menuitem/PhabricatorProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorProfileMenuItem.php --- a/src/applications/search/menuitem/PhabricatorProfileMenuItem.php +++ b/src/applications/search/menuitem/PhabricatorProfileMenuItem.php @@ -126,7 +126,7 @@ $result = $xaction['new']; } - return !strlen($result); + return !@strlen($result); } final protected function newError($title, $message, $xaction = null) { diff --git a/src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php --- a/src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php +++ b/src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php @@ -62,7 +62,7 @@ if (!$project) { return pht('(Restricted/Invalid Project)'); } - if (strlen($this->getName($config))) { + if (@strlen($this->getName($config))) { return $this->getName($config); } else { return $project->getName(); diff --git a/src/applications/search/storage/PhabricatorProfileMenuItemConfiguration.php b/src/applications/search/storage/PhabricatorProfileMenuItemConfiguration.php --- a/src/applications/search/storage/PhabricatorProfileMenuItemConfiguration.php +++ b/src/applications/search/storage/PhabricatorProfileMenuItemConfiguration.php @@ -239,7 +239,7 @@ } public function matchesIdentifier($identifier) { - if (!strlen($identifier)) { + if (!@strlen($identifier)) { return false; } diff --git a/src/applications/search/view/PhabricatorSearchResultView.php b/src/applications/search/view/PhabricatorSearchResultView.php --- a/src/applications/search/view/PhabricatorSearchResultView.php +++ b/src/applications/search/view/PhabricatorSearchResultView.php @@ -67,11 +67,11 @@ return $str; } - if (!strlen($str)) { + if (!@strlen($str)) { return $str; } - if (strlen($str) > 2048) { + if (@strlen($str) > 2048) { return $str; } @@ -121,7 +121,7 @@ $all_matches[$match_offset] = max( $all_matches[$match_offset], - strlen($match_text)); + @strlen($match_text)); } } @@ -134,7 +134,7 @@ $highlight = 0; $offset = 0; foreach (phutil_utf8v_combined($str) as $character) { - $length = strlen($character); + $length = @strlen($character); if (isset($all_matches[$offset])) { $highlight = $all_matches[$offset]; diff --git a/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php b/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php --- a/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php @@ -184,7 +184,7 @@ new PhabricatorSettingsAddEmailAction(), 1); - if (!strlen($email)) { + if (!@strlen($email)) { $e_email = pht('Required'); $errors[] = pht('Email is required.'); } else if (!PhabricatorUserEmail::isValidAddress($email)) { diff --git a/src/applications/settings/panel/PhabricatorExternalEditorSettingsPanel.php b/src/applications/settings/panel/PhabricatorExternalEditorSettingsPanel.php --- a/src/applications/settings/panel/PhabricatorExternalEditorSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorExternalEditorSettingsPanel.php @@ -39,7 +39,7 @@ $viewer = $this->getViewer(); $pattern = $viewer->getUserSetting(PhabricatorEditorSetting::SETTINGKEY); - if (!strlen($pattern)) { + if (!@strlen($pattern)) { return null; } diff --git a/src/applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php b/src/applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php --- a/src/applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php @@ -257,7 +257,7 @@ // example, with SMS). if (!$request->isFormPost() || !$request->getBool('mfa.start')) { $enroll = $selected_provider->getEnrollMessage(); - if (!strlen($enroll)) { + if (!@strlen($enroll)) { $enroll = $selected_provider->getEnrollDescription($viewer); } @@ -359,7 +359,7 @@ $errors = array(); if ($request->isFormPost()) { $name = $request->getStr('name'); - if (!strlen($name)) { + if (!@strlen($name)) { $e_name = pht('Required'); $errors[] = pht( 'Authentication factors must have a name to identify them.'); diff --git a/src/applications/settings/panel/PhabricatorPasswordSettingsPanel.php b/src/applications/settings/panel/PhabricatorPasswordSettingsPanel.php --- a/src/applications/settings/panel/PhabricatorPasswordSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorPasswordSettingsPanel.php @@ -85,7 +85,7 @@ ->setPasswordType($account_type) ->setObject($user); - if (!strlen($envelope->openEnvelope())) { + if (!@strlen($envelope->openEnvelope())) { $errors[] = pht('You must enter your current password.'); $e_old = pht('Required'); } else if (!$engine->isValidPassword($envelope)) { diff --git a/src/applications/settings/panel/PhabricatorSessionsSettingsPanel.php b/src/applications/settings/panel/PhabricatorSessionsSettingsPanel.php --- a/src/applications/settings/panel/PhabricatorSessionsSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorSessionsSettingsPanel.php @@ -82,7 +82,7 @@ $rows[] = array( $handles[$session->getUserPHID()]->renderLink(), - substr($session->getSessionKey(), 0, 6), + @substr($session->getSessionKey(), 0, 6), $session->getType(), ($hisec > 0) ? phutil_format_relative_time($hisec) diff --git a/src/applications/settings/setting/PhabricatorEditorSetting.php b/src/applications/settings/setting/PhabricatorEditorSetting.php --- a/src/applications/settings/setting/PhabricatorEditorSetting.php +++ b/src/applications/settings/setting/PhabricatorEditorSetting.php @@ -42,7 +42,7 @@ } public function validateTransactionValue($value) { - if (!strlen($value)) { + if (!@strlen($value)) { return; } diff --git a/src/applications/settings/setting/PhabricatorMonospacedFontSetting.php b/src/applications/settings/setting/PhabricatorMonospacedFontSetting.php --- a/src/applications/settings/setting/PhabricatorMonospacedFontSetting.php +++ b/src/applications/settings/setting/PhabricatorMonospacedFontSetting.php @@ -25,7 +25,7 @@ } public function validateTransactionValue($value) { - if (!strlen($value)) { + if (!@strlen($value)) { return; } diff --git a/src/applications/settings/setting/PhabricatorOptionGroupSetting.php b/src/applications/settings/setting/PhabricatorOptionGroupSetting.php --- a/src/applications/settings/setting/PhabricatorOptionGroupSetting.php +++ b/src/applications/settings/setting/PhabricatorOptionGroupSetting.php @@ -44,7 +44,7 @@ } final public function validateTransactionValue($value) { - if (!strlen($value)) { + if (!@strlen($value)) { return; } @@ -63,7 +63,7 @@ } public function getTransactionNewValue($value) { - if (!strlen($value)) { + if (!@strlen($value)) { return null; } diff --git a/src/applications/settings/setting/PhabricatorSelectSetting.php b/src/applications/settings/setting/PhabricatorSelectSetting.php --- a/src/applications/settings/setting/PhabricatorSelectSetting.php +++ b/src/applications/settings/setting/PhabricatorSelectSetting.php @@ -36,7 +36,7 @@ return; } - if (!strlen($value)) { + if (!@strlen($value)) { throw new Exception( pht( 'Empty string is not a valid setting for "%s".', @@ -47,7 +47,7 @@ } final public function validateTransactionValue($value) { - if (!strlen($value)) { + if (!@strlen($value)) { return; } @@ -66,7 +66,7 @@ } public function getTransactionNewValue($value) { - if (!strlen($value)) { + if (!@strlen($value)) { return null; } diff --git a/src/applications/settings/setting/PhabricatorSetting.php b/src/applications/settings/setting/PhabricatorSetting.php --- a/src/applications/settings/setting/PhabricatorSetting.php +++ b/src/applications/settings/setting/PhabricatorSetting.php @@ -95,7 +95,7 @@ ->setMetadataValue($setting_property, $setting_key); $instructions = $this->getControlInstructions(); - if (strlen($instructions)) { + if (@strlen($instructions)) { $template->setControlInstructions($instructions); } diff --git a/src/applications/settings/setting/PhabricatorStringSetting.php b/src/applications/settings/setting/PhabricatorStringSetting.php --- a/src/applications/settings/setting/PhabricatorStringSetting.php +++ b/src/applications/settings/setting/PhabricatorStringSetting.php @@ -8,7 +8,7 @@ } public function getTransactionNewValue($value) { - if (!strlen($value)) { + if (!@strlen($value)) { return null; } diff --git a/src/applications/settings/setting/PhabricatorTranslationSetting.php b/src/applications/settings/setting/PhabricatorTranslationSetting.php --- a/src/applications/settings/setting/PhabricatorTranslationSetting.php +++ b/src/applications/settings/setting/PhabricatorTranslationSetting.php @@ -69,7 +69,7 @@ // If a translation is English, assume it can fall back to the default // strings and don't caveat its completeness. - $is_english = (substr($code, 0, 3) == 'en_'); + $is_english = (@substr($code, 0, 3) == 'en_'); // Arbitrarily pick some number of available strings to promote a // translation out of the "limited" group. The major goal is just to diff --git a/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php b/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php --- a/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php @@ -60,7 +60,7 @@ $poll->setMethod($request->getInt('method')); } - if (!strlen($v_question)) { + if (!@strlen($v_question)) { $e_question = pht('Required'); $errors[] = pht('You must ask a poll question.'); } else { @@ -70,7 +70,7 @@ if ($is_new) { // NOTE: Make sure common and useful response "0" is preserved. foreach ($responses as $key => $response) { - if (!strlen($response)) { + if (!@strlen($response)) { unset($responses[$key]); } } diff --git a/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php b/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php --- a/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php +++ b/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php @@ -58,7 +58,7 @@ $body = parent::buildMailBody($object, $xactions); $description = $object->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $body->addRemarkupSection( pht('SLOWVOTE DESCRIPTION'), $object->getDescription()); diff --git a/src/applications/slowvote/mail/PhabricatorSlowvoteMailReceiver.php b/src/applications/slowvote/mail/PhabricatorSlowvoteMailReceiver.php --- a/src/applications/slowvote/mail/PhabricatorSlowvoteMailReceiver.php +++ b/src/applications/slowvote/mail/PhabricatorSlowvoteMailReceiver.php @@ -13,7 +13,7 @@ } protected function loadObject($pattern, PhabricatorUser $viewer) { - $id = (int)substr($pattern, 1); + $id = (int)@substr($pattern, 1); return id(new PhabricatorSlowvoteQuery()) ->setViewer($viewer) diff --git a/src/applications/slowvote/phid/PhabricatorSlowvotePollPHIDType.php b/src/applications/slowvote/phid/PhabricatorSlowvotePollPHIDType.php --- a/src/applications/slowvote/phid/PhabricatorSlowvotePollPHIDType.php +++ b/src/applications/slowvote/phid/PhabricatorSlowvotePollPHIDType.php @@ -39,7 +39,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^V\d*[1-9]\d*$/i', $name); + return @preg_match('/^V\d*[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -48,7 +48,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php --- a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php +++ b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php @@ -150,7 +150,7 @@ } $description = $poll->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $item->addAttribute(id(new PhutilUTF8StringTruncator()) ->setMaximumGlyphs(120) ->truncateString($poll->getDescription())); diff --git a/src/applications/slowvote/view/SlowvoteEmbedView.php b/src/applications/slowvote/view/SlowvoteEmbedView.php --- a/src/applications/slowvote/view/SlowvoteEmbedView.php +++ b/src/applications/slowvote/view/SlowvoteEmbedView.php @@ -60,7 +60,7 @@ ->setHeader($link_to_slowvote); $description = $poll->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $description = new PHUIRemarkupView($this->getUser(), $description); $description = phutil_tag( 'div', diff --git a/src/applications/spaces/controller/PhabricatorSpacesViewController.php b/src/applications/spaces/controller/PhabricatorSpacesViewController.php --- a/src/applications/spaces/controller/PhabricatorSpacesViewController.php +++ b/src/applications/spaces/controller/PhabricatorSpacesViewController.php @@ -81,7 +81,7 @@ : pht('No')); $description = $space->getDescription(); - if (strlen($description)) { + if (@strlen($description)) { $description = new PHUIRemarkupView($viewer, $description); $list->addSectionHeader( pht('Description'), diff --git a/src/applications/spaces/phid/PhabricatorSpacesNamespacePHIDType.php b/src/applications/spaces/phid/PhabricatorSpacesNamespacePHIDType.php --- a/src/applications/spaces/phid/PhabricatorSpacesNamespacePHIDType.php +++ b/src/applications/spaces/phid/PhabricatorSpacesNamespacePHIDType.php @@ -49,7 +49,7 @@ } public function canLoadNamedObject($name) { - return preg_match('/^S[1-9]\d*$/i', $name); + return @preg_match('/^S[1-9]\d*$/i', $name); } public function loadNamedObjects( @@ -58,7 +58,7 @@ $id_map = array(); foreach ($names as $name) { - $id = (int)substr($name, 1); + $id = (int)@substr($name, 1); $id_map[$id][] = $name; } diff --git a/src/applications/spaces/xaction/PhabricatorSpacesNamespaceNameTransaction.php b/src/applications/spaces/xaction/PhabricatorSpacesNamespaceNameTransaction.php --- a/src/applications/spaces/xaction/PhabricatorSpacesNamespaceNameTransaction.php +++ b/src/applications/spaces/xaction/PhabricatorSpacesNamespaceNameTransaction.php @@ -15,7 +15,7 @@ public function getTitle() { $old = $this->getOldValue(); - if (!strlen($old)) { + if (!@strlen($old)) { return pht( '%s created this space.', $this->renderAuthor()); @@ -48,7 +48,7 @@ $max_length = $object->getColumnMaximumByteLength('namespaceName'); foreach ($xactions as $xaction) { $new_value = $xaction->getNewValue(); - $new_length = strlen($new_value); + $new_length = @strlen($new_value); if ($new_length > $max_length) { $errors[] = $this->newInvalidError( pht('The name can be no longer than %s characters.', diff --git a/src/applications/system/controller/PhabricatorSystemObjectController.php b/src/applications/system/controller/PhabricatorSystemObjectController.php --- a/src/applications/system/controller/PhabricatorSystemObjectController.php +++ b/src/applications/system/controller/PhabricatorSystemObjectController.php @@ -24,7 +24,7 @@ $handle = $handles[$phid]; $object_uri = $handle->getURI(); - if (!strlen($object_uri)) { + if (!@strlen($object_uri)) { return $this->newDialog() ->setTitle(pht('No Object URI')) ->appendParagraph( diff --git a/src/applications/system/controller/PhabricatorSystemSelectViewAsController.php b/src/applications/system/controller/PhabricatorSystemSelectViewAsController.php --- a/src/applications/system/controller/PhabricatorSystemSelectViewAsController.php +++ b/src/applications/system/controller/PhabricatorSystemSelectViewAsController.php @@ -38,7 +38,7 @@ $label = $engine->getViewAsLabel($ref); - if (!strlen($label)) { + if (!@strlen($label)) { continue; } diff --git a/src/applications/tokens/storage/PhabricatorToken.php b/src/applications/tokens/storage/PhabricatorToken.php --- a/src/applications/tokens/storage/PhabricatorToken.php +++ b/src/applications/tokens/storage/PhabricatorToken.php @@ -34,7 +34,7 @@ require_celerity_resource('sprite-tokens-css'); require_celerity_resource('tokens-css'); - $sprite = substr($this->getPHID(), 10); + $sprite = @substr($this->getPHID(), 10); return id(new PHUIIconView()) ->setSpriteSheet(PHUIIconView::SPRITE_TOKENS) diff --git a/src/applications/transactions/bulk/PhabricatorBulkEngine.php b/src/applications/transactions/bulk/PhabricatorBulkEngine.php --- a/src/applications/transactions/bulk/PhabricatorBulkEngine.php +++ b/src/applications/transactions/bulk/PhabricatorBulkEngine.php @@ -153,7 +153,7 @@ ->setViewer($viewer); $query_key = $request->getURIData('queryKey'); - if (strlen($query_key)) { + if (@strlen($query_key)) { if ($search_engine->isBuiltinQuery($query_key)) { $saved = $search_engine->buildSavedQueryFromBuiltin($query_key); } else { diff --git a/src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php b/src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php --- a/src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php +++ b/src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php @@ -51,7 +51,7 @@ list($engine, $queries) = $this->newQueries($args); $format_key = $args->getArg('format'); - if (!strlen($format_key)) { + if (!@strlen($format_key)) { throw new PhutilArgumentUsageException( pht( 'Specify an export format with "--format".')); @@ -77,7 +77,7 @@ $is_overwrite = $args->getArg('overwrite'); $output_path = $args->getArg('output'); - if (!strlen($output_path)) { + if (!@strlen($output_path)) { throw new PhutilArgumentUsageException( pht( 'Use "--output " to specify an output file, or "--output -" '. @@ -164,7 +164,7 @@ ->execute(); $class = $args->getArg('class'); - if (strlen($class)) { + if (@strlen($class)) { $class_list = array(); foreach ($engine_classes as $class_name => $engine_object) { @@ -182,7 +182,7 @@ $matches = array(); foreach ($engine_classes as $class_name => $engine_object) { if (stripos($class_name, $class) !== false) { - if (strtolower($class_name) == strtolower($class)) { + if (@strtolower($class_name) == @strtolower($class)) { $matches = array($class_name); break; } else { diff --git a/src/applications/transactions/conduit/TransactionSearchConduitAPIMethod.php b/src/applications/transactions/conduit/TransactionSearchConduitAPIMethod.php --- a/src/applications/transactions/conduit/TransactionSearchConduitAPIMethod.php +++ b/src/applications/transactions/conduit/TransactionSearchConduitAPIMethod.php @@ -263,7 +263,7 @@ } $group_id = $xaction->getTransactionGroupID(); - if (!strlen($group_id)) { + if (!@strlen($group_id)) { $group_id = null; } else { $group_id = (string)$group_id; diff --git a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentEditController.php b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentEditController.php --- a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentEditController.php +++ b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentEditController.php @@ -54,7 +54,7 @@ $comment = $xaction->getApplicationTransactionCommentObject(); $comment->setContent($text); - if (!strlen($text)) { + if (!@strlen($text)) { $comment->setIsDeleted(true); } diff --git a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentQuoteController.php b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentQuoteController.php --- a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentQuoteController.php +++ b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentQuoteController.php @@ -31,7 +31,7 @@ $content = rtrim($content, "\r\n"); $content = phutil_split_lines($content, true); foreach ($content as $key => $line) { - if (strlen($line) && ($line[0] != '>')) { + if (@strlen($line) && ($line[0] != '>')) { $content[$key] = '> '.$line; } else { $content[$key] = '>'.$line; @@ -45,7 +45,7 @@ ->executeOne(); $ref = $request->getStr('ref'); - if (strlen($ref)) { + if (@strlen($ref)) { $quote = pht('In %s, %s wrote:', $ref, '@'.$author->getName()); } else { $quote = pht('%s wrote:', '@'.$author->getName()); diff --git a/src/applications/transactions/controller/PhabricatorEditEngineConfigurationLockController.php b/src/applications/transactions/controller/PhabricatorEditEngineConfigurationLockController.php --- a/src/applications/transactions/controller/PhabricatorEditEngineConfigurationLockController.php +++ b/src/applications/transactions/controller/PhabricatorEditEngineConfigurationLockController.php @@ -89,7 +89,7 @@ $key = $field->getKey(); $label = $field->getLabel(); - if (!strlen($label)) { + if (!@strlen($label)) { $label = $key; } diff --git a/src/applications/transactions/editengine/PhabricatorEditEngine.php b/src/applications/transactions/editengine/PhabricatorEditEngine.php --- a/src/applications/transactions/editengine/PhabricatorEditEngine.php +++ b/src/applications/transactions/editengine/PhabricatorEditEngine.php @@ -51,7 +51,7 @@ final public function getEngineKey() { $key = $this->getPhobjectClassConstant('ENGINECONST', 64); - if (strpos($key, '/') !== false) { + if (@strpos($key, '/') !== false) { throw new Exception( pht( 'EditEngine ("%s") contains an invalid key character "/".', @@ -97,7 +97,7 @@ } public static function splitFullKey($full_key) { - return explode('/', $full_key, 2); + return @explode('/', $full_key, 2); } public function getQuickCreateOrderVector() { @@ -474,7 +474,7 @@ ->setIsDefault(true) ->setIsEdit(true); - if (!strlen($first->getName())) { + if (!@strlen($first->getName())) { $first->setName($this->getObjectCreateShortText()); } } else { @@ -939,7 +939,7 @@ } } else { $form_key = $request->getURIData('formKey'); - if (strlen($form_key)) { + if (@strlen($form_key)) { $config = $this->loadEditEngineConfigurationWithIdentifier($form_key); if (!$config) { @@ -969,14 +969,14 @@ } $page_key = $request->getURIData('pageKey'); - if (!strlen($page_key)) { + if (!@strlen($page_key)) { $pages = $this->getPages($object); if ($pages) { $page_key = head_key($pages); } } - if (strlen($page_key)) { + if (@strlen($page_key)) { $page = $this->selectPage($object, $page_key); if (!$page) { return new Aphront404Response(); @@ -1167,7 +1167,7 @@ if ($this->getIsCreate()) { $template = $request->getStr('template'); - if (strlen($template)) { + if (@strlen($template)) { $template_object = $this->newObjectFromIdentifier( $template, array( @@ -1921,7 +1921,7 @@ $viewer->getPHID(), $current_version); - $is_empty = (!strlen($comment_text) && !$actions); + $is_empty = (!@strlen($comment_text) && !$actions); $draft ->setProperty('comment', $comment_text) @@ -2003,7 +2003,7 @@ $xactions[] = $xaction; } - if (strlen($comment_text) || !$xactions) { + if (@strlen($comment_text) || !$xactions) { $xactions[] = id(clone $template) ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) ->attachComment( diff --git a/src/applications/transactions/editengine/PhabricatorEditEngineAPIMethod.php b/src/applications/transactions/editengine/PhabricatorEditEngineAPIMethod.php --- a/src/applications/transactions/editengine/PhabricatorEditEngineAPIMethod.php +++ b/src/applications/transactions/editengine/PhabricatorEditEngineAPIMethod.php @@ -96,7 +96,7 @@ $section[] = $type->getConduitDescription(); $type_documentation = $type->getConduitDocumentation(); - if (strlen($type_documentation)) { + if (@strlen($type_documentation)) { $section[] = $type_documentation; } diff --git a/src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php b/src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php --- a/src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php +++ b/src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php @@ -89,7 +89,7 @@ } public function hasTagView() { - return (bool)strlen($this->getTagText()); + return (bool)@strlen($this->getTagText()); } public function newTagView() { @@ -117,7 +117,7 @@ } public static function validateSubtypeKey($subtype) { - if (strlen($subtype) > 64) { + if (@strlen($subtype) > 64) { throw new Exception( pht( 'Subtype "%s" is not valid: subtype keys must be no longer than '. @@ -125,7 +125,7 @@ $subtype)); } - if (strlen($subtype) < 3) { + if (@strlen($subtype) < 3) { throw new Exception( pht( 'Subtype "%s" is not valid: subtype keys must have a minimum '. @@ -133,7 +133,7 @@ $subtype)); } - if (!preg_match('/^[a-z]+\z/', $subtype)) { + if (!@preg_match('/^[a-z]+\z/', $subtype)) { throw new Exception( pht( 'Subtype "%s" is not valid: subtype keys may only contain '. @@ -179,7 +179,7 @@ $map[$key] = true; $name = $value['name']; - if (!strlen($name)) { + if (!@strlen($name)) { throw new Exception( pht( 'Subtype configuration is invalid: subtype with key "%s" has '. diff --git a/src/applications/transactions/editfield/PhabricatorEditField.php b/src/applications/transactions/editfield/PhabricatorEditField.php --- a/src/applications/transactions/editfield/PhabricatorEditField.php +++ b/src/applications/transactions/editfield/PhabricatorEditField.php @@ -418,7 +418,7 @@ } $instructions = $this->getControlInstructions(); - if (strlen($instructions)) { + if (@strlen($instructions)) { $form->appendRemarkupInstructions($instructions); } diff --git a/src/applications/transactions/editfield/PhabricatorTextEditField.php b/src/applications/transactions/editfield/PhabricatorTextEditField.php --- a/src/applications/transactions/editfield/PhabricatorTextEditField.php +++ b/src/applications/transactions/editfield/PhabricatorTextEditField.php @@ -18,7 +18,7 @@ $control = new AphrontFormTextControl(); $placeholder = $this->getPlaceholder(); - if (strlen($placeholder)) { + if (@strlen($placeholder)) { $control->setPlaceholder($placeholder); } diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php @@ -214,7 +214,7 @@ } $cancel_uri = $this->getCancelURI(); - if (!strlen($cancel_uri)) { + if (!@strlen($cancel_uri)) { throw new PhutilInvalidStateException('setCancelURI'); } diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -511,7 +511,7 @@ return true; case PhabricatorTransactions::TYPE_SPACE: $space_phid = $xaction->getNewValue(); - if (!strlen($space_phid)) { + if (!@strlen($space_phid)) { // If an install has no Spaces or the Spaces controls are not visible // to the viewer, we might end up with the empty string here instead // of a strict `null`, because some controller just used `getStr()` @@ -2909,11 +2909,11 @@ * @return bool True if the field will be an empty text field after edits. */ protected function validateIsEmptyTextField($field_value, array $xactions) { - if (strlen($field_value) && empty($xactions)) { + if (@strlen($field_value) && empty($xactions)) { return false; } - if ($xactions && strlen(last($xactions)->getNewValue())) { + if ($xactions && @strlen(last($xactions)->getNewValue())) { return false; } diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php --- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php @@ -507,9 +507,9 @@ $old = $this->getOldValue(); $new = $this->getNewValue(); if ($new) { - $icon = substr($new, 10); + $icon = @substr($new, 10); } else { - $icon = substr($old, 10); + $icon = @substr($old, 10); } return array($icon, !$this->getNewValue()); } @@ -602,7 +602,7 @@ } if (!is_array($old)) { - if (!strlen($old)) { + if (!@strlen($old)) { return true; } @@ -863,7 +863,7 @@ } $comment = $this->getComment(); - if ($comment && strlen($comment->getContent())) { + if ($comment && @strlen($comment->getContent())) { return $comment->getContent(); } @@ -1328,7 +1328,7 @@ switch ($this->getTransactionType()) { case PhabricatorTransactions::TYPE_COMMENT: $text = $this->getComment()->getContent(); - if (strlen($text)) { + if (@strlen($text)) { $fields[] = 'comment/'.$this->getID(); } break; @@ -1362,7 +1362,7 @@ switch ($this->getTransactionType()) { case PhabricatorTransactions::TYPE_COMMENT: $text = $this->getComment()->getContent(); - if (strlen($text)) { + if (@strlen($text)) { $body = $story->getMarkupFieldOutput('comment/'.$this->getID()); } break; diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php b/src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php --- a/src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php @@ -112,7 +112,7 @@ // The comment is empty if there's no content, or if the content only has // whitespace. - if (!strlen(trim($content))) { + if (!@strlen(trim($content))) { return true; } diff --git a/src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php b/src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php --- a/src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php +++ b/src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php @@ -113,7 +113,7 @@ } public function setBuiltinKey($key) { - if (strpos($key, '/') !== false) { + if (@strpos($key, '/') !== false) { throw new Exception( pht('EditEngine BuiltinKey contains an invalid key character "/".')); } @@ -185,7 +185,7 @@ $fields = $this->reorderFields($fields); $preamble = $this->getPreamble(); - if (strlen($preamble)) { + if (@strlen($preamble)) { $fields = array( 'config.preamble' => id(new PhabricatorInstructionsEditField()) ->setKey('config.preamble') @@ -240,7 +240,7 @@ public function getDisplayName() { $name = $this->getName(); - if (strlen($name)) { + if (@strlen($name)) { return $name; } diff --git a/src/applications/transactions/storage/PhabricatorModularTransactionType.php b/src/applications/transactions/storage/PhabricatorModularTransactionType.php --- a/src/applications/transactions/storage/PhabricatorModularTransactionType.php +++ b/src/applications/transactions/storage/PhabricatorModularTransactionType.php @@ -339,7 +339,7 @@ $value = $xaction->getNewValue(); } - return !strlen($value); + return !@strlen($value); } /** diff --git a/src/applications/transactions/view/PhabricatorApplicationEditHTTPParameterHelpView.php b/src/applications/transactions/view/PhabricatorApplicationEditHTTPParameterHelpView.php --- a/src/applications/transactions/view/PhabricatorApplicationEditHTTPParameterHelpView.php +++ b/src/applications/transactions/view/PhabricatorApplicationEditHTTPParameterHelpView.php @@ -255,7 +255,7 @@ $options = $field->getOptions(); $label = $field->getLabel(); foreach ($options as $option_key => $option_value) { - if (strlen($option_key)) { + if (@strlen($option_key)) { $option_display = $option_key; } else { $option_display = phutil_tag('em', array(), pht('')); diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php --- a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php @@ -568,7 +568,7 @@ } foreach ($groups as $group_key => $group_items) { - if (strlen($group_key)) { + if (@strlen($group_key)) { $group_label = idx($group_labels, $group_key, $group_key); $options[$group_label] = ipull($group_items, 'label'); } else { diff --git a/src/applications/transactions/xaction/PhabricatorEditEngineNameTransaction.php b/src/applications/transactions/xaction/PhabricatorEditEngineNameTransaction.php --- a/src/applications/transactions/xaction/PhabricatorEditEngineNameTransaction.php +++ b/src/applications/transactions/xaction/PhabricatorEditEngineNameTransaction.php @@ -14,7 +14,7 @@ } public function getTitle() { - if (strlen($this->getOldValue())) { + if (@strlen($this->getOldValue())) { return pht( '%s renamed this form from %s to %s.', $this->renderAuthor(), @@ -33,7 +33,7 @@ foreach ($xactions as $xaction) { $new = $xaction->getNewValue(); - if (!strlen($new)) { + if (!@strlen($new)) { $errors[] = $this->newRequiredError( pht('Form name is required.'), $xaction); diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php --- a/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php +++ b/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php @@ -39,7 +39,7 @@ $parameters = array(); $raw_parameters = $request->getStr('parameters'); - if (strlen($raw_parameters)) { + if (@strlen($raw_parameters)) { try { $parameters = phutil_json_decode($raw_parameters); } catch (PhutilJSONParserException $ex) { diff --git a/src/applications/typeahead/datasource/PhabricatorTypeaheadCompositeDatasource.php b/src/applications/typeahead/datasource/PhabricatorTypeaheadCompositeDatasource.php --- a/src/applications/typeahead/datasource/PhabricatorTypeaheadCompositeDatasource.php +++ b/src/applications/typeahead/datasource/PhabricatorTypeaheadCompositeDatasource.php @@ -28,7 +28,7 @@ // We only need to do a prefix phase query if there's an actual query // string. If the user didn't type anything, nothing can possibly match it. - if (strlen($this->getRawQuery())) { + if (@strlen($this->getRawQuery())) { $phases[] = self::PHASE_PREFIX; } @@ -66,7 +66,7 @@ protected function loadResultsForPhase($phase, $limit) { if ($phase == self::PHASE_PREFIX) { $this->prefixString = $this->getPrefixQuery(); - $this->prefixLength = strlen($this->prefixString); + $this->prefixLength = @strlen($this->prefixString); } // If the input query is a function like `members(platy`, and we can diff --git a/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php b/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php --- a/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php +++ b/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php @@ -149,7 +149,7 @@ public static function tokenizeString($string) { $string = phutil_utf8_strtolower($string); $string = trim($string); - if (!strlen($string)) { + if (!@strlen($string)) { return array(); } @@ -161,7 +161,7 @@ // Make sure we don't return the empty token, as this will boil down to a // JOIN against every token. foreach ($tokens as $key => $value) { - if (!strlen($value)) { + if (!@strlen($value)) { unset($tokens[$key]); } } @@ -223,7 +223,7 @@ $map = array(); foreach ($tokens as $token) { - $map[$token] = strlen($token); + $map[$token] = @strlen($token); } foreach ($results as $key => $result) { @@ -464,7 +464,7 @@ // We're looking for a "(" so that a string like "members(q" is identified // and parsed as a function call. This allows us to start generating // results immediately, before the user fully types out "members(quack)". - return (strpos($token, '(') !== false); + return (@strpos($token, '(') !== false); } @@ -475,9 +475,9 @@ $matches = null; if ($allow_partial) { - $ok = preg_match('/^([^(]+)\((.*?)\)?\z/', $token, $matches); + $ok = @preg_match('/^([^(]+)\((.*?)\)?\z/', $token, $matches); } else { - $ok = preg_match('/^([^(]+)\((.*)\)\z/', $token, $matches); + $ok = @preg_match('/^([^(]+)\((.*)\)\z/', $token, $matches); } if (!$ok) { @@ -510,7 +510,7 @@ $argv = $matches[2]; $argv = trim($argv); - if (!strlen($argv)) { + if (!@strlen($argv)) { $argv = array(); } else { $argv = preg_split('/,/', $matches[2]); diff --git a/src/applications/typeahead/datasource/__tests__/PhabricatorTypeaheadTestNumbersDatasource.php b/src/applications/typeahead/datasource/__tests__/PhabricatorTypeaheadTestNumbersDatasource.php --- a/src/applications/typeahead/datasource/__tests__/PhabricatorTypeaheadTestNumbersDatasource.php +++ b/src/applications/typeahead/datasource/__tests__/PhabricatorTypeaheadTestNumbersDatasource.php @@ -36,7 +36,7 @@ foreach ($argv_list as $argv) { foreach ($argv as $k => $arg) { - if (!is_scalar($arg) || !preg_match('/^\d+\z/', $arg)) { + if (!is_scalar($arg) || !@preg_match('/^\d+\z/', $arg)) { throw new PhabricatorTypeaheadInvalidTokenException( pht( 'All arguments to "%s(...)" must be integers, found '. diff --git a/src/applications/typeahead/engineextension/PhabricatorMonogramDatasourceEngineExtension.php b/src/applications/typeahead/engineextension/PhabricatorMonogramDatasourceEngineExtension.php --- a/src/applications/typeahead/engineextension/PhabricatorMonogramDatasourceEngineExtension.php +++ b/src/applications/typeahead/engineextension/PhabricatorMonogramDatasourceEngineExtension.php @@ -16,17 +16,17 @@ // today and don't feel worth adding separate extensions for. // Send "f" to Feed. - if (preg_match('/^f\z/i', $query)) { + if (@preg_match('/^f\z/i', $query)) { return '/feed/'; } // Send "d" to Differential. - if (preg_match('/^d\z/i', $query)) { + if (@preg_match('/^d\z/i', $query)) { return '/differential/'; } // Send "t" to Maniphest. - if (preg_match('/^t\z/i', $query)) { + if (@preg_match('/^t\z/i', $query)) { return '/maniphest/'; } diff --git a/src/applications/uiexample/examples/PhabricatorUIExample.php b/src/applications/uiexample/examples/PhabricatorUIExample.php --- a/src/applications/uiexample/examples/PhabricatorUIExample.php +++ b/src/applications/uiexample/examples/PhabricatorUIExample.php @@ -35,7 +35,7 @@ } else { $handle->setFullName( sprintf('%s%d: %s', - substr($type, 0, 1), + @substr($type, 0, 1), $id, $name)); } diff --git a/src/applications/xhprof/storage/PhabricatorXHProfSample.php b/src/applications/xhprof/storage/PhabricatorXHProfSample.php --- a/src/applications/xhprof/storage/PhabricatorXHProfSample.php +++ b/src/applications/xhprof/storage/PhabricatorXHProfSample.php @@ -43,7 +43,7 @@ public function getDisplayName() { $request_path = $this->getRequestPath(); - if (strlen($request_path)) { + if (@strlen($request_path)) { return $request_path; } 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 @@ -34,8 +34,8 @@ $children = array(); $parents = array(); foreach ($this->profileData as $key => $counters) { - if (strpos($key, '==>') !== false) { - list($parent, $child) = explode('==>', $key, 2); + if (@strpos($key, '==>') !== false) { + list($parent, $child) = @explode('==>', $key, 2); } else { continue; } diff --git a/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php b/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php --- a/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php +++ b/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php @@ -35,7 +35,7 @@ $aggregated = array(); foreach ($flat as $call => $counters) { - $parts = explode('@', $call, 2); + $parts = @explode('@', $call, 2); $agg_call = reset($parts); if (empty($aggregated[$agg_call])) { $aggregated[$agg_call] = $counters; diff --git a/src/docs/flavor/php_pitfalls.diviner b/src/docs/flavor/php_pitfalls.diviner --- a/src/docs/flavor/php_pitfalls.diviner +++ b/src/docs/flavor/php_pitfalls.diviner @@ -60,7 +60,7 @@ This is wrong because it prevents users from making the comment "0". //THIS COMMENT IS TOTALLY AWESOME AND I MAKE IT ALL THE TIME SO YOU HAD BETTER NOT -BREAK IT!!!// A better test is probably `strlen()`. +BREAK IT!!!// A better test is probably `@strlen()`. In addition to truth tests with `if`, PHP has two special truthiness operators which look like functions but aren't: `empty()` and `isset()`. These operators diff --git a/src/infrastructure/cache/PhutilDirectoryKeyValueCache.php b/src/infrastructure/cache/PhutilDirectoryKeyValueCache.php --- a/src/infrastructure/cache/PhutilDirectoryKeyValueCache.php +++ b/src/infrastructure/cache/PhutilDirectoryKeyValueCache.php @@ -196,7 +196,7 @@ foreach ($keys as $key) { // NOTE: Use of "." is reserved for ".lock", "key.new" and "key.cache". // Use of "_" is reserved for converting ":". - if (!preg_match('@^[a-zA-Z0-9/:-]+$@', $key)) { + if (!@preg_match('@^[a-zA-Z0-9/:-]+$@', $key)) { throw new Exception( pht( "Invalid key '%s': directory caches may only contain letters, ". diff --git a/src/infrastructure/cache/PhutilKeyValueCacheNamespace.php b/src/infrastructure/cache/PhutilKeyValueCacheNamespace.php --- a/src/infrastructure/cache/PhutilKeyValueCacheNamespace.php +++ b/src/infrastructure/cache/PhutilKeyValueCacheNamespace.php @@ -5,7 +5,7 @@ private $namespace; public function setNamespace($namespace) { - if (strpos($namespace, ':') !== false) { + if (@strpos($namespace, ':') !== false) { throw new Exception(pht("Namespace can't contain colons.")); } @@ -56,7 +56,7 @@ $unprefixed_keys = array(); foreach ($keys as $key) { - $unprefixed_keys[] = substr($key, strlen($this->namespace)); + $unprefixed_keys[] = @substr($key, @strlen($this->namespace)); } return $unprefixed_keys; diff --git a/src/infrastructure/cluster/PhabricatorDatabaseRef.php b/src/infrastructure/cluster/PhabricatorDatabaseRef.php --- a/src/infrastructure/cluster/PhabricatorDatabaseRef.php +++ b/src/infrastructure/cluster/PhabricatorDatabaseRef.php @@ -229,7 +229,7 @@ $host = $this->getHost(); $port = $this->getPort(); - if (strlen($port)) { + if (@strlen($port)) { return "{$host}:{$port}"; } @@ -392,7 +392,7 @@ if ($is_replica) { $latency = idx($replica_status, 'Seconds_Behind_Master'); - if (!strlen($latency)) { + if (!@strlen($latency)) { $ref->setReplicaStatus(self::REPLICATION_NOT_REPLICATING); } else { $latency = (int)$latency; diff --git a/src/infrastructure/contentsource/PhabricatorUnknownContentSource.php b/src/infrastructure/contentsource/PhabricatorUnknownContentSource.php --- a/src/infrastructure/contentsource/PhabricatorUnknownContentSource.php +++ b/src/infrastructure/contentsource/PhabricatorUnknownContentSource.php @@ -7,7 +7,7 @@ public function getSourceName() { $source = $this->getSource(); - if (strlen($source)) { + if (@strlen($source)) { return pht('Unknown ("%s")', $source); } else { return pht('Unknown'); diff --git a/src/infrastructure/customfield/datasource/PhabricatorStandardSelectCustomFieldDatasource.php b/src/infrastructure/customfield/datasource/PhabricatorStandardSelectCustomFieldDatasource.php --- a/src/infrastructure/customfield/datasource/PhabricatorStandardSelectCustomFieldDatasource.php +++ b/src/infrastructure/customfield/datasource/PhabricatorStandardSelectCustomFieldDatasource.php @@ -37,7 +37,7 @@ } $role = $this->getParameter('role'); - if (!strlen($role)) { + if (!@strlen($role)) { throw new Exception(pht('No custom field role specified.')); } @@ -45,7 +45,7 @@ $field_list = PhabricatorCustomField::getObjectFields($object, $role); $field_key = $this->getParameter('key'); - if (!strlen($field_key)) { + if (!@strlen($field_key)) { throw new Exception(pht('No custom field key specified.')); } diff --git a/src/infrastructure/customfield/field/PhabricatorCustomField.php b/src/infrastructure/customfield/field/PhabricatorCustomField.php --- a/src/infrastructure/customfield/field/PhabricatorCustomField.php +++ b/src/infrastructure/customfield/field/PhabricatorCustomField.php @@ -1669,7 +1669,7 @@ $map = array(); foreach ($fields as $field) { $modern_key = $field->getModernFieldKey(); - if (!strlen($modern_key)) { + if (!@strlen($modern_key)) { continue; } diff --git a/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php b/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php --- a/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php +++ b/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php @@ -89,7 +89,7 @@ $field_handles = array_select_keys($handles, $phids[$field_key]); $instructions = $field->getInstructionsForEdit(); - if (strlen($instructions)) { + if (@strlen($instructions)) { $form->appendRemarkupInstructions($instructions); } diff --git a/src/infrastructure/customfield/herald/PhabricatorCustomFieldHeraldField.php b/src/infrastructure/customfield/herald/PhabricatorCustomFieldHeraldField.php --- a/src/infrastructure/customfield/herald/PhabricatorCustomFieldHeraldField.php +++ b/src/infrastructure/customfield/herald/PhabricatorCustomFieldHeraldField.php @@ -42,7 +42,7 @@ // arrange a collision) but preserves backward compatibility. $full_key = $prefix.$key; - if (strlen($full_key) > $limit) { + if (@strlen($full_key) > $limit) { $full_key = PhabricatorHash::digestToLength($full_key, $limit); } diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php @@ -268,7 +268,7 @@ public function readValueFromRequest(AphrontRequest $request) { $value = $request->getStr($this->getFieldKey()); - if (!strlen($value)) { + if (!@strlen($value)) { $value = null; } $this->setFieldValue($value); @@ -301,7 +301,7 @@ } public function renderPropertyViewValue(array $handles) { - if (!strlen($this->getFieldValue())) { + if (!@strlen($this->getFieldValue())) { return null; } return $this->getFieldValue(); @@ -389,7 +389,7 @@ if (is_array($value)) { return empty($value); } - return !strlen($value); + return !@strlen($value); } public function getApplicationTransactionTitle( @@ -472,12 +472,12 @@ // If the caller or configuration didn't specify a valid field key, // generate one automatically from the field index. - if (!is_string($field_key) || (strlen($field_key) != 4)) { - $field_key = '!'.substr($this->getFieldIndex(), 0, 3); + if (!is_string($field_key) || (@strlen($field_key) != 4)) { + $field_key = '!'.@substr($this->getFieldIndex(), 0, 3); } $field_value = $this->getFieldValue(); - if (strlen($field_value)) { + if (@strlen($field_value)) { $document->addField($field_key, $field_value); } } diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldBool.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldBool.php --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldBool.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldBool.php @@ -11,7 +11,7 @@ $indexes = array(); $value = $this->getFieldValue(); - if (strlen($value)) { + if (@strlen($value)) { $indexes[] = $this->newNumericIndex((int)$value); } @@ -36,7 +36,7 @@ } public function setValueFromStorage($value) { - if (strlen($value)) { + if (@strlen($value)) { $value = (bool)$value; } else { $value = null; diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldCredential.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldCredential.php --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldCredential.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldCredential.php @@ -11,7 +11,7 @@ $indexes = array(); $value = $this->getFieldValue(); - if (strlen($value)) { + if (@strlen($value)) { $indexes[] = $this->newStringIndex($value); } diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php @@ -11,7 +11,7 @@ $indexes = array(); $value = $this->getFieldValue(); - if (strlen($value)) { + if (@strlen($value)) { $indexes[] = $this->newNumericIndex((int)$value); } @@ -24,7 +24,7 @@ public function getValueForStorage() { $value = $this->getFieldValue(); - if (strlen($value)) { + if (@strlen($value)) { return (int)$value; } else { return null; @@ -32,7 +32,7 @@ } public function setValueFromStorage($value) { - if (strlen($value)) { + if (@strlen($value)) { $value = (int)$value; } else { $value = null; @@ -109,14 +109,14 @@ } $min_str = idx($value, 'min', ''); - if (strlen($min_str)) { + if (@strlen($min_str)) { $min = PhabricatorTime::parseLocalTime($min_str, $viewer); } else { $min = null; } $max_str = idx($value, 'max', ''); - if (strlen($max_str)) { + if (@strlen($max_str)) { $max = PhabricatorTime::parseLocalTime($max_str, $viewer); } else { $max = null; diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php @@ -11,7 +11,7 @@ $indexes = array(); $value = $this->getFieldValue(); - if (strlen($value)) { + if (@strlen($value)) { $indexes[] = $this->newNumericIndex((int)$value); } @@ -24,7 +24,7 @@ public function getValueForStorage() { $value = $this->getFieldValue(); - if (strlen($value)) { + if (@strlen($value)) { return $value; } else { return null; @@ -32,7 +32,7 @@ } public function setValueFromStorage($value) { - if (strlen($value)) { + if (@strlen($value)) { $value = (int)$value; } else { $value = null; @@ -52,7 +52,7 @@ PhabricatorCursorPagedPolicyAwareQuery $query, $value) { - if (strlen($value)) { + if (@strlen($value)) { $query->withApplicationSearchContainsConstraint( $this->newNumericIndex(null), $value); @@ -83,8 +83,8 @@ foreach ($xactions as $xaction) { $value = $xaction->getNewValue(); - if (strlen($value)) { - if (!preg_match('/^-?\d+/', $value)) { + if (@strlen($value)) { + if (!@preg_match('/^-?\d+/', $value)) { $errors[] = new PhabricatorApplicationTransactionValidationError( $type, pht('Invalid'), @@ -103,9 +103,9 @@ $old = $xaction->getOldValue(); $new = $xaction->getNewValue(); - if (!strlen($old) && strlen($new)) { + if (!@strlen($old) && @strlen($new)) { return true; - } else if (strlen($old) && !strlen($new)) { + } else if (@strlen($old) && !@strlen($new)) { return true; } else { return ((int)$old !== (int)$new); diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldLink.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldLink.php --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldLink.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldLink.php @@ -11,7 +11,7 @@ $indexes = array(); $value = $this->getFieldValue(); - if (strlen($value)) { + if (@strlen($value)) { $indexes[] = $this->newStringIndex($value); } @@ -21,7 +21,7 @@ public function renderPropertyViewValue(array $handles) { $value = $this->getFieldValue(); - if (!strlen($value)) { + if (!@strlen($value)) { return null; } @@ -51,7 +51,7 @@ PhabricatorCursorPagedPolicyAwareQuery $query, $value) { - if (is_string($value) && !strlen($value)) { + if (is_string($value) && !@strlen($value)) { return; } diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php @@ -30,7 +30,7 @@ public function renderPropertyViewValue(array $handles) { $value = $this->getFieldValue(); - if (!strlen($value)) { + if (!@strlen($value)) { return null; } diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php @@ -11,7 +11,7 @@ $indexes = array(); $value = $this->getFieldValue(); - if (strlen($value)) { + if (@strlen($value)) { $indexes[] = $this->newStringIndex($value); } @@ -73,7 +73,7 @@ } public function renderPropertyViewValue(array $handles) { - if (!strlen($this->getFieldValue())) { + if (!@strlen($this->getFieldValue())) { return null; } return idx($this->getOptions(), $this->getFieldValue()); diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldText.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldText.php --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldText.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldText.php @@ -11,7 +11,7 @@ $indexes = array(); $value = $this->getFieldValue(); - if (strlen($value)) { + if (@strlen($value)) { $indexes[] = $this->newStringIndex($value); } @@ -30,7 +30,7 @@ PhabricatorCursorPagedPolicyAwareQuery $query, $value) { - if (strlen($value)) { + if (@strlen($value)) { $query->withApplicationSearchContainsConstraint( $this->newStringIndex(null), $value); diff --git a/src/infrastructure/daemon/PhutilDaemon.php b/src/infrastructure/daemon/PhutilDaemon.php --- a/src/infrastructure/daemon/PhutilDaemon.php +++ b/src/infrastructure/daemon/PhutilDaemon.php @@ -295,7 +295,7 @@ } public function didReceiveStdout($data) { - if (!strlen($data)) { + if (!@strlen($data)) { return ''; } diff --git a/src/infrastructure/daemon/PhutilDaemonHandle.php b/src/infrastructure/daemon/PhutilDaemonHandle.php --- a/src/infrastructure/daemon/PhutilDaemonHandle.php +++ b/src/infrastructure/daemon/PhutilDaemonHandle.php @@ -165,12 +165,12 @@ list($stdout, $stderr) = $future->read(); $future->discardBuffers(); - if (strlen($stdout)) { + if (@strlen($stdout)) { $this->didReadStdout($stdout); } $stderr = trim($stderr); - if (strlen($stderr)) { + if (@strlen($stderr)) { foreach (phutil_split_lines($stderr, false) as $line) { $this->logMessage('STDE', $line); } @@ -246,7 +246,7 @@ * @return string A unique daemon ID. */ private function generateDaemonID() { - return substr(getmypid().':'.Filesystem::readRandomCharacters(12), 0, 12); + return @substr(getmypid().':'.Filesystem::readRandomCharacters(12), 0, 12); } public function getDaemonID() { @@ -379,12 +379,12 @@ private function didReadStdout($data) { $this->stdoutBuffer .= $data; while (true) { - $pos = strpos($this->stdoutBuffer, "\n"); + $pos = @strpos($this->stdoutBuffer, "\n"); if ($pos === false) { break; } - $message = substr($this->stdoutBuffer, 0, $pos); - $this->stdoutBuffer = substr($this->stdoutBuffer, $pos + 1); + $message = @substr($this->stdoutBuffer, 0, $pos); + $this->stdoutBuffer = @substr($this->stdoutBuffer, $pos + 1); try { $structure = phutil_json_decode($message); diff --git a/src/infrastructure/diff/PhabricatorDiffScopeEngine.php b/src/infrastructure/diff/PhabricatorDiffScopeEngine.php --- a/src/infrastructure/diff/PhabricatorDiffScopeEngine.php +++ b/src/infrastructure/diff/PhabricatorDiffScopeEngine.php @@ -97,7 +97,7 @@ // Reject lines which begin with "}" or "{". These lines are probably // never good matches. - if (preg_match('/^\s*[{}]/i', $line_text)) { + if (@preg_match('/^\s*[{}]/i', $line_text)) { continue; } @@ -131,10 +131,10 @@ continue; } - $len = strlen($line_text); + $len = @strlen($line_text); // If the line has no actual text, don't assign it a depth. - if (!$len || !strlen(trim($line_text))) { + if (!$len || !@strlen(trim($line_text))) { $depth_map[$line_number] = null; continue; } diff --git a/src/infrastructure/diff/PhabricatorDifferenceEngine.php b/src/infrastructure/diff/PhabricatorDifferenceEngine.php --- a/src/infrastructure/diff/PhabricatorDifferenceEngine.php +++ b/src/infrastructure/diff/PhabricatorDifferenceEngine.php @@ -105,7 +105,7 @@ // instead of being forced to just say "this file didn't change" since we // don't have the content. - $entire_file = explode("\n", $old); + $entire_file = @explode("\n", $old); foreach ($entire_file as $k => $line) { $entire_file[$k] = ' '.$line; } @@ -185,13 +185,13 @@ $str = $str->getHTMLContent(); } - $n = strlen($str); + $n = @strlen($str); for ($i = 0; $i < $n; $i++) { if ($p == $e) { do { if (empty($intra_stack)) { - $buf .= substr($str, $i); + $buf .= @substr($str, $i); break 2; } $stack = array_shift($intra_stack); diff --git a/src/infrastructure/diff/inline/PhabricatorDiffInlineCommentContentState.php b/src/infrastructure/diff/inline/PhabricatorDiffInlineCommentContentState.php --- a/src/infrastructure/diff/inline/PhabricatorDiffInlineCommentContentState.php +++ b/src/infrastructure/diff/inline/PhabricatorDiffInlineCommentContentState.php @@ -12,7 +12,7 @@ } if ($this->getContentHasSuggestion()) { - if (strlen($this->getContentSuggestionText())) { + if (@strlen($this->getContentSuggestionText())) { return false; } } diff --git a/src/infrastructure/diff/inline/PhabricatorInlineCommentContentState.php b/src/infrastructure/diff/inline/PhabricatorInlineCommentContentState.php --- a/src/infrastructure/diff/inline/PhabricatorInlineCommentContentState.php +++ b/src/infrastructure/diff/inline/PhabricatorInlineCommentContentState.php @@ -15,7 +15,7 @@ } public function isEmptyContentState() { - return !strlen($this->getContentText()); + return !@strlen($this->getContentText()); } public function writeStorageMap() { diff --git a/src/infrastructure/diff/prose/PhutilProseDiff.php b/src/infrastructure/diff/prose/PhutilProseDiff.php --- a/src/infrastructure/diff/prose/PhutilProseDiff.php +++ b/src/infrastructure/diff/prose/PhutilProseDiff.php @@ -174,8 +174,8 @@ $o_text = $o_merge['text']; $n_text = $n_merge['text']; - $o_len = strlen($o_text); - $n_len = strlen($n_text); + $o_len = @strlen($o_text); + $n_len = @strlen($n_text); $min_len = min($o_len, $n_len); $prefix_len = 0; @@ -209,14 +209,14 @@ if ($prefix_len) { $results[] = array( 'type' => '=', - 'text' => substr($o_text, 0, $prefix_len), + 'text' => @substr($o_text, 0, $prefix_len), ); } if ($prefix_len < $o_len) { $results[] = array( 'type' => '-', - 'text' => substr( + 'text' => @substr( $o_text, $prefix_len, $o_len - $prefix_len - $suffix_len), @@ -226,7 +226,7 @@ if ($prefix_len < $n_len) { $results[] = array( 'type' => '+', - 'text' => substr( + 'text' => @substr( $n_text, $prefix_len, $n_len - $prefix_len - $suffix_len), @@ -236,7 +236,7 @@ if ($suffix_len) { $results[] = array( 'type' => '=', - 'text' => substr($o_text, -$suffix_len), + 'text' => @substr($o_text, -$suffix_len), ); } @@ -266,23 +266,23 @@ private function splitTextForSummary($text) { $matches = null; - $ok = preg_match('/^(\n*[^\n]+)\n/', $text, $matches); + $ok = @preg_match('/^(\n*[^\n]+)\n/', $text, $matches); if (!$ok) { return array($text); } $head = $matches[1]; - $text = substr($text, strlen($head)); + $text = @substr($text, @strlen($head)); - $ok = preg_match('/\n([^\n]+\n*)\z/', $text, $matches); + $ok = @preg_match('/\n([^\n]+\n*)\z/', $text, $matches); if (!$ok) { return array($text); } $last = $matches[1]; - $text = substr($text, 0, -strlen($last)); + $text = @substr($text, 0, -@strlen($last)); - if (!strlen(trim($text))) { + if (!@strlen(trim($text))) { return array($head, $last); } else { return array($head, $text, $last); diff --git a/src/infrastructure/diff/prose/PhutilProseDifferenceEngine.php b/src/infrastructure/diff/prose/PhutilProseDifferenceEngine.php --- a/src/infrastructure/diff/prose/PhutilProseDifferenceEngine.php +++ b/src/infrastructure/diff/prose/PhutilProseDifferenceEngine.php @@ -79,11 +79,11 @@ } else { $old = $block['old']; $new = $block['new']; - if (!strlen($old) && !strlen($new)) { + if (!@strlen($old) && !@strlen($new)) { // Nothing to do. - } else if (!strlen($old)) { + } else if (!@strlen($old)) { $result->addPart('+', $new); - } else if (!strlen($new)) { + } else if (!@strlen($new)) { $result->addPart('-', $old); } else { if ($too_large) { @@ -180,7 +180,7 @@ $v_pos = 0; $edits = $matrix->getEditString(); - $edits_length = strlen($edits); + $edits_length = @strlen($edits); $diff = new PhutilProseDiff(); for ($ii = 0; $ii < $edits_length; $ii++) { @@ -267,16 +267,16 @@ $parts = array(); - $length = strlen($input); + $length = @strlen($input); $corpus = ltrim($input); - $l_length = strlen($corpus); + $l_length = @strlen($corpus); if ($l_length !== $length) { - $parts[] = substr($input, 0, $length - $l_length); + $parts[] = @substr($input, 0, $length - $l_length); } $corpus = rtrim($corpus); - $lr_length = strlen($corpus); + $lr_length = @strlen($corpus); if ($lr_length) { $parts[] = $corpus; @@ -285,7 +285,7 @@ if ($lr_length !== $l_length) { // NOTE: This will be a negative value; we're slicing from the end of // the input string. - $parts[] = substr($input, $lr_length - $l_length); + $parts[] = @substr($input, $lr_length - $l_length); } return $parts; diff --git a/src/infrastructure/diff/query/PhabricatorDiffInlineCommentQuery.php b/src/infrastructure/diff/query/PhabricatorDiffInlineCommentQuery.php --- a/src/infrastructure/diff/query/PhabricatorDiffInlineCommentQuery.php +++ b/src/infrastructure/diff/query/PhabricatorDiffInlineCommentQuery.php @@ -370,7 +370,7 @@ continue; } - $saw_context = (strlen(trim($line)) > 3); + $saw_context = (@strlen(trim($line)) > 3); } if ($is_head) { diff --git a/src/infrastructure/diff/view/PHUIDiffGraphView.php b/src/infrastructure/diff/view/PHUIDiffGraphView.php --- a/src/infrastructure/diff/view/PHUIDiffGraphView.php +++ b/src/infrastructure/diff/view/PHUIDiffGraphView.php @@ -97,7 +97,7 @@ // Go back across all the lines we've already drawn and add a // "|" to the end, since this is connected to some future commit // we don't know about. - for ($jj = strlen($meta['line']); $jj <= $count; $jj++) { + for ($jj = @strlen($meta['line']); $jj <= $count; $jj++) { $graph[$k]['line'] .= '|'; } } @@ -158,7 +158,7 @@ $terminated = array(); foreach (array_reverse(array_keys($graph)) as $key) { $line = $graph[$key]['line']; - $len = strlen($line); + $len = @strlen($line); for ($ii = 0; $ii < $len; $ii++) { $c = $line[$ii]; if ($c == 'o') { diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php --- a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php +++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php @@ -526,13 +526,13 @@ $old_lines = $context->getBodyLines(); $old_lines = implode('', $old_lines); $old_lines = $head_lines.$old_lines.$tail_lines; - if (strlen($old_lines) && !preg_match('/\n\z/', $old_lines)) { + if (@strlen($old_lines) && !@preg_match('/\n\z/', $old_lines)) { $old_lines .= "\n"; } $new_lines = $content_state->getContentSuggestionText(); $new_lines = $head_lines.$new_lines.$tail_lines; - if (strlen($new_lines) && !preg_match('/\n\z/', $new_lines)) { + if (@strlen($new_lines) && !@preg_match('/\n\z/', $new_lines)) { $new_lines .= "\n"; } diff --git a/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php b/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php --- a/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php +++ b/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php @@ -139,7 +139,7 @@ $not_applicable = '-'; $coverage = $this->getCoverage(); - if (!strlen($coverage)) { + if (!@strlen($coverage)) { return $not_applicable; } @@ -157,7 +157,7 @@ $not_applicable = '-'; $coverage = $this->getCoverage(); - if (!strlen($coverage)) { + if (!@strlen($coverage)) { return $not_applicable; } diff --git a/src/infrastructure/diff/view/PHUIDiffTableOfContentsListView.php b/src/infrastructure/diff/view/PHUIDiffTableOfContentsListView.php --- a/src/infrastructure/diff/view/PHUIDiffTableOfContentsListView.php +++ b/src/infrastructure/diff/view/PHUIDiffTableOfContentsListView.php @@ -327,12 +327,12 @@ $edits = preg_replace('/(d+)(x+)/', '\2\1', $edits); $vector = array(); - $length = strlen($edits); + $length = @strlen($edits); $old_cursor = 0; $new_cursor = 0; - for ($ii = 0; $ii < strlen($edits); $ii++) { + for ($ii = 0; $ii < @strlen($edits); $ii++) { $c = $edits[$ii]; switch ($c) { case 'i': diff --git a/src/infrastructure/edges/query/PhabricatorEdgeObjectQuery.php b/src/infrastructure/edges/query/PhabricatorEdgeObjectQuery.php --- a/src/infrastructure/edges/query/PhabricatorEdgeObjectQuery.php +++ b/src/infrastructure/edges/query/PhabricatorEdgeObjectQuery.php @@ -169,14 +169,14 @@ } private function parseCursor($cursor) { - if (!preg_match('/^\d+_\d+\z/', $cursor)) { + if (!@preg_match('/^\d+_\d+\z/', $cursor)) { $this->throwCursorException( pht( 'Expected edge cursor in the form "0123_6789", got "%s".', $cursor)); } - return explode('_', $cursor); + return @explode('_', $cursor); } } diff --git a/src/infrastructure/editor/PhabricatorEditorURIEngine.php b/src/infrastructure/editor/PhabricatorEditorURIEngine.php --- a/src/infrastructure/editor/PhabricatorEditorURIEngine.php +++ b/src/infrastructure/editor/PhabricatorEditorURIEngine.php @@ -16,7 +16,7 @@ $pattern = $viewer->getUserSetting(PhabricatorEditorSetting::SETTINGKEY); - if (!strlen(trim($pattern))) { + if (!@strlen(trim($pattern))) { return null; } @@ -313,7 +313,7 @@ public static function newPatternTokens($raw_pattern) { $token_positions = array(); - $len = strlen($raw_pattern); + $len = @strlen($raw_pattern); for ($ii = 0; $ii < $len; $ii++) { $c = $raw_pattern[$ii]; @@ -344,7 +344,7 @@ if ($token_len > 0) { $tokens[] = array( 'type' => 'literal', - 'value' => substr($raw_pattern, $cursor, $token_len), + 'value' => @substr($raw_pattern, $cursor, $token_len), ); } @@ -353,7 +353,7 @@ if ($cursor < $len) { $tokens[] = array( 'type' => 'variable', - 'value' => substr($raw_pattern, $cursor + 1, 1), + 'value' => @substr($raw_pattern, $cursor + 1, 1), ); } diff --git a/src/infrastructure/env/PhabricatorEnv.php b/src/infrastructure/env/PhabricatorEnv.php --- a/src/infrastructure/env/PhabricatorEnv.php +++ b/src/infrastructure/env/PhabricatorEnv.php @@ -125,7 +125,7 @@ // If an instance identifier is defined, write it into the environment so // it's available to subprocesses. $instance = self::getEnvConfig('cluster.instance'); - if (strlen($instance)) { + if (@strlen($instance)) { putenv('PHABRICATOR_INSTANCE='.$instance); $_ENV['PHABRICATOR_INSTANCE'] = $instance; } @@ -432,7 +432,7 @@ $uri = new PhutilURI($raw_uri); $host = $uri->getDomain(); - if (!strlen($host)) { + if (!@strlen($host)) { return false; } @@ -455,7 +455,7 @@ $self_map = array(); foreach ($self_uris as $self_uri) { $host = id(new PhutilURI($self_uri))->getDomain(); - if (!strlen($host)) { + if (!@strlen($host)) { continue; } @@ -661,11 +661,11 @@ public static function isValidLocalURIForLink($uri) { $uri = (string)$uri; - if (!strlen($uri)) { + if (!@strlen($uri)) { return false; } - if (preg_match('/\s/', $uri)) { + if (@preg_match('/\s/', $uri)) { // PHP hasn't been vulnerable to header injection attacks for a bunch of // years, but we can safely reject these anyway since they're never valid. return false; @@ -682,14 +682,14 @@ // Since we currently never generate URIs with backslashes in them, reject // these unconditionally rather than trying to figure out how browsers will // interpret them. - if (preg_match('/\\\\/', $uri)) { + if (@preg_match('/\\\\/', $uri)) { return false; } // Valid URIs must begin with '/', followed by the end of the string or some // other non-'/' character. This rejects protocol-relative URIs like // "//evil.com/evil_stuff/". - return (bool)preg_match('@^/([^/]|$)@', $uri); + return (bool)@preg_match('@^/([^/]|$)@', $uri); } @@ -726,7 +726,7 @@ $uri = new PhutilURI($raw_uri); $proto = $uri->getProtocol(); - if (!strlen($proto)) { + if (!@strlen($proto)) { throw new Exception( pht( 'URI "%s" is not a valid linkable resource. A valid linkable '. @@ -745,7 +745,7 @@ } $domain = $uri->getDomain(); - if (!strlen($domain)) { + if (!@strlen($domain)) { throw new Exception( pht( 'URI "%s" is not a valid linkable resource. A valid linkable '. @@ -793,7 +793,7 @@ $uri = new PhutilURI($raw_uri); $proto = $uri->getProtocol(); - if (!strlen($proto)) { + if (!@strlen($proto)) { throw new Exception( pht( 'URI "%s" is not a valid fetchable resource. A valid fetchable '. @@ -812,7 +812,7 @@ } $domain = $uri->getDomain(); - if (!strlen($domain)) { + if (!@strlen($domain)) { throw new Exception( pht( 'URI "%s" is not a valid fetchable resource. A valid fetchable '. diff --git a/src/infrastructure/export/field/PhabricatorOptionExportField.php b/src/infrastructure/export/field/PhabricatorOptionExportField.php --- a/src/infrastructure/export/field/PhabricatorOptionExportField.php +++ b/src/infrastructure/export/field/PhabricatorOptionExportField.php @@ -19,7 +19,7 @@ return $value; } - if (!strlen($value)) { + if (!@strlen($value)) { return null; } diff --git a/src/infrastructure/export/field/PhabricatorStringExportField.php b/src/infrastructure/export/field/PhabricatorStringExportField.php --- a/src/infrastructure/export/field/PhabricatorStringExportField.php +++ b/src/infrastructure/export/field/PhabricatorStringExportField.php @@ -8,7 +8,7 @@ return $value; } - if (!strlen($value)) { + if (!@strlen($value)) { return null; } diff --git a/src/infrastructure/export/format/PhabricatorCSVExportFormat.php b/src/infrastructure/export/format/PhabricatorCSVExportFormat.php --- a/src/infrastructure/export/format/PhabricatorCSVExportFormat.php +++ b/src/infrastructure/export/format/PhabricatorCSVExportFormat.php @@ -48,11 +48,11 @@ // like it might be too tempting for Excel to ignore, mangle the value // to dissuade remote code execution. See T12800. - if (preg_match('/^\s*[+=@-]/', $value)) { + if (@preg_match('/^\s*[+=@-]/', $value)) { $value = '(!) '.$value; } - if (preg_match('/\s|,|\"/', $value)) { + if (@preg_match('/\s|,|\"/', $value)) { $value = str_replace('"', '""', $value); $value = '"'.$value.'"'; } diff --git a/src/infrastructure/javelin/markup.php b/src/infrastructure/javelin/markup.php --- a/src/infrastructure/javelin/markup.php +++ b/src/infrastructure/javelin/markup.php @@ -77,7 +77,7 @@ $is_post = (strcasecmp($http_method, 'POST') === 0); $http_action = idx($attributes, 'action'); - $is_absolute_uri = preg_match('#^(https?:|//)#', $http_action); + $is_absolute_uri = @preg_match('#^(https?:|//)#', $http_action); if ($is_post) { diff --git a/src/infrastructure/lint/linter/PhabricatorJavelinLinter.php b/src/infrastructure/lint/linter/PhabricatorJavelinLinter.php --- a/src/infrastructure/lint/linter/PhabricatorJavelinLinter.php +++ b/src/infrastructure/lint/linter/PhabricatorJavelinLinter.php @@ -98,7 +98,7 @@ } private function shouldIgnorePath($path) { - return preg_match('@/__tests__/|externals/javelin/docs/@', $path); + return @preg_match('@/__tests__/|externals/javelin/docs/@', $path); } public function lintPath($path) { @@ -127,7 +127,7 @@ list($uses, $installs) = $this->getUsedAndInstalledSymbolsForPath($path); foreach ($uses as $symbol => $line) { - $parts = explode('.', $symbol); + $parts = @explode('.', $symbol); foreach ($parts as $part) { if ($part[0] == '_' && $part[1] != '_') { $base = implode('.', array_slice($parts, 0, 2)); @@ -149,7 +149,7 @@ $external_classes = array(); foreach ($uses as $symbol => $line) { - $parts = explode('.', $symbol); + $parts = @explode('.', $symbol); $class = implode('.', array_slice($parts, 0, 2)); if (!array_key_exists($class, $external_classes) && !array_key_exists($class, $installs)) { @@ -165,7 +165,7 @@ $path); $need = $external_classes; - $resource_name = substr($path, strlen('webroot/')); + $resource_name = @substr($path, @strlen('webroot/')); $requires = $celerity->getRequiredSymbolsForName($resource_name); if (!$requires) { $requires = array(); @@ -187,7 +187,7 @@ continue; } - if (preg_match('/\\.css$/', $requires_name)) { + if (@preg_match('/\\.css$/', $requires_name)) { // If JS requires CSS, just assume everything is fine. unset($requires[$key]); } else { @@ -248,10 +248,10 @@ return array($uses, $installs); } - $symbols = explode("\n", trim($symbols)); + $symbols = @explode("\n", trim($symbols)); foreach ($symbols as $line) { $matches = null; - if (!preg_match('/^([?+\*])([^:]*):(\d+)$/', $line, $matches)) { + if (!@preg_match('/^([?+\*])([^:]*):(\d+)$/', $line, $matches)) { throw new Exception( pht('Received malformed output from `%s`.', 'javelinsymbols')); } diff --git a/src/infrastructure/lipsum/PhutilContextFreeGrammar.php b/src/infrastructure/lipsum/PhutilContextFreeGrammar.php --- a/src/infrastructure/lipsum/PhutilContextFreeGrammar.php +++ b/src/infrastructure/lipsum/PhutilContextFreeGrammar.php @@ -33,13 +33,13 @@ foreach (array_reverse($matches[1]) as $token_spec) { list($token, $offset) = $token_spec; - $token_name = substr($token, 1, -1); + $token_name = @substr($token, 1, -1); $options = array(); - if (($name_end = strpos($token_name, ','))) { + if (($name_end = @strpos($token_name, ','))) { $options_parser = new PhutilSimpleOptions(); $options = $options_parser->parse($token_name); - $token_name = substr($token_name, 0, $name_end); + $token_name = @substr($token_name, 0, $name_end); } if (empty($rules[$token_name])) { @@ -75,7 +75,7 @@ $replacement = "\n".$replacement."\n"; } - $input = substr_replace($input, $replacement, $offset, strlen($token)); + $input = substr_replace($input, $replacement, $offset, @strlen($token)); } return $input; diff --git a/src/infrastructure/log/PhabricatorProtocolLog.php b/src/infrastructure/log/PhabricatorProtocolLog.php --- a/src/infrastructure/log/PhabricatorProtocolLog.php +++ b/src/infrastructure/log/PhabricatorProtocolLog.php @@ -24,7 +24,7 @@ } public function didWriteBytes($bytes) { - if (!strlen($bytes)) { + if (!@strlen($bytes)) { return; } @@ -33,7 +33,7 @@ } public function didReadBytes($bytes) { - if (!strlen($bytes)) { + if (!@strlen($bytes)) { return; } @@ -52,7 +52,7 @@ private function writeFrame($header, $frame) { $this->flush(); - $frame = explode("\n", $frame); + $frame = @explode("\n", $frame); foreach ($frame as $key => $line) { $frame[$key] = $header.' '.$this->escapeBytes($line); } @@ -84,14 +84,14 @@ $bytes = implode('', $bytes); - if (strlen($bytes)) { + if (@strlen($bytes)) { $this->writeBytes($mode, $bytes); } } private function writeBytes($mode, $bytes) { $header = $mode; - $len = strlen($bytes); + $len = @strlen($bytes); $out = array(); switch ($mode) { @@ -151,20 +151,20 @@ $pos = 0; $lines = array(); while (true) { - $next_break = strpos($bytes, "\n", $pos); + $next_break = @strpos($bytes, "\n", $pos); if ($next_break === false) { - $len = strlen($bytes) - $pos; + $len = @strlen($bytes) - $pos; } else { $len = ($next_break - $pos) + 1; } $len = min($bytes_per_line, $len); - $next_bytes = substr($bytes, $pos, $len); + $next_bytes = @substr($bytes, $pos, $len); $chunk_parts = array(); foreach (str_split($next_bytes, $bytes_per_chunk) as $chunk) { $chunk_display = ''; - for ($ii = 0; $ii < strlen($chunk); $ii++) { + for ($ii = 0; $ii < @strlen($chunk); $ii++) { $chunk_display .= sprintf('%02x', ord($chunk[$ii])); } $chunk_parts[] = $chunk_display; @@ -178,7 +178,7 @@ $pos += $len; - if ($pos >= strlen($bytes)) { + if ($pos >= @strlen($bytes)) { break; } } @@ -190,7 +190,7 @@ private function escapeBytes($bytes) { $result = ''; - for ($ii = 0; $ii < strlen($bytes); $ii++) { + for ($ii = 0; $ii < @strlen($bytes); $ii++) { $c = $bytes[$ii]; $o = ord($c); diff --git a/src/infrastructure/log/PhabricatorSSHLog.php b/src/infrastructure/log/PhabricatorSSHLog.php --- a/src/infrastructure/log/PhabricatorSSHLog.php +++ b/src/infrastructure/log/PhabricatorSSHLog.php @@ -24,7 +24,7 @@ ); $sudo_user = PhabricatorEnv::getEnvConfig('phd.user'); - if (strlen($sudo_user)) { + if (@strlen($sudo_user)) { $data['S'] = $sudo_user; } @@ -35,8 +35,8 @@ } $client = getenv('SSH_CLIENT'); - if (strlen($client)) { - $remote_address = head(explode(' ', $client)); + if (@strlen($client)) { + $remote_address = head(@explode(' ', $client)); $data['r'] = $remote_address; } diff --git a/src/infrastructure/management/PhabricatorManagementWorkflow.php b/src/infrastructure/management/PhabricatorManagementWorkflow.php --- a/src/infrastructure/management/PhabricatorManagementWorkflow.php +++ b/src/infrastructure/management/PhabricatorManagementWorkflow.php @@ -14,7 +14,7 @@ } protected function parseTimeArgument($time) { - if (!strlen($time)) { + if (!@strlen($time)) { return null; } @@ -86,8 +86,8 @@ } // If the value is "@..." and then some text, treat it as a username. - if ((strlen($identifier) > 1) && ($identifier[0] == '@')) { - $usernames[$identifier] = substr($identifier, 1); + if ((@strlen($identifier) > 1) && ($identifier[0] == '@')) { + $usernames[$identifier] = @substr($identifier, 1); continue; } diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php --- a/src/infrastructure/markup/PhabricatorMarkupEngine.php +++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php @@ -662,12 +662,12 @@ // distinguish standard paragraphs from things like image macros. It may // not work well for non-latin text. We prefer to summarize with a // paragraph of normal words over an image macro, if possible. - $has_space = preg_match('/\w\s\w/', $block); + $has_space = @preg_match('/\w\s\w/', $block); // This is a test to find embedded images and headers. We prefer to // summarize with a normal paragraph over a header or an embedded object, // if possible. - $has_embed = preg_match('/^[{=]/', $block); + $has_embed = @preg_match('/^[{=]/', $block); if ($has_space && !$has_embed) { // This seems like a good summary, so return it. diff --git a/src/infrastructure/markup/PhutilRemarkupBlockStorage.php b/src/infrastructure/markup/PhutilRemarkupBlockStorage.php --- a/src/infrastructure/markup/PhutilRemarkupBlockStorage.php +++ b/src/infrastructure/markup/PhutilRemarkupBlockStorage.php @@ -82,7 +82,7 @@ // If the content contains no token magic, we don't need to replace // anything. - if (strpos($content, self::MAGIC_BYTE) === false) { + if (@strpos($content, self::MAGIC_BYTE) === false) { continue; } @@ -133,18 +133,18 @@ // If there were any non-token bytes since the last token, add them. if ($subpos > $pos) { - $parts[] = substr($content, $pos, $subpos - $pos); + $parts[] = @substr($content, $pos, $subpos - $pos); } // Add the token replacement text. $parts[] = $map[$subkey]; // Move the non-token cursor forward over the token. - $pos = $subpos + strlen($subkey); + $pos = $subpos + @strlen($subkey); } // Add any leftover non-token bytes after the last token. - $parts[] = substr($content, $pos); + $parts[] = @substr($content, $pos); $content = implode('', $parts); diff --git a/src/infrastructure/markup/blockrule/PhutilRemarkupBlockRule.php b/src/infrastructure/markup/blockrule/PhutilRemarkupBlockRule.php --- a/src/infrastructure/markup/blockrule/PhutilRemarkupBlockRule.php +++ b/src/infrastructure/markup/blockrule/PhutilRemarkupBlockRule.php @@ -102,7 +102,7 @@ foreach ($out_rows as $r => $row) { foreach ($row['content'] as $c => $cell) { $text = $this->getEngine()->restoreText($cell['content']); - $lengths[$c][$r] = phutil_utf8_strlen($text); + $lengths[$c][$r] = phutil_utf8strlen($text); } } $max_lengths = array_map('max', $lengths); diff --git a/src/infrastructure/markup/blockrule/PhutilRemarkupCodeBlockRule.php b/src/infrastructure/markup/blockrule/PhutilRemarkupCodeBlockRule.php --- a/src/infrastructure/markup/blockrule/PhutilRemarkupCodeBlockRule.php +++ b/src/infrastructure/markup/blockrule/PhutilRemarkupCodeBlockRule.php @@ -5,9 +5,9 @@ public function getMatchingLineCount(array $lines, $cursor) { $num_lines = 0; $match_ticks = null; - if (preg_match('/^(\s{2,}).+/', $lines[$cursor])) { + if (@preg_match('/^(\s{2,}).+/', $lines[$cursor])) { $match_ticks = false; - } else if (preg_match('/^\s*(```)/', $lines[$cursor])) { + } else if (@preg_match('/^\s*(```)/', $lines[$cursor])) { $match_ticks = true; } else { return $num_lines; @@ -16,7 +16,7 @@ $num_lines++; if ($match_ticks && - preg_match('/^\s*(```)(.*)(```)\s*$/', $lines[$cursor])) { + @preg_match('/^\s*(```)(.*)(```)\s*$/', $lines[$cursor])) { return $num_lines; } @@ -24,14 +24,14 @@ while (isset($lines[$cursor])) { if ($match_ticks) { - if (preg_match('/```\s*$/', $lines[$cursor])) { + if (@preg_match('/```\s*$/', $lines[$cursor])) { $num_lines++; break; } $num_lines++; } else { - if (strlen(trim($lines[$cursor]))) { - if (!preg_match('/^\s{2,}/', $lines[$cursor])) { + if (@strlen(trim($lines[$cursor]))) { + if (!@preg_match('/^\s{2,}/', $lines[$cursor])) { break; } } @@ -44,15 +44,15 @@ } public function markupText($text, $children) { - if (preg_match('/^\s*```/', $text)) { + if (@preg_match('/^\s*```/', $text)) { // If this is a ```-style block, trim off the backticks and any leading // blank line. $text = preg_replace('/^\s*```(\s*\n)?/', '', $text); $text = preg_replace('/```\s*$/', '', $text); } - $lines = explode("\n", $text); - while ($lines && !strlen(last($lines))) { + $lines = @explode("\n", $text); + while ($lines && !@strlen(last($lines))) { unset($lines[last_key($lines)]); } @@ -82,7 +82,7 @@ // Normalize the text back to a 0-level indent. $min_indent = 80; foreach ($lines as $line) { - for ($ii = 0; $ii < strlen($line); $ii++) { + for ($ii = 0; $ii < @strlen($line); $ii++) { if ($line[$ii] != ' ') { $min_indent = min($ii, $min_indent); break; diff --git a/src/infrastructure/markup/blockrule/PhutilRemarkupDefaultBlockRule.php b/src/infrastructure/markup/blockrule/PhutilRemarkupDefaultBlockRule.php --- a/src/infrastructure/markup/blockrule/PhutilRemarkupDefaultBlockRule.php +++ b/src/infrastructure/markup/blockrule/PhutilRemarkupDefaultBlockRule.php @@ -27,7 +27,7 @@ $text = phutil_escape_html_newlines($text); } - if (!strlen($text)) { + if (!@strlen($text)) { return null; } diff --git a/src/infrastructure/markup/blockrule/PhutilRemarkupHeaderBlockRule.php b/src/infrastructure/markup/blockrule/PhutilRemarkupHeaderBlockRule.php --- a/src/infrastructure/markup/blockrule/PhutilRemarkupHeaderBlockRule.php +++ b/src/infrastructure/markup/blockrule/PhutilRemarkupHeaderBlockRule.php @@ -4,12 +4,12 @@ public function getMatchingLineCount(array $lines, $cursor) { $num_lines = 0; - if (preg_match('/^(={1,5}|#{2,5}|# ).*+$/', $lines[$cursor])) { + if (@preg_match('/^(={1,5}|#{2,5}|# ).*+$/', $lines[$cursor])) { $num_lines = 1; } else { if (isset($lines[$cursor + 1])) { $line = $lines[$cursor].$lines[$cursor + 1]; - if (preg_match('/^([^\n]+)\n[-=]{2,}\s*$/', $line)) { + if (@preg_match('/^([^\n]+)\n[-=]{2,}\s*$/', $line)) { $num_lines = 2; $cursor++; } @@ -18,7 +18,7 @@ if ($num_lines) { $cursor++; - while (isset($lines[$cursor]) && !strlen(trim($lines[$cursor]))) { + while (isset($lines[$cursor]) && !@strlen(trim($lines[$cursor]))) { $num_lines++; $cursor++; } @@ -38,7 +38,7 @@ $text = trim($lines[0]); } else { $level = 0; - for ($ii = 0; $ii < min(5, strlen($text)); $ii++) { + for ($ii = 0; $ii < min(5, @strlen($text)); $ii++) { if ($text[$ii] == '=' || $text[$ii] == '#') { ++$level; } else { @@ -52,7 +52,7 @@ if ($engine->isTextMode()) { $char = ($level == 1) ? '=' : '-'; - return $text."\n".str_repeat($char, phutil_utf8_strlen($text)); + return $text."\n".str_repeat($char, phutil_utf8strlen($text)); } $use_anchors = $engine->getConfig('header.generate-toc'); @@ -90,7 +90,7 @@ $anchor = self::getAnchorNameFromHeaderText($plain_text); - if (!strlen($anchor)) { + if (!@strlen($anchor)) { return null; } diff --git a/src/infrastructure/markup/blockrule/PhutilRemarkupHorizontalRuleBlockRule.php b/src/infrastructure/markup/blockrule/PhutilRemarkupHorizontalRuleBlockRule.php --- a/src/infrastructure/markup/blockrule/PhutilRemarkupHorizontalRuleBlockRule.php +++ b/src/infrastructure/markup/blockrule/PhutilRemarkupHorizontalRuleBlockRule.php @@ -14,10 +14,10 @@ public function getMatchingLineCount(array $lines, $cursor) { $num_lines = 0; $pattern = '/^\s*(?:_{3,}|\*\s?\*\s?\*(\s|\*)*|\-\s?\-\s?\-(\s|\-)*)$/'; - if (preg_match($pattern, rtrim($lines[$cursor], "\n\r"))) { + if (@preg_match($pattern, rtrim($lines[$cursor], "\n\r"))) { $num_lines++; $cursor++; - while (isset($lines[$cursor]) && !strlen(trim($lines[$cursor]))) { + while (isset($lines[$cursor]) && !@strlen(trim($lines[$cursor]))) { $num_lines++; $cursor++; } diff --git a/src/infrastructure/markup/blockrule/PhutilRemarkupInterpreterBlockRule.php b/src/infrastructure/markup/blockrule/PhutilRemarkupInterpreterBlockRule.php --- a/src/infrastructure/markup/blockrule/PhutilRemarkupInterpreterBlockRule.php +++ b/src/infrastructure/markup/blockrule/PhutilRemarkupInterpreterBlockRule.php @@ -8,11 +8,11 @@ public function getMatchingLineCount(array $lines, $cursor) { $num_lines = 0; - if (preg_match(self::START_BLOCK_PATTERN, $lines[$cursor])) { + if (@preg_match(self::START_BLOCK_PATTERN, $lines[$cursor])) { $num_lines++; while (isset($lines[$cursor])) { - if (preg_match(self::END_BLOCK_PATTERN, $lines[$cursor])) { + if (@preg_match(self::END_BLOCK_PATTERN, $lines[$cursor])) { break; } $num_lines++; @@ -24,7 +24,7 @@ } public function markupText($text, $children) { - $lines = explode("\n", $text); + $lines = @explode("\n", $text); $first_key = head_key($lines); $last_key = last_key($lines); while (trim($lines[$last_key]) === '') { @@ -33,7 +33,7 @@ } $matches = null; - preg_match(self::START_BLOCK_PATTERN, head($lines), $matches); + @preg_match(self::START_BLOCK_PATTERN, head($lines), $matches); $argv = array(); if (isset($matches[2])) { diff --git a/src/infrastructure/markup/blockrule/PhutilRemarkupListBlockRule.php b/src/infrastructure/markup/blockrule/PhutilRemarkupListBlockRule.php --- a/src/infrastructure/markup/blockrule/PhutilRemarkupListBlockRule.php +++ b/src/infrastructure/markup/blockrule/PhutilRemarkupListBlockRule.php @@ -17,14 +17,14 @@ $is_one_line = false; while (isset($lines[$cursor])) { if (!$num_lines) { - if (preg_match(self::START_BLOCK_PATTERN, $lines[$cursor])) { + if (@preg_match(self::START_BLOCK_PATTERN, $lines[$cursor])) { $num_lines++; $cursor++; $is_one_line = true; continue; } } else { - if (preg_match(self::CONT_BLOCK_PATTERN, $lines[$cursor])) { + if (@preg_match(self::CONT_BLOCK_PATTERN, $lines[$cursor])) { $num_lines++; $cursor++; $is_one_line = false; @@ -34,14 +34,14 @@ // Allow lists to continue across multiple paragraphs, as long as lines // are indented or a single empty line separates indented lines. - $this_empty = !strlen(trim($lines[$cursor])); - $this_indented = preg_match('/^ /', $lines[$cursor]); + $this_empty = !@strlen(trim($lines[$cursor])); + $this_indented = @preg_match('/^ /', $lines[$cursor]); $next_empty = true; $next_indented = false; if (isset($lines[$cursor + 1])) { - $next_empty = !strlen(trim($lines[$cursor + 1])); - $next_indented = preg_match('/^ /', $lines[$cursor + 1]); + $next_empty = !@strlen(trim($lines[$cursor + 1])); + $next_indented = @preg_match('/^ /', $lines[$cursor + 1]); } if ($this_empty || $this_indented) { @@ -87,7 +87,7 @@ public function markupText($text, $children) { $items = array(); - $lines = explode("\n", $text); + $lines = @explode("\n", $text); // We allow users to delimit lists using either differing indentation // levels: @@ -109,10 +109,10 @@ $min_space = PHP_INT_MAX; foreach ($lines as $ii => $line) { $matches = null; - if (preg_match($regex, $line)) { + if (@preg_match($regex, $line)) { $regex = self::CONT_BLOCK_PATTERN; - if (preg_match('/^(\s+)/', $line, $matches)) { - $space = strlen($matches[1]); + if (@preg_match('/^(\s+)/', $line, $matches)) { + $space = @strlen($matches[1]); } else { $space = 0; } @@ -123,9 +123,9 @@ $regex = self::START_BLOCK_PATTERN; if ($min_space) { foreach ($lines as $key => $line) { - if (preg_match($regex, $line)) { + if (@preg_match($regex, $line)) { $regex = self::CONT_BLOCK_PATTERN; - $lines[$key] = substr($line, $min_space); + $lines[$key] = @substr($line, $min_space); } } } @@ -155,7 +155,7 @@ $regex = self::START_BLOCK_PATTERN; foreach ($lines as $line) { $match = null; - if (preg_match($regex, $line, $match)) { + if (@preg_match($regex, $line, $match)) { if (!$starts_at && !empty($match[1])) { $starts_at = $match[1]; } @@ -208,23 +208,23 @@ $item = rtrim($item); - if (!strlen($item)) { + if (!@strlen($item)) { unset($items[$key]); continue; } $matches = null; - if (preg_match('/^\s*([-*#]{2,})/', $item, $matches)) { + if (@preg_match('/^\s*([-*#]{2,})/', $item, $matches)) { // Alternate-style indents; use number of list item symbols. - $depth = strlen($matches[1]) - 1; - } else if (preg_match('/^(\s+)/', $item, $matches)) { + $depth = @strlen($matches[1]) - 1; + } else if (@preg_match('/^(\s+)/', $item, $matches)) { // Markdown-style indents; use indent depth. - $depth = strlen($matches[1]); + $depth = @strlen($matches[1]); } else { $depth = 0; } - if (preg_match('/^\s*(?:#|[0-9])/', $item)) { + if (@preg_match('/^\s*(?:#|[0-9])/', $item)) { $style = '#'; } else { $style = '-'; @@ -238,14 +238,14 @@ // are often used as footnotes. $mark = null; $matches = null; - if (preg_match('/^\s*\[(\D?)\]\s*/', $text, $matches)) { - if (strlen(trim($matches[1]))) { + if (@preg_match('/^\s*\[(\D?)\]\s*/', $text, $matches)) { + if (@strlen(trim($matches[1]))) { $mark = true; } else { $mark = false; } $has_marks = true; - $text = substr($text, strlen($matches[0])); + $text = @substr($text, @strlen($matches[0])); } $items[$key] = array( diff --git a/src/infrastructure/markup/blockrule/PhutilRemarkupLiteralBlockRule.php b/src/infrastructure/markup/blockrule/PhutilRemarkupLiteralBlockRule.php --- a/src/infrastructure/markup/blockrule/PhutilRemarkupLiteralBlockRule.php +++ b/src/infrastructure/markup/blockrule/PhutilRemarkupLiteralBlockRule.php @@ -26,7 +26,7 @@ $end_pattern = '(%%%\s*$)'; $trivial_pattern = '(^\s*%%%\s*$)'; - if (!preg_match($start_pattern, $lines[$cursor])) { + if (!@preg_match($start_pattern, $lines[$cursor])) { return 0; } @@ -42,7 +42,7 @@ $line = $lines[$cursor]; if ($block_start === null) { - $is_start = preg_match($start_pattern, $line); + $is_start = @preg_match($start_pattern, $line); // If we've matched a block and then consumed one or more empty lines // after it, stop merging more blocks into the match. @@ -56,12 +56,12 @@ } if ($block_start !== null) { - $is_end = preg_match($end_pattern, $line); + $is_end = @preg_match($end_pattern, $line); // If a line contains only "%%%", it will match both the start and // end patterns, but it only counts as a block start. if ($is_end && ($cursor === $block_start)) { - $is_trivial = preg_match($trivial_pattern, $line); + $is_trivial = @preg_match($trivial_pattern, $line); if ($is_trivial) { $is_end = false; } @@ -75,7 +75,7 @@ } if ($block_start === null) { - if (strlen(trim($line))) { + if (@strlen(trim($line))) { break; } $found_empty = true; diff --git a/src/infrastructure/markup/blockrule/PhutilRemarkupNoteBlockRule.php b/src/infrastructure/markup/blockrule/PhutilRemarkupNoteBlockRule.php --- a/src/infrastructure/markup/blockrule/PhutilRemarkupNoteBlockRule.php +++ b/src/infrastructure/markup/blockrule/PhutilRemarkupNoteBlockRule.php @@ -5,7 +5,7 @@ public function getMatchingLineCount(array $lines, $cursor) { $num_lines = 0; - if (preg_match($this->getRegEx(), $lines[$cursor])) { + if (@preg_match($this->getRegEx(), $lines[$cursor])) { $num_lines++; $cursor++; @@ -24,7 +24,7 @@ public function markupText($text, $children) { $matches = array(); - preg_match($this->getRegEx(), $text, $matches); + @preg_match($this->getRegEx(), $text, $matches); if (idx($matches, 'showword')) { $word = $matches['showword']; @@ -37,10 +37,10 @@ $class_suffix = phutil_utf8_strtolower($word); // This is the "(IMPORTANT)" or "NOTE:" part. - $word_part = rtrim(substr($text, 0, strlen($matches[0]))); + $word_part = rtrim(@substr($text, 0, @strlen($matches[0]))); // This is the actual text. - $text_part = substr($text, strlen($matches[0])); + $text_part = @substr($text, @strlen($matches[0])); $text_part = $this->applyRules(rtrim($text_part)); $text_mode = $this->getEngine()->isTextMode(); diff --git a/src/infrastructure/markup/blockrule/PhutilRemarkupQuotedBlockRule.php b/src/infrastructure/markup/blockrule/PhutilRemarkupQuotedBlockRule.php --- a/src/infrastructure/markup/blockrule/PhutilRemarkupQuotedBlockRule.php +++ b/src/infrastructure/markup/blockrule/PhutilRemarkupQuotedBlockRule.php @@ -10,7 +10,7 @@ final protected function normalizeQuotedBody($text) { $text = phutil_split_lines($text, true); foreach ($text as $key => $line) { - $text[$key] = substr($line, 1); + $text[$key] = @substr($line, 1); } // If every line in the block is empty or begins with at least one leading @@ -21,7 +21,7 @@ $strip_space = true; foreach ($text as $key => $line) { - $len = strlen($line); + $len = @strlen($line); if (!$len) { // We'll still strip spaces if there are some completely empty @@ -49,7 +49,7 @@ if ($strip_space) { foreach ($text as $key => $line) { - $len = strlen($line); + $len = @strlen($line); if (!$len) { continue; } @@ -58,13 +58,13 @@ continue; } - $text[$key] = substr($line, 1); + $text[$key] = @substr($line, 1); } } // Strip leading empty lines. foreach ($text as $key => $line) { - if (!strlen(trim($line))) { + if (!@strlen(trim($line))) { unset($text[$key]); } else { break; diff --git a/src/infrastructure/markup/blockrule/PhutilRemarkupQuotesBlockRule.php b/src/infrastructure/markup/blockrule/PhutilRemarkupQuotesBlockRule.php --- a/src/infrastructure/markup/blockrule/PhutilRemarkupQuotesBlockRule.php +++ b/src/infrastructure/markup/blockrule/PhutilRemarkupQuotesBlockRule.php @@ -6,10 +6,10 @@ public function getMatchingLineCount(array $lines, $cursor) { $pos = $cursor; - if (preg_match('/^>/', $lines[$pos])) { + if (@preg_match('/^>/', $lines[$pos])) { do { ++$pos; - } while (isset($lines[$pos]) && preg_match('/^>/', $lines[$pos])); + } while (isset($lines[$pos]) && @preg_match('/^>/', $lines[$pos])); } return ($pos - $cursor); diff --git a/src/infrastructure/markup/blockrule/PhutilRemarkupReplyBlockRule.php b/src/infrastructure/markup/blockrule/PhutilRemarkupReplyBlockRule.php --- a/src/infrastructure/markup/blockrule/PhutilRemarkupReplyBlockRule.php +++ b/src/infrastructure/markup/blockrule/PhutilRemarkupReplyBlockRule.php @@ -10,10 +10,10 @@ public function getMatchingLineCount(array $lines, $cursor) { $pos = $cursor; - if (preg_match('/^>>!/', $lines[$pos])) { + if (@preg_match('/^>>!/', $lines[$pos])) { do { ++$pos; - } while (isset($lines[$pos]) && preg_match('/^>/', $lines[$pos])); + } while (isset($lines[$pos]) && @preg_match('/^>/', $lines[$pos])); } return ($pos - $cursor); @@ -22,7 +22,7 @@ public function extractChildText($text) { $text = phutil_split_lines($text, true); - $head = substr(reset($text), 3); + $head = @substr(reset($text), 3); $body = array_slice($text, 1); $body = implode('', $body); diff --git a/src/infrastructure/markup/blockrule/PhutilRemarkupSimpleTableBlockRule.php b/src/infrastructure/markup/blockrule/PhutilRemarkupSimpleTableBlockRule.php --- a/src/infrastructure/markup/blockrule/PhutilRemarkupSimpleTableBlockRule.php +++ b/src/infrastructure/markup/blockrule/PhutilRemarkupSimpleTableBlockRule.php @@ -5,7 +5,7 @@ public function getMatchingLineCount(array $lines, $cursor) { $num_lines = 0; while (isset($lines[$cursor])) { - if (preg_match('/^(\s*\|.*+\n?)+$/', $lines[$cursor])) { + if (@preg_match('/^(\s*\|.*+\n?)+$/', $lines[$cursor])) { $num_lines++; $cursor++; } else { @@ -20,7 +20,7 @@ $matches = array(); $rows = array(); - foreach (explode("\n", $text) as $line) { + foreach (@explode("\n", $text) as $line) { // Ignore ending delimiters. $line = rtrim($line, '|'); @@ -54,8 +54,8 @@ // If it has only empty cells, it's an empty row. - if (strlen($cell)) { - if (preg_match('/^--+\z/', $cell)) { + if (@strlen($cell)) { + if (@preg_match('/^--+\z/', $cell)) { $any_header = true; } else { $any_content = true; diff --git a/src/infrastructure/markup/blockrule/PhutilRemarkupTableBlockRule.php b/src/infrastructure/markup/blockrule/PhutilRemarkupTableBlockRule.php --- a/src/infrastructure/markup/blockrule/PhutilRemarkupTableBlockRule.php +++ b/src/infrastructure/markup/blockrule/PhutilRemarkupTableBlockRule.php @@ -5,13 +5,13 @@ public function getMatchingLineCount(array $lines, $cursor) { $num_lines = 0; - if (preg_match('/^\s*/i', $lines[$cursor])) { + if (@preg_match('/^\s*
/i', $lines[$cursor])) { $num_lines++; $cursor++; while (isset($lines[$cursor])) { $num_lines++; - if (preg_match('@
\s*$@i', $lines[$cursor])) { + if (@preg_match('@\s*$@i', $lines[$cursor])) { break; } $cursor++; @@ -33,7 +33,7 @@ if ($node->isContentNode()) { $content = $node->getContent(); - if (!strlen(trim($content))) { + if (!@strlen(trim($content))) { // Ignore whitespace. continue; } @@ -75,7 +75,7 @@ $content = $node->getContent(); // If this is whitespace, ignore it. - if (!strlen(trim($content))) { + if (!@strlen(trim($content))) { continue; } @@ -114,7 +114,7 @@ if ($cell->isContentNode()) { $content = $node->getContent(); - if (!strlen(trim($content))) { + if (!@strlen(trim($content))) { continue; } diff --git a/src/infrastructure/markup/interpreter/PhabricatorRemarkupCowsayBlockInterpreter.php b/src/infrastructure/markup/interpreter/PhabricatorRemarkupCowsayBlockInterpreter.php --- a/src/infrastructure/markup/interpreter/PhabricatorRemarkupCowsayBlockInterpreter.php +++ b/src/infrastructure/markup/interpreter/PhabricatorRemarkupCowsayBlockInterpreter.php @@ -59,7 +59,7 @@ foreach ($directories as $directory) { foreach (Filesystem::listDirectory($directory, false) as $cow_file) { $matches = null; - if (!preg_match('/^(.*)\.cow\z/', $cow_file, $matches)) { + if (!@preg_match('/^(.*)\.cow\z/', $cow_file, $matches)) { continue; } $cow_name = $matches[1]; diff --git a/src/infrastructure/markup/interpreter/PhabricatorRemarkupFigletBlockInterpreter.php b/src/infrastructure/markup/interpreter/PhabricatorRemarkupFigletBlockInterpreter.php --- a/src/infrastructure/markup/interpreter/PhabricatorRemarkupFigletBlockInterpreter.php +++ b/src/infrastructure/markup/interpreter/PhabricatorRemarkupFigletBlockInterpreter.php @@ -57,7 +57,7 @@ $map = array(); foreach ($dirs as $dir) { foreach (Filesystem::listDirectory($dir, false) as $file) { - if (preg_match('/\.flf\z/', $file)) { + if (@preg_match('/\.flf\z/', $file)) { $name = phutil_utf8_strtolower($file); $name = preg_replace('/\.flf\z/', '', $name); $map[$name] = $dir.$file; diff --git a/src/infrastructure/markup/markuprule/PhutilRemarkupDocumentLinkRule.php b/src/infrastructure/markup/markuprule/PhutilRemarkupDocumentLinkRule.php --- a/src/infrastructure/markup/markuprule/PhutilRemarkupDocumentLinkRule.php +++ b/src/infrastructure/markup/markuprule/PhutilRemarkupDocumentLinkRule.php @@ -60,14 +60,14 @@ // If present, strip off "mailto:" or "tel:". $link = preg_replace('/^(?:mailto|tel):/', '', $link); - if (!strlen($name)) { + if (!@strlen($name)) { return $link; } return $name.' <'.$link.'>'; } - if (!strlen($name)) { + if (!@strlen($name)) { $name = $link; $name = preg_replace('/^(?:mailto|tel):/', '', $name); } @@ -102,7 +102,7 @@ public function markupAlternateLink(array $matches) { $uri = trim($matches[2]); - if (!strlen($uri)) { + if (!@strlen($uri)) { return $matches[0]; } @@ -118,8 +118,8 @@ return $matches[0]; } - if (strpos($uri, '/') === false && - strpos($uri, '@') === false && + if (@strpos($uri, '/') === false && + @strpos($uri, '@') === false && strncmp($uri, 'tel:', 4)) { return $matches[0]; } @@ -146,7 +146,7 @@ // If whatever is being linked to begins with "/" or "#", or has "://", // or is "mailto:" or "tel:", treat it as a URI instead of a wiki page. - $is_uri = preg_match('@(^/)|(://)|(^#)|(^(?:mailto|tel):)@', $uri); + $is_uri = @preg_match('@(^/)|(://)|(^#)|(^(?:mailto|tel):)@', $uri); if ($is_uri && strncmp('/', $uri, 1) && strncmp('#', $uri, 1)) { $protocols = $this->getEngine()->getConfig( diff --git a/src/infrastructure/markup/markuprule/PhutilRemarkupEscapeRemarkupRule.php b/src/infrastructure/markup/markuprule/PhutilRemarkupEscapeRemarkupRule.php --- a/src/infrastructure/markup/markuprule/PhutilRemarkupEscapeRemarkupRule.php +++ b/src/infrastructure/markup/markuprule/PhutilRemarkupEscapeRemarkupRule.php @@ -7,7 +7,7 @@ } public function apply($text) { - if (strpos($text, "\1") === false) { + if (@strpos($text, "\1") === false) { return $text; } diff --git a/src/infrastructure/markup/markuprule/PhutilRemarkupHighlightRule.php b/src/infrastructure/markup/markuprule/PhutilRemarkupHighlightRule.php --- a/src/infrastructure/markup/markuprule/PhutilRemarkupHighlightRule.php +++ b/src/infrastructure/markup/markuprule/PhutilRemarkupHighlightRule.php @@ -19,12 +19,12 @@ protected function applyCallback(array $matches) { // Remove the two exclamation points that represent syntax. - $excitement = substr($matches[2], 2); + $excitement = @substr($matches[2], 2); // If the internal content consists of ONLY exclamation points, leave it // untouched so "!!!!!" is five exclamation points instead of one // highlighted exclamation point. - if (preg_match('/^!+\z/', $matches[1])) { + if (@preg_match('/^!+\z/', $matches[1])) { return $matches[0]; } diff --git a/src/infrastructure/markup/markuprule/PhutilRemarkupHyperlinkRule.php b/src/infrastructure/markup/markuprule/PhutilRemarkupHyperlinkRule.php --- a/src/infrastructure/markup/markuprule/PhutilRemarkupHyperlinkRule.php +++ b/src/infrastructure/markup/markuprule/PhutilRemarkupHyperlinkRule.php @@ -146,9 +146,9 @@ $match = $matches[0]; $tail = null; $trailing = null; - if (preg_match('/[;,.:!?]+$/', $match, $trailing)) { + if (@preg_match('/[;,.:!?]+$/', $match, $trailing)) { $tail = $trailing[0]; - $match = substr($match, 0, -strlen($tail)); + $match = @substr($match, 0, -@strlen($tail)); } // If there's a closing paren at the end but no balancing open paren in @@ -161,9 +161,9 @@ // // We could apply a craftier heuristic here which tries to actually balance // the parens, but this is probably sufficient. - if (preg_match('/\\)$/', $match) && !preg_match('/\\(/', $match)) { + if (@preg_match('/\\)$/', $match) && !@preg_match('/\\(/', $match)) { $tail = ')'.$tail; - $match = substr($match, 0, -1); + $match = @substr($match, 0, -1); } try { diff --git a/src/infrastructure/markup/markuprule/PhutilRemarkupRule.php b/src/infrastructure/markup/markuprule/PhutilRemarkupRule.php --- a/src/infrastructure/markup/markuprule/PhutilRemarkupRule.php +++ b/src/infrastructure/markup/markuprule/PhutilRemarkupRule.php @@ -84,7 +84,7 @@ */ protected function assertFlatText($text) { $text = (string)hsprintf('%s', phutil_safe_html($text)); - $rich = (strpos($text, PhutilRemarkupBlockStorage::MAGIC_BYTE) !== false); + $rich = (@strpos($text, PhutilRemarkupBlockStorage::MAGIC_BYTE) !== false); if ($rich) { throw new Exception( pht( @@ -103,7 +103,7 @@ */ protected function isFlatText($text) { $text = (string)hsprintf('%s', phutil_safe_html($text)); - return (strpos($text, PhutilRemarkupBlockStorage::MAGIC_BYTE) === false); + return (@strpos($text, PhutilRemarkupBlockStorage::MAGIC_BYTE) === false); } } diff --git a/src/infrastructure/markup/remarkup/PhutilRemarkupEngine.php b/src/infrastructure/markup/remarkup/PhutilRemarkupEngine.php --- a/src/infrastructure/markup/remarkup/PhutilRemarkupEngine.php +++ b/src/infrastructure/markup/remarkup/PhutilRemarkupEngine.php @@ -318,7 +318,7 @@ $tail = $text[$current_block['start'] - 1]; $head = $text[$current_block['start']]; - if (strlen(trim($tail)) && strlen(trim($head))) { + if (@strlen(trim($tail)) && @strlen(trim($head))) { return true; } @@ -327,7 +327,7 @@ private static function isEmptyBlock($text, $start, $num_lines) { for ($cursor = $start; $cursor < $start + $num_lines; $cursor++) { - if (strlen(trim($text[$cursor]))) { + if (@strlen(trim($text[$cursor]))) { return false; } } diff --git a/src/infrastructure/markup/remarkup/__tests__/PhutilRemarkupEngineTestCase.php b/src/infrastructure/markup/remarkup/__tests__/PhutilRemarkupEngineTestCase.php --- a/src/infrastructure/markup/remarkup/__tests__/PhutilRemarkupEngineTestCase.php +++ b/src/infrastructure/markup/remarkup/__tests__/PhutilRemarkupEngineTestCase.php @@ -16,7 +16,7 @@ $contents = Filesystem::readFile($markup_file); $file = basename($markup_file); - $parts = explode("\n~~~~~~~~~~\n", $contents); + $parts = @explode("\n~~~~~~~~~~\n", $contents); $this->assertEqual(3, count($parts), $markup_file); list($input_remarkup, $expected_output, $expected_text) = $parts; diff --git a/src/infrastructure/markup/render.php b/src/infrastructure/markup/render.php --- a/src/infrastructure/markup/render.php +++ b/src/infrastructure/markup/render.php @@ -33,7 +33,7 @@ // application should ever use them, and they are a potent attack vector. // This function is deep in the core and performance sensitive, so we're - // doing a cheap version of this test first to avoid calling preg_match() + // doing a cheap version of this test first to avoid calling @preg_match() // on URIs which begin with '/' or `#`. These cover essentially all URIs // in Phabricator. if (($href[0] !== '/') && ($href[0] !== '#')) { @@ -43,7 +43,7 @@ // section of the string. $normalized_href = preg_replace('([^a-z0-9/:]+)i', '', $href); - if (preg_match('/^javascript:/i', $normalized_href)) { + if (@preg_match('/^javascript:/i', $normalized_href)) { throw new Exception( pht( "Attempting to render a tag with an '%s' attribute that begins ". @@ -137,7 +137,7 @@ return $result; } - return htmlspecialchars($string, ENT_QUOTES, 'UTF-8'); + return @htmlspecialchars($string, ENT_QUOTES, 'UTF-8'); } function phutil_escape_html_newlines($string) { diff --git a/src/infrastructure/markup/rule/PhabricatorKeyboardRemarkupRule.php b/src/infrastructure/markup/rule/PhabricatorKeyboardRemarkupRule.php --- a/src/infrastructure/markup/rule/PhabricatorKeyboardRemarkupRule.php +++ b/src/infrastructure/markup/rule/PhabricatorKeyboardRemarkupRule.php @@ -18,11 +18,11 @@ return $matches[0]; } - $keys = explode(' ', $matches[1]); + $keys = @explode(' ', $matches[1]); foreach ($keys as $k => $v) { $v = trim($v, " \n"); $v = preg_replace('/\\\\(.)/', '\\1', $v); - if (!strlen($v)) { + if (!@strlen($v)) { unset($keys[$k]); continue; } diff --git a/src/infrastructure/markup/rule/PhabricatorNavigationRemarkupRule.php b/src/infrastructure/markup/rule/PhabricatorNavigationRemarkupRule.php --- a/src/infrastructure/markup/rule/PhabricatorNavigationRemarkupRule.php +++ b/src/infrastructure/markup/rule/PhabricatorNavigationRemarkupRule.php @@ -19,7 +19,7 @@ } $elements = ltrim($matches[1], ", \n"); - $elements = explode('>', $elements); + $elements = @explode('>', $elements); $defaults = array( 'name' => null, @@ -31,7 +31,7 @@ $sequence = array(); $parser = new PhutilSimpleOptions(); foreach ($elements as $element) { - if (strpos($element, '=') === false) { + if (@strpos($element, '=') === false) { $sequence[] = array( 'name' => trim($element), ) + $defaults; diff --git a/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php b/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php --- a/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php +++ b/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php @@ -17,7 +17,7 @@ protected function getObjectNamePrefixBeginsWithWordCharacter() { $prefix = $this->getObjectNamePrefix(); - return preg_match('/^\w/', $prefix); + return @preg_match('/^\w/', $prefix); } protected function getObjectIDPattern() { @@ -335,7 +335,7 @@ $regex = trim( PhabricatorEnv::getEnvConfig('remarkup.ignored-object-names')); - if ($regex && preg_match($regex, $params['original'])) { + if ($regex && @preg_match($regex, $params['original'])) { return $params['original']; } diff --git a/src/infrastructure/markup/rule/PhabricatorYoutubeRemarkupRule.php b/src/infrastructure/markup/rule/PhabricatorYoutubeRemarkupRule.php --- a/src/infrastructure/markup/rule/PhabricatorYoutubeRemarkupRule.php +++ b/src/infrastructure/markup/rule/PhabricatorYoutubeRemarkupRule.php @@ -14,7 +14,7 @@ } $domain = $uri->getDomain(); - if (!preg_match('/(^|\.)youtube\.com\z/', $domain)) { + if (!@preg_match('/(^|\.)youtube\.com\z/', $domain)) { return $text; } diff --git a/src/infrastructure/markup/syntax/engine/PhutilDefaultSyntaxHighlighterEngine.php b/src/infrastructure/markup/syntax/engine/PhutilDefaultSyntaxHighlighterEngine.php --- a/src/infrastructure/markup/syntax/engine/PhutilDefaultSyntaxHighlighterEngine.php +++ b/src/infrastructure/markup/syntax/engine/PhutilDefaultSyntaxHighlighterEngine.php @@ -26,7 +26,7 @@ foreach ($maps as $map) { foreach ($map as $regexp => $lang) { $matches = null; - if (preg_match($regexp, $filename, $matches)) { + if (@preg_match($regexp, $filename, $matches)) { if (is_numeric($lang)) { return idx($matches, $lang); } else { diff --git a/src/infrastructure/markup/syntax/highlighter/PhutilConsoleSyntaxHighlighter.php b/src/infrastructure/markup/syntax/highlighter/PhutilConsoleSyntaxHighlighter.php --- a/src/infrastructure/markup/syntax/highlighter/PhutilConsoleSyntaxHighlighter.php +++ b/src/infrastructure/markup/syntax/highlighter/PhutilConsoleSyntaxHighlighter.php @@ -15,7 +15,7 @@ public function getHighlightFuture($source) { $in_command = false; - $lines = explode("\n", $source); + $lines = @explode("\n", $source); foreach ($lines as $key => $line) { $matches = null; @@ -30,7 +30,7 @@ ($in_command ? '()(.*?)' : '^(\S+[\\\\/] )?([$] .*?)'). '(#.*|\\\\)?$@'; - if (preg_match($pattern, $line, $matches)) { + if (@preg_match($pattern, $line, $matches)) { $lines[$key] = hsprintf( '%s%s%s', $matches[1], diff --git a/src/infrastructure/markup/syntax/highlighter/PhutilDivinerSyntaxHighlighter.php b/src/infrastructure/markup/syntax/highlighter/PhutilDivinerSyntaxHighlighter.php --- a/src/infrastructure/markup/syntax/highlighter/PhutilDivinerSyntaxHighlighter.php +++ b/src/infrastructure/markup/syntax/highlighter/PhutilDivinerSyntaxHighlighter.php @@ -20,9 +20,9 @@ // This highlighter isn't perfect but tries to do an okay job at getting // some of the basics at least. There's lots of room for improvement. - $blocks = explode("\n\n", $source); + $blocks = @explode("\n\n", $source); foreach ($blocks as $key => $block) { - if (preg_match('/^[^ ](?! )/m', $block)) { + if (@preg_match('/^[^ ](?! )/m', $block)) { $blocks[$key] = $this->highlightBlock($block); } } @@ -68,7 +68,7 @@ // NOTE: The goal here is to make sure a never crosses a newline. $content = $matches[0]; - $content = explode("\n", $content); + $content = @explode("\n", $content); foreach ($content as $key => $line) { $content[$key] = ''. diff --git a/src/infrastructure/markup/syntax/highlighter/PhutilLexerSyntaxHighlighter.php b/src/infrastructure/markup/syntax/highlighter/PhutilLexerSyntaxHighlighter.php --- a/src/infrastructure/markup/syntax/highlighter/PhutilLexerSyntaxHighlighter.php +++ b/src/infrastructure/markup/syntax/highlighter/PhutilLexerSyntaxHighlighter.php @@ -15,7 +15,7 @@ $lang = idx($this->config, 'language'); if ($lang == 'php') { - if (strpos($source, 'config, 'language'); - if (preg_match('/\r(?!\n)/', $source)) { + if (@preg_match('/\r(?!\n)/', $source)) { // TODO: Pygments converts "\r" newlines into "\n" newlines, so we can't // use it on files with "\r" newlines. If we have "\r" not followed by // "\n" in the file, skip highlighting. @@ -31,7 +31,7 @@ $language); $scrub = false; - if ($language == 'php' && strpos($source, '
(.*)
\s*$@s', diff --git a/src/infrastructure/markup/syntax/highlighter/xhpast/PhutilXHPASTSyntaxHighlighterFuture.php b/src/infrastructure/markup/syntax/highlighter/xhpast/PhutilXHPASTSyntaxHighlighterFuture.php --- a/src/infrastructure/markup/syntax/highlighter/xhpast/PhutilXHPASTSyntaxHighlighterFuture.php +++ b/src/infrastructure/markup/syntax/highlighter/xhpast/PhutilXHPASTSyntaxHighlighterFuture.php @@ -70,14 +70,14 @@ unset($tokens[0]); $value = $tokens[1]->getValue(); - if ((strlen($value) < 1) || ($value[0] != "\n")) { + if ((@strlen($value) < 1) || ($value[0] != "\n")) { throw new Exception( pht( 'Expected "\\n" at beginning of T_WHITESPACE token at head of '. 'tokens for highlighting parse of PHP snippet.')); } - $value = substr($value, 1); + $value = @substr($value, 1); $tokens[1]->overwriteValue($value); } @@ -128,7 +128,7 @@ 'false' => true, 'null' => true, ); - if (isset($magic[strtolower($value)])) { + if (isset($magic[@strtolower($value)])) { $class = 'k'; break; } diff --git a/src/infrastructure/parser/PhutilPygmentizeParser.php b/src/infrastructure/parser/PhutilPygmentizeParser.php --- a/src/infrastructure/parser/PhutilPygmentizeParser.php +++ b/src/infrastructure/parser/PhutilPygmentizeParser.php @@ -19,13 +19,13 @@ public function parse($block) { $class_look = 'class="'; - $class_len = strlen($class_look); + $class_len = @strlen($class_look); $class_start = null; $map = $this->map; - $len = strlen($block); + $len = @strlen($block); $out = ''; $mode = 'text'; for ($ii = 0; $ii < $len; $ii++) { @@ -61,7 +61,7 @@ // We're inside a `class="..."` tag, and looking for the ending quote // so we can replace it. if ($c == '"') { - $class = substr($block, $class_start, $ii - $class_start); + $class = @substr($block, $class_start, $ii - $class_start); // If this class is present in the map, rewrite it into an inline // style attribute. diff --git a/src/infrastructure/query/PhabricatorQuery.php b/src/infrastructure/query/PhabricatorQuery.php --- a/src/infrastructure/query/PhabricatorQuery.php +++ b/src/infrastructure/query/PhabricatorQuery.php @@ -87,7 +87,7 @@ foreach ($this->flattenSubclause($part) as $subpart) { $result[] = $subpart; } - } else if (strlen($part)) { + } else if (@strlen($part)) { $result[] = $part; } } diff --git a/src/infrastructure/query/order/PhabricatorQueryOrderItem.php b/src/infrastructure/query/order/PhabricatorQueryOrderItem.php --- a/src/infrastructure/query/order/PhabricatorQueryOrderItem.php +++ b/src/infrastructure/query/order/PhabricatorQueryOrderItem.php @@ -30,7 +30,7 @@ $is_reversed = false; if (!strncmp($scalar, '-', 1)) { $is_reversed = true; - $scalar = substr($scalar, 1); + $scalar = @substr($scalar, 1); } $item = new PhabricatorQueryOrderItem(); diff --git a/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php b/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php --- a/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php +++ b/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php @@ -369,7 +369,7 @@ $this->setLimit($limit + 1); - if (strlen($pager->getAfterID())) { + if (@strlen($pager->getAfterID())) { $this->setExternalCursorString($pager->getAfterID()); } else if ($pager->getBeforeID()) { $this->setExternalCursorString($pager->getBeforeID()); @@ -1738,7 +1738,7 @@ */ protected function isCustomFieldOrderKey($key) { $prefix = 'custom:'; - return !strncmp($key, $prefix, strlen($prefix)); + return !strncmp($key, $prefix, @strlen($prefix)); } @@ -2428,7 +2428,7 @@ PhabricatorSearchNgrams $index, $value) { - if (strlen($value)) { + if (@strlen($value)) { $this->ngrams[] = array( 'index' => $index, 'value' => $value, diff --git a/src/infrastructure/ssh/PhabricatorSSHPassthruCommand.php b/src/infrastructure/ssh/PhabricatorSSHPassthruCommand.php --- a/src/infrastructure/ssh/PhabricatorSSHPassthruCommand.php +++ b/src/infrastructure/ssh/PhabricatorSSHPassthruCommand.php @@ -163,7 +163,7 @@ } $out_message = $command_channel->read(); - if (strlen($out_message)) { + if (@strlen($out_message)) { $out_message = $this->willReadData($out_message); if ($out_message !== null) { $io_channel->write($out_message); @@ -201,7 +201,7 @@ public function writeIORead($in_message) { $in_message = $this->willWriteData($in_message); - if (strlen($in_message)) { + if (@strlen($in_message)) { $this->commandChannel->write($in_message); } } @@ -210,7 +210,7 @@ if ($this->willWriteCallback) { return call_user_func($this->willWriteCallback, $this, $message); } else { - if (strlen($message)) { + if (@strlen($message)) { return $message; } else { return null; @@ -222,7 +222,7 @@ if ($this->willReadCallback) { return call_user_func($this->willReadCallback, $this, $message); } else { - if (strlen($message)) { + if (@strlen($message)) { return $message; } else { return null; diff --git a/src/infrastructure/ssh/PhabricatorSSHWorkflow.php b/src/infrastructure/ssh/PhabricatorSSHWorkflow.php --- a/src/infrastructure/ssh/PhabricatorSSHWorkflow.php +++ b/src/infrastructure/ssh/PhabricatorSSHWorkflow.php @@ -101,7 +101,7 @@ public function getSSHRemoteAddress() { $ssh_client = getenv('SSH_CLIENT'); - if (!strlen($ssh_client)) { + if (!@strlen($ssh_client)) { return null; } @@ -109,7 +109,7 @@ // also be proxied. // This has the format " ". Grab the IP. - $remote_address = head(explode(' ', $ssh_client)); + $remote_address = head(@explode(' ', $ssh_client)); try { $address = PhutilIPAddress::newAddress($remote_address); diff --git a/src/infrastructure/storage/connection/AphrontIsolatedDatabaseConnection.php b/src/infrastructure/storage/connection/AphrontIsolatedDatabaseConnection.php --- a/src/infrastructure/storage/connection/AphrontIsolatedDatabaseConnection.php +++ b/src/infrastructure/storage/connection/AphrontIsolatedDatabaseConnection.php @@ -90,7 +90,7 @@ } $preg_keywords = implode('|', $preg_keywords); - if (!preg_match('/^[\s<>K]*('.$preg_keywords.')\s*/i', $raw_query)) { + if (!@preg_match('/^[\s<>K]*('.$preg_keywords.')\s*/i', $raw_query)) { throw new AphrontNotSupportedQueryException( pht( "Database isolation currently only supports some queries. You are ". diff --git a/src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php b/src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php --- a/src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php +++ b/src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php @@ -292,7 +292,7 @@ // NOTE: The opening "(" allows queries in the form of: // // (SELECT ...) UNION (SELECT ...) - $is_write = !preg_match('/^[(]*(SELECT|SHOW|EXPLAIN)\s/', $raw_query); + $is_write = !@preg_match('/^[(]*(SELECT|SHOW|EXPLAIN)\s/', $raw_query); if ($is_write) { if ($this->getReadOnly()) { throw new Exception( diff --git a/src/infrastructure/storage/connection/mysql/AphrontMySQLDatabaseConnection.php b/src/infrastructure/storage/connection/mysql/AphrontMySQLDatabaseConnection.php --- a/src/infrastructure/storage/connection/mysql/AphrontMySQLDatabaseConnection.php +++ b/src/infrastructure/storage/connection/mysql/AphrontMySQLDatabaseConnection.php @@ -167,7 +167,7 @@ $host = $conn->getConfiguration('host'); $port = 0; $match = null; - if (preg_match('/(.+):(.+)/', $host, $match)) { + if (@preg_match('/(.+):(.+)/', $host, $match)) { list(, $host, $port) = $match; } diff --git a/src/infrastructure/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php b/src/infrastructure/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php --- a/src/infrastructure/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php +++ b/src/infrastructure/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php @@ -92,7 +92,7 @@ // "port" parameter.) if (!$ok) { - if (strlen($call_error)) { + if (@strlen($call_error)) { $message = pht( 'mysqli->real_connect() failed: %s', $call_error); @@ -173,7 +173,7 @@ if (!$result) { $error_code = $this->getErrorCode($conn); if (!$error_code) { - if (strlen($err)) { + if (@strlen($err)) { $message = $err; } else { $message = pht( diff --git a/src/infrastructure/storage/lisk/LiskDAO.php b/src/infrastructure/storage/lisk/LiskDAO.php --- a/src/infrastructure/storage/lisk/LiskDAO.php +++ b/src/infrastructure/storage/lisk/LiskDAO.php @@ -405,9 +405,8 @@ public function getConfigOption($option_name) { static $options = null; - if (!isset($options)) { - $options = $this->getConfiguration(); - } + //get config every time to be sure it is correct + $options = $this->getConfiguration(); return idx($options, $option_name); } @@ -588,7 +587,7 @@ // which may include extra explicit columns or joins. // This pathway is very hot on some pages, so we're inlining a cache - // and doing some microoptimization to avoid a strtolower() call for each + // and doing some microoptimization to avoid a @strtolower() call for each // assignment. The common path (assigning a valid property which we've // already seen) always incurs only one empty(). The second most common // path (assigning an invalid property which we've already seen) costs @@ -743,26 +742,24 @@ */ protected function getAllLiskProperties() { static $properties = null; - if (!isset($properties)) { - $class = new ReflectionClass(get_class($this)); - $properties = array(); - foreach ($class->getProperties(ReflectionProperty::IS_PROTECTED) as $p) { - $properties[strtolower($p->getName())] = $p->getName(); - } + $class = new ReflectionClass(get_class($this)); + $properties = array(); + foreach ($class->getProperties(ReflectionProperty::IS_PROTECTED) as $p) { + $properties[@strtolower($p->getName())] = $p->getName(); + } - $id_key = $this->getIDKey(); - if ($id_key != 'id') { - unset($properties['id']); - } + $id_key = $this->getIDKey(); + if ($id_key != 'id') { + unset($properties['id']); + } - if (!$this->getConfigOption(self::CONFIG_TIMESTAMPS)) { - unset($properties['datecreated']); - unset($properties['datemodified']); - } + if (!$this->getConfigOption(self::CONFIG_TIMESTAMPS)) { + unset($properties['datecreated']); + unset($properties['datemodified']); + } - if ($id_key != 'phid' && !$this->getConfigOption(self::CONFIG_AUX_PHID)) { - unset($properties['phid']); - } + if ($id_key != 'phid' && !$this->getConfigOption(self::CONFIG_AUX_PHID)) { + unset($properties['phid']); } return $properties; } @@ -782,9 +779,13 @@ $properties = $this->getAllLiskProperties(); } - $property = strtolower($property); + $property = @strtolower($property); if (empty($properties[$property])) { - return null; + //double check this to avoid false positives + $properties = $this->getAllLiskProperties(); + if (empty($properties[$property])) { + return null; + } } return $properties[$property]; @@ -1612,12 +1613,12 @@ if (isset($dispatch_map[$method])) { $property = $dispatch_map[$method]; } else { - if (substr($method, 0, 3) !== 'get') { + if (@substr($method, 0, 3) !== 'get') { throw new Exception(pht("Unable to resolve method '%s'!", $method)); } - $property = substr($method, 3); + $property = @substr($method, 3); if (!($property = $this->checkProperty($property))) { - throw new Exception(pht('Bad getter call: %s', $method)); + throw new Exception(pht('\Bad getter call: %s', $method)); } $dispatch_map[$method] = $property; } @@ -1629,10 +1630,10 @@ if (isset($dispatch_map[$method])) { $property = $dispatch_map[$method]; } else { - if (substr($method, 0, 3) !== 'set') { + if (@substr($method, 0, 3) !== 'set') { throw new Exception(pht("Unable to resolve method '%s'!", $method)); } - $property = substr($method, 3); + $property = @substr($method, 3); $property = $this->checkProperty($property); if (!$property) { throw new Exception(pht('Bad setter call: %s', $method)); @@ -1825,13 +1826,13 @@ } // If the column is named `somethingPHID`, infer it is a PHID. - if (preg_match('/[a-z]PHID$/', $property)) { + if (@preg_match('/[a-z]PHID$/', $property)) { $map[$property] = 'phid'; continue; } // If the column is named `somethingID`, infer it is an ID. - if (preg_match('/[a-z]ID$/', $property)) { + if (@preg_match('/[a-z]ID$/', $property)) { $map[$property] = 'id'; continue; } diff --git a/src/infrastructure/storage/lisk/PhabricatorDataNotAttachedException.php b/src/infrastructure/storage/lisk/PhabricatorDataNotAttachedException.php --- a/src/infrastructure/storage/lisk/PhabricatorDataNotAttachedException.php +++ b/src/infrastructure/storage/lisk/PhabricatorDataNotAttachedException.php @@ -14,7 +14,7 @@ $via = null; if (is_array($frame)) { $method = idx($frame, 'function'); - if (preg_match('/^get[A-Z]/', $method)) { + if (@preg_match('/^get[A-Z]/', $method)) { $via = ' '.pht('(via %s)', "{$method}()"); } } diff --git a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php --- a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php +++ b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php @@ -39,10 +39,10 @@ */ public static function getStorageNamespace() { $namespace = end(self::$namespaceStack); - if (!strlen($namespace)) { + if (!@strlen($namespace)) { $namespace = self::getDefaultStorageNamespace(); } - if (!strlen($namespace)) { + if (!@strlen($namespace)) { throw new Exception(pht('No storage namespace configured!')); } return $namespace; @@ -183,18 +183,18 @@ */ public function getTableName() { $str = 'phabricator'; - $len = strlen($str); + $len = @strlen($str); - $class = strtolower(get_class($this)); + $class = @strtolower(get_class($this)); if (!strncmp($class, $str, $len)) { - $class = substr($class, $len); + $class = @substr($class, $len); } $app = $this->getApplicationName(); - if (!strncmp($class, $app, strlen($app))) { - $class = substr($class, strlen($app)); + if (!strncmp($class, $app, @strlen($app))) { + $class = @substr($class, @strlen($app)); } - if (strlen($class)) { + if (@strlen($class)) { return $app.'_'.$class; } else { return $app; @@ -238,12 +238,12 @@ $chunk = array(); $len = 0; - $glue_len = strlen(', '); + $glue_len = @strlen(', '); foreach ($fragments as $fragment) { if ($fragment instanceof PhutilQueryString) { - $this_len = strlen($fragment->getUnmaskedString()); + $this_len = @strlen($fragment->getUnmaskedString()); } else { - $this_len = strlen($fragment); + $this_len = @strlen($fragment); } if ($chunk) { @@ -295,7 +295,7 @@ } if (function_exists('mb_detect_encoding')) { - if (strlen($encoding)) { + if (@strlen($encoding)) { $try_encodings = array( $encoding, ); diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php --- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php +++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php @@ -183,7 +183,7 @@ $password = $api->getPassword(); if ($password) { - if (strlen($password->openEnvelope())) { + if (@strlen($password->openEnvelope())) { $has_password = true; } } @@ -310,7 +310,7 @@ list($stdout, $stderr) = $future->read(); $future->discardBuffers(); - if (strlen($stderr)) { + if (@strlen($stderr)) { fwrite(STDERR, $stderr); } @@ -355,7 +355,7 @@ } private function writeData($data, $file, $is_compress, $output_file) { - if (!strlen($data)) { + if (!@strlen($data)) { return; } @@ -367,11 +367,11 @@ $ok = fwrite($file, $data); } - if ($ok !== strlen($data)) { + if ($ok !== @strlen($data)) { throw new Exception( pht( 'Failed to write %d byte(s) to file "%s".', - new PhutilNumber(strlen($data)), + new PhutilNumber(@strlen($data)), $output_file)); } } diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementRenamespaceWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementRenamespaceWorkflow.php --- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementRenamespaceWorkflow.php +++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementRenamespaceWorkflow.php @@ -59,7 +59,7 @@ $input = $args->getArg('input'); $is_live = $args->getArg('live'); - if (!strlen($input) && !$is_live) { + if (!@strlen($input) && !$is_live) { throw new PhutilArgumentUsageException( pht( 'Specify the dumpfile to read with "--input", or use "--live" to '. @@ -67,7 +67,7 @@ } $from = $args->getArg('from'); - if (!strlen($from)) { + if (!@strlen($from)) { throw new PhutilArgumentUsageException( pht( 'Specify namespace to rename from with %s.', @@ -75,7 +75,7 @@ } $to = $args->getArg('to'); - if (!strlen($to)) { + if (!@strlen($to)) { throw new PhutilArgumentUsageException( pht( 'Specify namespace to rename to with %s.', @@ -156,7 +156,7 @@ foreach ($lines as $line) { foreach ($patterns as $key => $pattern) { - if (preg_match($pattern, $line, $matches)) { + if (@preg_match($pattern, $line, $matches)) { $line = $matches[1].$to.$matches[3]; $found[$key]++; } @@ -170,11 +170,11 @@ $bytes = fwrite($file, $data); } - if ($bytes !== strlen($data)) { + if ($bytes !== @strlen($data)) { throw new Exception( pht( 'Failed to write %d byte(s) to "%s".', - new PhutilNumber(strlen($data)), + new PhutilNumber(@strlen($data)), $output_name)); } } diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementShellWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementShellWorkflow.php --- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementShellWorkflow.php +++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementShellWorkflow.php @@ -25,7 +25,7 @@ $flag_password = ''; $password = $api->getPassword(); if ($password) { - if (strlen($password->openEnvelope())) { + if (@strlen($password->openEnvelope())) { $flag_password = csprintf('--password=%P', $password); } } diff --git a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php --- a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php +++ b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php @@ -20,8 +20,8 @@ $patches = array(); foreach ($this->getOldPatches() as $old_name => $old_patch) { - if (preg_match('/^db\./', $old_name)) { - $old_patch['name'] = substr($old_name, 3); + if (@preg_match('/^db\./', $old_name)) { + $old_patch['name'] = @substr($old_name, 3); $old_patch['type'] = 'db'; } else { if (empty($old_patch['name'])) { @@ -29,7 +29,7 @@ } if (empty($old_patch['type'])) { $matches = null; - preg_match('/\.(sql|php)$/', $old_name, $matches); + @preg_match('/\.(sql|php)$/', $old_name, $matches); $old_patch['type'] = $matches[1]; } } diff --git a/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php b/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php --- a/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php +++ b/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php @@ -19,7 +19,7 @@ foreach ($patch_list as $patch) { $matches = null; - if (!preg_match('/\.(sql|php)$/', $patch, $matches)) { + if (!@preg_match('/\.(sql|php)$/', $patch, $matches)) { throw new Exception( pht( 'Unknown patch "%s" in "%s", expected ".php" or ".sql" suffix.', @@ -108,7 +108,7 @@ $key)); } - if (strpos($key, ':') !== false) { + if (@strpos($key, ':') !== false) { throw new Exception( pht( "%s '%s' has a patch with a colon in the key name, '%s'. ". @@ -186,7 +186,7 @@ $last_keys[$patch_phase] = $full_key; foreach ($patch['after'] as $after_key => $after) { - if (strpos($after, ':') === false) { + if (@strpos($after, ':') === false) { $patch['after'][$after_key] = $namespace.':'.$after; } } @@ -268,19 +268,19 @@ $lines = phutil_split_lines($data, false); foreach ($lines as $line) { // Skip over the "PHP" line. - if (preg_match('(^<\?)', $line)) { + if (@preg_match('(^<\?)', $line)) { continue; } // Skip over blank lines. - if (!strlen(trim($line))) { + if (!@strlen(trim($line))) { continue; } // If this is a "//" comment... - if (preg_match('(^\s*//)', $line)) { + if (@preg_match('(^\s*//)', $line)) { $matches = null; - if (preg_match('(^\s*//\s*@(\S+)(?:\s+(.*))?\z)', $line, $matches)) { + if (@preg_match('(^\s*//\s*@(\S+)(?:\s+(.*))?\z)', $line, $matches)) { $attr_key = $matches[1]; $attr_value = trim(idx($matches, 2)); @@ -288,7 +288,7 @@ case 'phase': $phase_name = $attr_value; - if (!strlen($phase_name)) { + if (!@strlen($phase_name)) { throw new Exception( pht( 'Storage patch "%s" specifies a "@phase" attribute with '. diff --git a/src/infrastructure/storage/xsprintf/qsprintf.php b/src/infrastructure/storage/xsprintf/qsprintf.php --- a/src/infrastructure/storage/xsprintf/qsprintf.php +++ b/src/infrastructure/storage/xsprintf/qsprintf.php @@ -98,7 +98,7 @@ $unmasked = false; } - $next = (strlen($pattern) > $pos + 1) ? $pattern[$pos + 1] : null; + $next = (@strlen($pattern) > $pos + 1) ? $pattern[$pos + 1] : null; $nullable = false; $done = false; @@ -115,7 +115,7 @@ case 'f': case 's': $pattern = substr_replace($pattern, '', $pos, 1); - $length = strlen($pattern); + $length = @strlen($pattern); $type = 's'; if ($value === null) { $value = 'IS NULL'; @@ -142,7 +142,7 @@ case 's': // ...string. case 'B': // ...binary string. $pattern = substr_replace($pattern, '', $pos, 1); - $length = strlen($pattern); + $length = @strlen($pattern); $type = $next; $nullable = true; break; @@ -154,7 +154,7 @@ case 'L': // List of.. qsprintf_check_type($value, "L{$next}", $pattern); $pattern = substr_replace($pattern, '', $pos, 1); - $length = strlen($pattern); + $length = @strlen($pattern); $type = 's'; $done = true; @@ -192,8 +192,8 @@ foreach ($value as $k => $v) { $matches = null; - if (preg_match('/\((\d+)\)\z/', $v, $matches)) { - $v = substr($v, 0, -(strlen($matches[1]) + 2)); + if (@preg_match('/\((\d+)\)\z/', $v, $matches)) { + $v = @substr($v, 0, -(@strlen($matches[1]) + 2)); $prefix_len = '('.((int)$matches[1]).')'; } else { $prefix_len = ''; diff --git a/src/infrastructure/util/PhabricatorGlobalLock.php b/src/infrastructure/util/PhabricatorGlobalLock.php --- a/src/infrastructure/util/PhabricatorGlobalLock.php +++ b/src/infrastructure/util/PhabricatorGlobalLock.php @@ -47,7 +47,7 @@ $parts = array(); ksort($parameters); foreach ($parameters as $key => $parameter) { - if (!preg_match('/^[a-zA-Z0-9]+\z/', $key)) { + if (!@preg_match('/^[a-zA-Z0-9]+\z/', $key)) { throw new Exception( pht( 'Lock parameter key "%s" must be alphanumeric.', diff --git a/src/infrastructure/util/PhabricatorHash.php b/src/infrastructure/util/PhabricatorHash.php --- a/src/infrastructure/util/PhabricatorHash.php +++ b/src/infrastructure/util/PhabricatorHash.php @@ -92,7 +92,7 @@ $result = ''; $accum = 0; - $map_size = strlen($map); + $map_size = @strlen($map); for ($ii = 0; $ii < self::ANCHOR_DIGEST_LENGTH; $ii++) { $byte = ord($hash[$ii]); $low_bits = ($byte & 0x3F); @@ -176,7 +176,7 @@ $hash = self::digestForIndex($string); - $prefix = substr($string, 0, ($length - ($min_length - 1))); + $prefix = @substr($string, 0, ($length - ($min_length - 1))); return $prefix.'-'.$hash; } @@ -197,7 +197,7 @@ pht('HMAC-SHA256 keys must be strings.')); } - if (!strlen($key)) { + if (!@strlen($key)) { throw new Exception( pht('HMAC-SHA256 requires a nonempty key.')); } @@ -224,7 +224,7 @@ $cache_key = "hmac.key({$hmac_name})"; $hmac_key = $cache->getKey($cache_key); - if (!strlen($hmac_key)) { + if (!@strlen($hmac_key)) { $hmac_key = self::readHMACKey($hmac_name); if ($hmac_key === null) { @@ -238,8 +238,8 @@ // The "hex2bin()" function doesn't exist until PHP 5.4.0 so just // implement it inline. $result = ''; - for ($ii = 0; $ii < strlen($hmac_key); $ii += 2) { - $result .= pack('H*', substr($hmac_key, $ii, 2)); + for ($ii = 0; $ii < @strlen($hmac_key); $ii += 2) { + $result .= pack('H*', @substr($hmac_key, $ii, 2)); } return $result; diff --git a/src/infrastructure/util/PhabricatorSlug.php b/src/infrastructure/util/PhabricatorSlug.php --- a/src/infrastructure/util/PhabricatorSlug.php +++ b/src/infrastructure/util/PhabricatorSlug.php @@ -45,7 +45,7 @@ $slug = preg_replace('(['.$ban.']+)', '_', $slug); $slug = preg_replace('@_+@', '_', $slug); - $parts = explode('/', $slug); + $parts = @explode('/', $slug); // Remove leading and trailing underscores from each component, if the // component has not been reduced to a single underscore. For example, "a?" @@ -79,7 +79,7 @@ } public static function getDefaultTitle($slug) { - $parts = explode('/', trim($slug, '/')); + $parts = @explode('/', trim($slug, '/')); $default_title = end($parts); $default_title = str_replace('_', ' ', $default_title); $default_title = phutil_utf8_ucwords($default_title); @@ -98,7 +98,7 @@ '/', ); - $slug = explode('/', $slug); + $slug = @explode('/', $slug); array_pop($slug); array_pop($slug); diff --git a/src/infrastructure/util/password/PhabricatorPasswordHasher.php b/src/infrastructure/util/password/PhabricatorPasswordHasher.php --- a/src/infrastructure/util/password/PhabricatorPasswordHasher.php +++ b/src/infrastructure/util/password/PhabricatorPasswordHasher.php @@ -164,7 +164,7 @@ $name = $this->getHashName(); $hash = $this->getPasswordHash($envelope); - $actual_len = strlen($hash->openEnvelope()); + $actual_len = @strlen($hash->openEnvelope()); $expect_len = $this->getHashLength(); if ($actual_len > $expect_len) { throw new Exception( @@ -189,13 +189,13 @@ */ private static function parseHashFromStorage(PhutilOpaqueEnvelope $hash) { $raw_hash = $hash->openEnvelope(); - if (strpos($raw_hash, ':') === false) { + if (@strpos($raw_hash, ':') === false) { throw new Exception( pht( 'Malformed password hash, expected "name:hash".')); } - list($name, $hash) = explode(':', $raw_hash); + list($name, $hash) = @explode(':', $raw_hash); return array( 'name' => $name, @@ -220,7 +220,7 @@ foreach ($objects as $object) { $name = $object->getHashName(); - $potential_length = strlen($name) + $object->getHashLength() + 1; + $potential_length = @strlen($name) + $object->getHashLength() + 1; $maximum_length = self::MAXIMUM_STORAGE_SIZE; if ($potential_length > $maximum_length) { @@ -322,7 +322,7 @@ * @task hashing */ public static function canUpgradeHash(PhutilOpaqueEnvelope $hash) { - if (!strlen($hash->openEnvelope())) { + if (!@strlen($hash->openEnvelope())) { throw new Exception( pht('Expected a password hash, received nothing!')); } @@ -388,7 +388,7 @@ */ public static function getCurrentAlgorithmName(PhutilOpaqueEnvelope $hash) { $raw_hash = $hash->openEnvelope(); - if (!strlen($raw_hash)) { + if (!@strlen($raw_hash)) { return pht('None'); } diff --git a/src/view/control/AphrontTableView.php b/src/view/control/AphrontTableView.php --- a/src/view/control/AphrontTableView.php +++ b/src/view/control/AphrontTableView.php @@ -109,7 +109,7 @@ * @return pair Sort value, sort direction. */ public static function parseSort($sort) { - return array(ltrim($sort, '-'), preg_match('/^-/', $sort)); + return array(ltrim($sort, '-'), @preg_match('/^-/', $sort)); } public function makeSortable( @@ -135,7 +135,7 @@ $col_classes = array(); foreach ($this->columnClasses as $key => $class) { - if (strlen($class)) { + if (@strlen($class)) { $col_classes[] = $class; } else { $col_classes[] = null; diff --git a/src/view/form/control/AphrontFormControl.php b/src/view/form/control/AphrontFormControl.php --- a/src/view/form/control/AphrontFormControl.php +++ b/src/view/form/control/AphrontFormControl.php @@ -109,7 +109,7 @@ } public function isEmpty() { - return !strlen($this->getValue()); + return !@strlen($this->getValue()); } public function getSerializedValue() { @@ -172,7 +172,7 @@ $this->renderInput()); $error = null; - if (strlen($this->getError())) { + if (@strlen($this->getError())) { $error = $this->getError(); if ($error === true) { $error = phutil_tag( @@ -187,7 +187,7 @@ } } - if (strlen($this->getLabel())) { + if (@strlen($this->getLabel())) { $label = phutil_tag( 'label', array( @@ -203,7 +203,7 @@ $custom_class .= ' aphront-form-control-nolabel'; } - if (strlen($this->getCaption())) { + if (@strlen($this->getCaption())) { $caption = phutil_tag( 'div', array('class' => 'aphront-form-caption'), diff --git a/src/view/form/control/AphrontFormDateControl.php b/src/view/form/control/AphrontFormDateControl.php --- a/src/view/form/control/AphrontFormDateControl.php +++ b/src/view/form/control/AphrontFormDateControl.php @@ -114,7 +114,7 @@ } $readable = $this->formatTime($epoch, 'Y!m!d!'.$this->getTimeFormat()); - $readable = explode('!', $readable, 4); + $readable = @explode('!', $readable, 4); $year = $readable[0]; $month = $readable[1]; diff --git a/src/view/form/control/AphrontFormDateControlValue.php b/src/view/form/control/AphrontFormDateControlValue.php --- a/src/view/form/control/AphrontFormDateControlValue.php +++ b/src/view/form/control/AphrontFormDateControlValue.php @@ -69,7 +69,7 @@ // If we have the individual parts, we read them preferentially. If we do // not, try to read the key as a raw value. This makes it so that HTTP // prefilling is overwritten by the control value if the user changes it. - if (!strlen($date) && !strlen($time)) { + if (!@strlen($date) && !@strlen($time)) { $date = $request->getStr($key); $time = null; } @@ -98,7 +98,7 @@ } $readable = $value->formatTime($epoch, 'Y!m!d!g:i A'); - $readable = explode('!', $readable, 4); + $readable = @explode('!', $readable, 4); $year = $readable[0]; $month = $readable[1]; @@ -237,7 +237,7 @@ return null; } - $all_day = !strlen($this->valueTime); + $all_day = !@strlen($this->valueTime); $zone_identifier = $this->viewer->getTimezoneIdentifier(); $result = id(new PhutilCalendarAbsoluteDateTime()) diff --git a/src/view/form/control/AphrontFormTokenizerControl.php b/src/view/form/control/AphrontFormTokenizerControl.php --- a/src/view/form/control/AphrontFormTokenizerControl.php +++ b/src/view/form/control/AphrontFormTokenizerControl.php @@ -68,7 +68,7 @@ $datasource->setViewer($this->getUser()); $placeholder = null; - if (!strlen($this->placeholder)) { + if (!@strlen($this->placeholder)) { $placeholder = $datasource->getPlaceholderText(); } diff --git a/src/view/layout/AphrontSideNavFilterView.php b/src/view/layout/AphrontSideNavFilterView.php --- a/src/view/layout/AphrontSideNavFilterView.php +++ b/src/view/layout/AphrontSideNavFilterView.php @@ -97,12 +97,12 @@ ->setName($name) ->setType($type); - if (strlen($icon)) { + if (@strlen($icon)) { $item->setIcon($icon); } - if (strlen($key)) { + if (@strlen($key)) { $item->setKey($key); } @@ -145,7 +145,7 @@ public function selectFilter($key, $default = null) { $this->selectedFilter = $default; - if ($this->menu->getItem($key) && strlen($key)) { + if ($this->menu->getItem($key) && @strlen($key)) { $this->selectedFilter = $key; } return $this->selectedFilter; diff --git a/src/view/layout/PHUICurtainPanelView.php b/src/view/layout/PHUICurtainPanelView.php --- a/src/view/layout/PHUICurtainPanelView.php +++ b/src/view/layout/PHUICurtainPanelView.php @@ -38,7 +38,7 @@ $header = null; $header_text = $this->getHeaderText(); - if (strlen($header_text)) { + if (@strlen($header_text)) { $header = phutil_tag( 'div', array( diff --git a/src/view/page/PhabricatorBarePageView.php b/src/view/page/PhabricatorBarePageView.php --- a/src/view/page/PhabricatorBarePageView.php +++ b/src/view/page/PhabricatorBarePageView.php @@ -97,7 +97,7 @@ if ($viewer) { $postprocessor_key = $viewer->getUserSetting( PhabricatorAccessibilitySetting::SETTINGKEY); - if (strlen($postprocessor_key)) { + if (@strlen($postprocessor_key)) { $response->setPostProcessorKey($postprocessor_key); } } diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php --- a/src/view/page/PhabricatorStandardPageView.php +++ b/src/view/page/PhabricatorStandardPageView.php @@ -114,7 +114,7 @@ $patterns = $this->getQuicksandURIPatternBlacklist(); $path = $request->getRequestURI()->getPath(); foreach ($patterns as $pattern) { - if (preg_match('(^'.$pattern.'$)', $path)) { + if (@preg_match('(^'.$pattern.'$)', $path)) { return true; } } @@ -183,12 +183,12 @@ $prefix = $this->getGlyph(); } else { $application_name = $this->getApplicationName(); - if (strlen($application_name)) { + if (@strlen($application_name)) { $prefix = '['.$application_name.']'; } } - if (strlen($prefix)) { + if (@strlen($prefix)) { $title = $prefix.' '.$title; } @@ -612,19 +612,19 @@ // Try to guess the device resolution based on UA strings to avoid a flash // of incorrectly-styled content. $device_guess = 'device-desktop'; - if (preg_match('@iPhone|iPod|(Android.*Chrome/[.0-9]* Mobile)@', $agent)) { + if (@preg_match('@iPhone|iPod|(Android.*Chrome/[.0-9]* Mobile)@', $agent)) { $device_guess = 'device-phone device'; - } else if (preg_match('@iPad|(Android.*Chrome/)@', $agent)) { + } else if (@preg_match('@iPad|(Android.*Chrome/)@', $agent)) { $device_guess = 'device-tablet device'; } $classes[] = $device_guess; - if (preg_match('@Windows@', $agent)) { + if (@preg_match('@Windows@', $agent)) { $classes[] = 'platform-windows'; - } else if (preg_match('@Macintosh@', $agent)) { + } else if (@preg_match('@Macintosh@', $agent)) { $classes[] = 'platform-mac'; - } else if (preg_match('@X11@', $agent)) { + } else if (@preg_match('@X11@', $agent)) { $classes[] = 'platform-linux'; } diff --git a/src/view/page/menu/PhabricatorMainMenuView.php b/src/view/page/menu/PhabricatorMainMenuView.php --- a/src/view/page/menu/PhabricatorMainMenuView.php +++ b/src/view/page/menu/PhabricatorMainMenuView.php @@ -333,7 +333,7 @@ $wordmark_text = PhabricatorCustomLogoConfigType::getLogoWordmark(); - if (!strlen($wordmark_text)) { + if (!@strlen($wordmark_text)) { $wordmark_text = pht('Phabricator'); } diff --git a/src/view/phui/PHUIInfoView.php b/src/view/phui/PHUIInfoView.php --- a/src/view/phui/PHUIInfoView.php +++ b/src/view/phui/PHUIInfoView.php @@ -147,7 +147,7 @@ } $title = $this->title; - if ($title || strlen($title)) { + if ($title || @strlen($title)) { $title = phutil_tag( 'h1', array( diff --git a/src/view/phui/PHUIObjectItemListView.php b/src/view/phui/PHUIObjectItemListView.php --- a/src/view/phui/PHUIObjectItemListView.php +++ b/src/view/phui/PHUIObjectItemListView.php @@ -120,7 +120,7 @@ require_celerity_resource('phui-oi-color-css'); $header = null; - if (strlen($this->header)) { + if (@strlen($this->header)) { $header = phutil_tag( 'h1', array( diff --git a/src/view/phui/PHUIObjectItemView.php b/src/view/phui/PHUIObjectItemView.php --- a/src/view/phui/PHUIObjectItemView.php +++ b/src/view/phui/PHUIObjectItemView.php @@ -659,7 +659,7 @@ $this->getImageIcon()); } - if ($image && (strlen($this->href) || strlen($this->imageHref))) { + if ($image && (@strlen($this->href) || @strlen($this->imageHref))) { $image_href = ($this->imageHref) ? $this->imageHref : $this->href; $image = phutil_tag( 'a', @@ -873,7 +873,7 @@ 'class' => 'phui-oi-status-icon', ); - if (strlen($label)) { + if (@strlen($label)) { $options['sigil'] = 'has-tooltip'; $options['meta'] = array('tip' => $label, 'size' => 300); } @@ -890,7 +890,7 @@ 'style' => 'background-image: url('.$handle->getImageURI().')', ); - if (strlen($label)) { + if (@strlen($label)) { $options['sigil'] = 'has-tooltip'; $options['meta'] = array('tip' => $label, 'align' => 'E'); } diff --git a/src/view/phui/PHUISegmentBarSegmentView.php b/src/view/phui/PHUISegmentBarSegmentView.php --- a/src/view/phui/PHUISegmentBarSegmentView.php +++ b/src/view/phui/PHUISegmentBarSegmentView.php @@ -55,7 +55,7 @@ $left = sprintf('%.2f%%', $left); $tooltip = $this->tooltip; - if (strlen($tooltip)) { + if (@strlen($tooltip)) { Javelin::initBehavior('phabricator-tooltips'); $sigil = 'has-tooltip'; diff --git a/src/view/phui/PHUISegmentBarView.php b/src/view/phui/PHUISegmentBarView.php --- a/src/view/phui/PHUISegmentBarView.php +++ b/src/view/phui/PHUISegmentBarView.php @@ -30,7 +30,7 @@ require_celerity_resource('phui-segment-bar-view-css'); $label = $this->label; - if (strlen($label)) { + if (@strlen($label)) { $label = phutil_tag( 'div', array( diff --git a/src/view/phui/PHUITagView.php b/src/view/phui/PHUITagView.php --- a/src/view/phui/PHUITagView.php +++ b/src/view/phui/PHUITagView.php @@ -126,7 +126,7 @@ } protected function getTagName() { - return strlen($this->href) ? 'a' : 'span'; + return @strlen($this->href) ? 'a' : 'span'; } public function setContextObject($context_object) { diff --git a/src/view/viewutils.php b/src/view/viewutils.php --- a/src/view/viewutils.php +++ b/src/view/viewutils.php @@ -87,7 +87,7 @@ // Some obscure timezones just render as "+03" or "-09". Make these render // as "UTC+3" instead. - if (preg_match('/^[+-]/', $timezone)) { + if (@preg_match('/^[+-]/', $timezone)) { $timezone = (int)trim($timezone, '+'); if ($timezone < 0) { $timezone = pht('UTC-%s', $timezone); diff --git a/support/startup/PhabricatorStartup.php b/support/startup/PhabricatorStartup.php --- a/support/startup/PhabricatorStartup.php +++ b/support/startup/PhabricatorStartup.php @@ -178,7 +178,7 @@ // Even though we should be emitting this as text-plain, escape things // just to be sure since we can't really be sure what the program state // is when we get here. - $msg .= htmlspecialchars( + $msg .= @htmlspecialchars( $event['message']."\n\n".$event['file'].':'.$event['line'], ENT_QUOTES, 'UTF-8'); @@ -393,7 +393,7 @@ // If we have libxml, disable the incredibly dangerous entity loader. if (function_exists('libxml_disable_entity_loader')) { - libxml_disable_entity_loader(true); + @libxml_disable_entity_loader(true); } // See T13060. If the locale for this process (the parent process) is not @@ -485,7 +485,7 @@ } $_REQUEST = array(); - for ($ii = 0; $ii < strlen($order); $ii++) { + for ($ii = 0; $ii < @strlen($order); $ii++) { switch ($order[$ii]) { case 'G': $_REQUEST = array_merge($_REQUEST, $_GET); @@ -593,7 +593,7 @@ // to "$_REQUEST" here won't always work, because later code may rebuild // "$_REQUEST" from other sources. - if (isset($_REQUEST['__path__']) && strlen($_REQUEST['__path__'])) { + if (isset($_REQUEST['__path__']) && @strlen($_REQUEST['__path__'])) { self::setRequestPath($_REQUEST['__path__']); return; } @@ -611,7 +611,7 @@ "are not configured correctly."); } - if (!strlen($_REQUEST['__path__'])) { + if (!@strlen($_REQUEST['__path__'])) { self::didFatal( "Request parameter '__path__' is set, but empty. Your rewrite rules ". "are not configured correctly. The '__path__' should always ". diff --git a/support/startup/preamble-utils.php b/support/startup/preamble-utils.php --- a/support/startup/preamble-utils.php +++ b/support/startup/preamble-utils.php @@ -21,7 +21,7 @@ } $forwarded_for = $_SERVER['HTTP_X_FORWARDED_FOR']; - if (!strlen($forwarded_for)) { + if (!@strlen($forwarded_for)) { return; } @@ -47,7 +47,7 @@ // and proxies. In this case, we want to take the Nth-to-last element of // the list. - $addresses = explode(',', $raw_header); + $addresses = @explode(',', $raw_header); // If we have more than one trustworthy device on the network path, discard // corresponding elements from the list. For example, if we have 7 devices, diff --git a/webroot/rsrc/externals/javelin/core/install.js b/webroot/rsrc/externals/javelin/core/install.js --- a/webroot/rsrc/externals/javelin/core/install.js +++ b/webroot/rsrc/externals/javelin/core/install.js @@ -243,7 +243,7 @@ // Build getters and setters from the `prop' map. for (k in (junk.properties || {})) { - var base = k.charAt(0).toUpperCase() + k.substr(1); + var base = k.charAt(0).toUpperCase() + k.@substr(1); var prop = '__auto__' + k; proto[prop] = junk.properties[k]; proto['set' + base] = setter(prop); diff --git a/webroot/rsrc/externals/javelin/ext/fx/Color.js b/webroot/rsrc/externals/javelin/ext/fx/Color.js --- a/webroot/rsrc/externals/javelin/ext/fx/Color.js +++ b/webroot/rsrc/externals/javelin/ext/fx/Color.js @@ -13,7 +13,7 @@ rgbToHex: function(str, as_array) { var rgb = str.match(JX.Color.rgbRegex); var hex = [0, 1, 2].map(function(index) { - return ('0' + (rgb[index] - 0).toString(16)).substr(-2, 2); + return ('0' + (rgb[index] - 0).toString(16)).@substr(-2, 2); }); return as_array ? hex : '#' + hex.join(''); }, diff --git a/webroot/rsrc/externals/javelin/lib/History.js b/webroot/rsrc/externals/javelin/lib/History.js --- a/webroot/rsrc/externals/javelin/lib/History.js +++ b/webroot/rsrc/externals/javelin/lib/History.js @@ -213,9 +213,9 @@ _parseFragment : function(fragment) { if (fragment) { if (fragment.charAt(1) === '!') { - return fragment.substr(2); - } else if (fragment.substr(1, 2) === '~!') { - return fragment.substr(3); + return fragment.@substr(2); + } else if (fragment.@substr(1, 2) === '~!') { + return fragment.@substr(3); } } return null; diff --git a/webroot/rsrc/externals/javelin/lib/__tests__/Cookie.js b/webroot/rsrc/externals/javelin/lib/__tests__/Cookie.js --- a/webroot/rsrc/externals/javelin/lib/__tests__/Cookie.js +++ b/webroot/rsrc/externals/javelin/lib/__tests__/Cookie.js @@ -35,7 +35,7 @@ c.setValue(value); c.write(); - var data = doc.cookie.substr(0, doc.cookie.indexOf(';')); + var data = doc.cookie.@substr(0, doc.cookie.indexOf(';')); // Make sure the raw value is all escaped expect(data).toEqual( diff --git a/webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadSource.js b/webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadSource.js --- a/webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadSource.js +++ b/webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadSource.js @@ -257,7 +257,7 @@ seen[t[ii]] = true; var fragment = t[ii]; for (var name_fragment in this._lookup) { - if (name_fragment.substr(0, fragment.length) === fragment) { + if (name_fragment.@substr(0, fragment.length) === fragment) { if (!(name_fragment in matched)) { matched[name_fragment] = true; } else { diff --git a/webroot/rsrc/js/application/diffusion/DiffusionLocateFileSource.js b/webroot/rsrc/js/application/diffusion/DiffusionLocateFileSource.js --- a/webroot/rsrc/js/application/diffusion/DiffusionLocateFileSource.js +++ b/webroot/rsrc/js/application/diffusion/DiffusionLocateFileSource.js @@ -46,9 +46,9 @@ for (var ii = 0; ii < paths.length; ii++) { var path = paths[ii]; var name = []; - name.push(path.path.substr(0, path.pos)); + name.push(path.path.@substr(0, path.pos)); name.push( - JX.$N('strong', {}, path.path.substr(path.pos, path.score))); + JX.$N('strong', {}, path.path.@substr(path.pos, path.score))); var pos = path.score; var lower = path.path.toLowerCase(); @@ -65,7 +65,7 @@ } if (jj < path.path.length - 1 ) { - name.push(path.path.substr(jj + 1)); + name.push(path.path.@substr(jj + 1)); } var attr = { @@ -108,7 +108,7 @@ for (var k in this.cache) { if ((k.length <= search.length) && (k.length > best) && - (search.substr(0, k.length) == k)) { + (search.@substr(0, k.length) == k)) { best = k.length; start = this.cache[k]; }