Hi plg
PHP: 5.2.17 [2014-10-03 09:03:27]
Does not work it is a new version of the plugn!
Email send.
Offline
Plg,
nl2br accepts a second param only from 5.3
Mistic made a change (which I approved because i thought without side effect) by dropping the accepted number of args for event handlers. However builtiin php functions might trigger warnings.
Two solutions:
1. Replace this particular issue with our own nl2br wrapper
2. Put back optionally the number of args and call accordingly (also provide backward compatibility)
I think 1. Is the fastest to implement...
Offline
OK, so in Piwigo 2.6, we had by default $accepted_args=1 on add_event_handler, which was fine for nl2br. Now in Piwigo 2.7, we accept all arguments.
I see that:
trigger_change('render_element_description', $picture['current']['comment'], 'picture_page_element_description' )
The 2nd argument is not related to the 2nd argument $is_xhtml :
string nl2br ( string $string [, bool $is_xhtml = true ] )
So I agree with you, we'd better use our own pwg_nl2br for this specific case. Something like this?
function pwg_nl2br($string) { // echo '['.__FUNCTION__.'] nb args = '.func_num_args().'<br>'; // => gives 2 return nl2br($string); }
Offline
Exactly and use it as event handler in picture.php and common.inc.php
Offline
Konve, nrms or manuvui can you test this change with your PHP 5.2 ?
[pierrick@pierrick-desktop] ~/public_html/piwigo/dev/trunk $ svn diff picture.php Index: picture.php =================================================================== --- picture.php (revision 29781) +++ picture.php (working copy) @@ -137,7 +137,11 @@ // add default event handler for rendering element content add_event_handler('render_element_content', 'default_picture_content'); // add default event handler for rendering element description -add_event_handler('render_element_description', 'nl2br'); +add_event_handler('render_element_description', 'pwg_nl2br'); +function pwg_nl2br($string) +{ + return nl2br($string); +} trigger_notify('loc_begin_picture');
Offline
Hello, plg!
Sorry, but I do not understand.
What exactly should I do?
First, I need to update to 2.7 , and then make changes to the code? In what file?
Offline
On Piwigo 2.7.0, in file picture.php, replace:
add_event_handler('render_element_description', 'nl2br');
by
add_event_handler('render_element_description', 'pwg_nl2br'); function pwg_nl2br($string) { return nl2br($string); }
Offline
Hi plg,
I managed to resolve the issue by updating the PHP used to 5.4 with my web host (they allow use of 5.2, 5.3 or 5.4). After switching to 5.4 the issue went away.
It did introduce a new issue where thumbnails and other non-original sizes of photos weren't being generated. Managed to fix that using the info found on here at
http://piwigo.org/forum/viewtopic.php?id=22796
Thanks :)
Hi all,
I had the same issue and after asking my friend google ended up here. The change of
add_event_handler('render_element_description', 'pwg_nl2br');
function pwg_nl2br($string)
{
return nl2br($string);
}
to the picture.php file fixed the error.
Thank you!
Site is using PHP ver. 5.2.17
plg - Your code example fixed it in picture.php. Thank You!
Thanks Plg
All working correctly after code changes in picture.php
Offline
Offline