-
Bug
-
Resolution: Duplicate
-
Trivial
-
3.0.11
-
None
-
None
-
php 5.5.0
I'm not entirely sure when this started, but it must be in between php 5.3.2 and 5.5.0. Anyway, the thing is php will now output a notice when strtr is called with multidimensional $replace_pairs array, even if the array entries are not used.
And this is precisely what occurs in includes/sessions.php, where format_date will call strtr with one array in the $date_cache[$format]['lang'] entry (the AGO key).
From my experience, the result is not altered, strtr works just as before, but throws a notice on recent versions.
<?php
|
$str = 'hi all, I said hello';
|
$replace_pairs = array(
|
'all' => 'everybody',
|
'unused' => array('somtehing', 'something else'),
|
'hello' => 'hey',
|
);
|
// php 5.5.0 Notice: Array to string conversion in test.php on line 9
|
echo strtr($str, $replace_pairs); // hi everybody, I said hey
|
Replacing strtr with @strtr seems a working solution.
- duplicates
-
PHPBB-11361 "Array to string conversion" error in $user->format_date()
- Closed