Skip to content

Commit cba71a4

Browse files
committedMar 18, 2022
Avoid PHP8 warnings
1 parent 190c6ef commit cba71a4

7 files changed

+14
-8
lines changed
 

‎lib/helper/DateHelper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @version SVN: $Id$
1818
*/
1919

20-
function format_daterange($start_date, $end_date, $format = 'd', $full_text, $start_text, $end_text, $culture = null, $charset = null)
20+
function format_daterange($start_date, $end_date, $format = 'd', $full_text = '', $start_text = '', $end_text = '', $culture = null, $charset = null)
2121
{
2222
if ($start_date != '' && $end_date != '')
2323
{

‎lib/i18n/sfDateFormat.class.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,10 @@ public function format($time, $pattern = 'F', $inputPattern = null, $charset = '
239239
}
240240
else
241241
{
242-
$function = ucfirst($this->getFunctionName($pattern));
242+
$function = $this->getFunctionName($pattern);
243243
if ($function != null)
244244
{
245+
$function = ucfirst($function);
245246
$fName = 'get'.$function;
246247
if (in_array($fName, $this->methods))
247248
{

‎lib/routing/sfRoute.class.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ protected function generateWithTokens($parameters)
285285
switch ($token[0])
286286
{
287287
case 'variable':
288-
if (!$optional || !isset($this->defaults[$token[3]]) || $parameters[$token[3]] != $this->defaults[$token[3]])
288+
if (!$optional || !isset($this->defaults[$token[3]]) || (isset($parameters[$token[3]]) && isset($this->defaults[$token[3]]) && ($parameters[$token[3]] != $this->defaults[$token[3]])))
289289
{
290290
$url[] = urlencode($parameters[$token[3]]);
291291
$optional = false;
@@ -791,7 +791,7 @@ protected function fixDefaults()
791791
}
792792
else
793793
{
794-
$this->defaults[$key] = urldecode($value);
794+
$this->defaults[$key] = ($value) ? urldecode($value) : '';
795795
}
796796
}
797797
}

‎lib/util/sfBrowserBase.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ public function doClickElement(DOMElement $item, $arguments = array(), $options
908908
}
909909
else
910910
{
911-
$queryString = http_build_query($arguments, null, '&');
911+
$queryString = ($arguments) ? http_build_query($arguments, null, '&') : "";
912912
$sep = false === strpos($url, '?') ? '?' : '&';
913913

914914
return array($url.($queryString ? $sep.$queryString : ''), 'get', array());

‎lib/util/sfInflector.class.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ class sfInflector
2727
*/
2828
public static function camelize($lower_case_and_underscored_word)
2929
{
30-
30+
if (!$lower_case_and_underscored_word) {
31+
return $lower_case_and_underscored_word;
32+
}
3133
return strtr(ucwords(strtr($lower_case_and_underscored_word, array('/' => ':: ', '_' => ' ', '-' => ' '))), array(' ' => ''));
3234
}
3335

@@ -41,6 +43,9 @@ public static function camelize($lower_case_and_underscored_word)
4143
public static function underscore($camel_cased_word)
4244
{
4345
$tmp = $camel_cased_word;
46+
if (!$tmp) {
47+
return '';
48+
}
4449
$tmp = str_replace('::', '/', $tmp);
4550
$tmp = sfToolkit::pregtr($tmp, array('/([A-Z]+)([A-Z][a-z])/' => '\\1_\\2',
4651
'/([a-z\d])([A-Z])/' => '\\1_\\2'));

‎lib/util/sfToolkit.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ public static function replaceConstants($value)
366366
*/
367367
public static function pregtr($search, $replacePairs)
368368
{
369-
return preg_replace(array_keys($replacePairs), array_values($replacePairs), $search);
369+
return ($search) ? preg_replace(array_keys($replacePairs), array_values($replacePairs), $search) : $search;
370370
}
371371

372372
/**

‎lib/vendor/lime/lime.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ protected function find_caller($traces)
564564
return array($traces[$last]['file'], $traces[$last]['line']);
565565
}
566566

567-
public function handle_error($code, $message, $file, $line, $context)
567+
public function handle_error($code, $message, $file, $line, $context = null)
568568
{
569569
if (!$this->options['error_reporting'] || ($code & error_reporting()) == 0)
570570
{

0 commit comments

Comments
 (0)