php 5.4.12

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Scam Warning

php 5.4.12

Postby DoYouSpeakWak » Fri Feb 22, 2013 8:44 pm

Hey all

Today i upgraded my servers to php 5.4.12, But right after i was greeted with this php debug notice

Code: Select all
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion


Board is vanila and latest. no changes. And this error did not show up 2 hours earlier.

Any ideas on what the cause can be and if a bug report to php.net should be submitted, what should it include.

Wak
Whatever you share comes back. Support the phpBB Communities
My Validated and Released Modifications
User avatar
DoYouSpeakWak
Jr. MOD Validator
 
Posts: 2200
Joined: Fri Jul 25, 2008 1:32 pm
Location: Island of Wak-Wak
Name: Mikkel koch

Re: php 5.4.12

Postby rxu » Sat Feb 23, 2013 3:50 am

For phpBB 3.0.11 includes/session.php there's line 2208:
Code: Select all
return strtr(@gmdate($date_cache[$format]['format_long'], $gmepoch + $zone_offset), $date_cache[$format]['lang']);

Here, strtr() with 2 arguments has been used. As per the PHP manual, in this case the second argument should be an array in the form array('from' => 'to', ...).
But $user->lang['datetime'] (see language/en/common.php 'datetime' entry) is a multidimensional array having subarray of
Code: Select all
      'AGO'      => array(
         0      => 'less than a minute ago',
         1      => '%d minute ago',
         2      => '%d minutes ago',
         60      => '1 hour ago',
      ),


If you put this block of code into comment (/*...*/), the error is gone.

So, with PHP 5.4.12 this pretty much looks like a phpBB bug.

You can temporarily fix the issue by suppressing the error output adding @ sign at the front of strtr call:
Code: Select all
return @strtr(@gmdate($date_cache[$format]['format_long'], $gmepoch + $zone_offset), $date_cache[$format]['lang']);

This is not an actual fix but getting rid of the error messages only. This bug shouldn't affect the board features operation though.
rxu
Former Team Member
 
Posts: 1601
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan Uzdenov

Re: php 5.4.12

Postby wang5555 » Sat Feb 23, 2013 6:24 am

rxu wrote:You can temporarily fix the issue by suppressing the error output adding @ sign at the front of strtr call:
Code: Select all
return @strtr(@gmdate($date_cache[$format]['format_long'], $gmepoch + $zone_offset), $date_cache[$format]['lang']);

This is not an actual fix but getting rid of the error messages only. This bug shouldn't affect the board features operation though.

Thanks very much. :D
It is more blessed to give than to reveive, welcome to letter, thanks & good-bye!
Good luck ^_^
Welcome to my forum!!
p.s. Shut down computer before 11 clock night!!!
User avatar
wang5555
Translator
 
Posts: 509
Joined: Wed Oct 27, 2004 2:57 pm
Location: Taiwan

Re: php 5.4.12

Postby DoYouSpeakWak » Sat Feb 23, 2013 8:46 am

Thx for the fix rxu.

Bug ticket opened.

http://tracker.phpbb.com/browse/PHPBB3-11361

rxu wrote:This is not an actual fix but getting rid of the error messages only. This bug shouldn't affect the board features operation though.


Sadly not. ucp,mcp,acp doesnt really work with this error and debug,debug extra on. lets hope it gets fixed in the next version. until then not that many will use this latest version of php.
Whatever you share comes back. Support the phpBB Communities
My Validated and Released Modifications
User avatar
DoYouSpeakWak
Jr. MOD Validator
 
Posts: 2200
Joined: Fri Jul 25, 2008 1:32 pm
Location: Island of Wak-Wak
Name: Mikkel koch

Re: php 5.4.12

Postby bantu » Sat Feb 23, 2013 10:00 am

Please try 'lang' => array_filter($this->lang['datetime'], 'is_string'), in $date_cache[$format] = array( definition.
Powered by Coffee
User avatar
bantu
3.0 Release Manager
3.0 Release Manager
 
Posts: 2365
Joined: Mon Jul 10, 2006 9:58 pm
Location: Karlsruhe, Germany
Name: Andreas Fischer

Re: php 5.4.12

Postby RMcGirr83 » Sat Feb 23, 2013 11:09 am

Any mods installed?
User avatar
RMcGirr83
Former Team Member
 
Posts: 16046
Joined: Wed Jun 22, 2005 4:33 pm
Location: Connecticut USA
Name: Rich McGirr

Re: php 5.4.12

Postby HGN » Sat Feb 23, 2013 11:19 am

DoYouSpeakWak wrote:Board is vanila and latest. no changes.
User avatar
HGN
Former Team Member
 
Posts: 4706
Joined: Wed Dec 03, 2008 1:53 pm
Location: The Netherlands
Name: Alfred

Re: php 5.4.12

Postby RMcGirr83 » Sat Feb 23, 2013 11:37 am

Damn it...lack of coffee intake
User avatar
RMcGirr83
Former Team Member
 
Posts: 16046
Joined: Wed Jun 22, 2005 4:33 pm
Location: Connecticut USA
Name: Rich McGirr

Re: php 5.4.12

Postby DoYouSpeakWak » Sat Feb 23, 2013 12:03 pm

bantu wrote:Please try 'lang' => array_filter($this->lang['datetime'], 'is_string'), in $date_cache[$format] = array( definition.


Tried with this. i assume thats what you meant.

Code: Select all
         // Is the user requesting a friendly date format (i.e. 'Today 12:42')?
         $date_cache[$format] = array(
            'is_short'      => strpos($format, '|'),
            'format_short'   => substr($format, 0, strpos($format, '|')) . '||' . substr(strrchr($format, '|'), 1),
            'format_long'   => str_replace('|', '', $format),
            'lang' => array_filter($this->lang['datetime'], 'is_string'),
         );


Only the lang line that is changed. cleaned my cache rm *.php and browser cache, reloaded. same error still there.
Whatever you share comes back. Support the phpBB Communities
My Validated and Released Modifications
User avatar
DoYouSpeakWak
Jr. MOD Validator
 
Posts: 2200
Joined: Fri Jul 25, 2008 1:32 pm
Location: Island of Wak-Wak
Name: Mikkel koch

Re: php 5.4.12

Postby rxu » Sat Feb 23, 2013 3:10 pm

bantu wrote:Please try 'lang' => array_filter($this->lang['datetime'], 'is_string'), in $date_cache[$format] = array( definition.

That worked for me.
rxu
Former Team Member
 
Posts: 1601
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan Uzdenov

Re: php 5.4.12

Postby wang5555 » Sun Feb 24, 2013 2:27 am

rxu wrote:
bantu wrote:Please try 'lang' => array_filter($this->lang['datetime'], 'is_string'), in $date_cache[$format] = array( definition.

That worked for me.

+1, thanks! :D
It is more blessed to give than to reveive, welcome to letter, thanks & good-bye!
Good luck ^_^
Welcome to my forum!!
p.s. Shut down computer before 11 clock night!!!
User avatar
wang5555
Translator
 
Posts: 509
Joined: Wed Oct 27, 2004 2:57 pm
Location: Taiwan

Re: php 5.4.12

Postby bantu » Sun Feb 24, 2013 11:12 am

DoYouSpeakWak wrote:Only the lang line that is changed. cleaned my cache rm *.php and browser cache, reloaded. same error still there.

Please double check.
Powered by Coffee
User avatar
bantu
3.0 Release Manager
3.0 Release Manager
 
Posts: 2365
Joined: Mon Jul 10, 2006 9:58 pm
Location: Karlsruhe, Germany
Name: Andreas Fischer

Re: php 5.4.12

Postby DoYouSpeakWak » Thu Feb 28, 2013 7:37 pm

Checked. was my fault. had apc and did not clear its cache
Whatever you share comes back. Support the phpBB Communities
My Validated and Released Modifications
User avatar
DoYouSpeakWak
Jr. MOD Validator
 
Posts: 2200
Joined: Fri Jul 25, 2008 1:32 pm
Location: Island of Wak-Wak
Name: Mikkel koch


Return to 3.0.x Support Forum

Who is online

Users browsing this forum: Bing [Bot] and 117 guests