Re: [Phpslash-devel] RC2 pslGetText/getMessage gotcha
Brought to you by:
joestewart,
nhruby
From: Joe S. <joe...@us...> - 2003-02-11 20:22:48
|
On Tue, Feb 11, 2003 at 06:00:52PM +0000, Peter Cruickshank wrote: > This took me a while to pin down... > > A. Extract from pslGetText: > } elseif ($_PSL['debug'] AND ($pslstrings)) { > $string = getMessage( $string, "messageStrike"); > } > > B. Extract from getMessage: > $templ->set_var(array( > 'ERROR' => pslgetText($msg) > )); > > A + B = Recursion of death if debugging's on and pslGetText is given a string with no translation. > Of course, that is exactly what we are trying to find by striking the text. :) The bug was introduced by adding the pslgetText to B) on January 14. > In my code, I've added a third parameter to getMessage: > function getMessage($msg, $tpl="", $translate=true) { > : > : > : > $templ->set_var(array( > 'ERROR' => $translate ? pslgetText($msg) : $msg > )); > : > > - ie pslGetText can tell getMessage to print the string nicely, without trying to translate it. > > There may be a more elegant solution. > I don't have one yet. Go ahead and commit. thanks for catching this. I think it bit me on one test install. I couldn't use debug sitewide, but could enable/disable selectively. Joe > Peter > > > > ----------------------------- > Peter Cruickshank > Tel: +44 7092 086 881 > email: pe...@kr... > |