Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Mysterious urlencode() error
I’m updating spf_js for Textpattern 4.6. It’s almost done and works, except for the following browser error whenever I click on the Javascript tab (activating the plugin):
Warning “urlencode() expects parameter 1 to be string, array given”.
I’ve no idea where this is coming from – the urlencode function isn’t explicitly called by the plugin (though it may be buried in a Textpattern function called somewhere).
Could anyone shed any light please?
Thanks.
Offline
Re: Mysterious urlencode() error
Is the plugin code in its current state publicly available?
Just a stab in the dark:
Please open a developer console (Firebug) prior to clicking on the tab and watch the network traffic. There might be clues in the server response to the matching GET
request.
Offline
Re: Mysterious urlencode() error
Perhaps Bert’s phpcrossref for textpattern might be useful in tracking down which txp function might be concerned. This shows you all the places where urlencode
is used in txp.
Last edited by jakob (2015-10-23 19:32:32)
TXP Builders – finely-crafted code, design and txp
Offline
Re: Mysterious urlencode() error
jakob wrote #296120:
Perhaps Bert’s phpcrossref for textpattern might be useful in tracking down which txp function might be concerned. This shows you all the places where
urlencode
is used.
what kind of url is this?
Bert’s phpcrossref for text pattern %3Ahttp%3A//phpcrossref.com/xref/textpattern/
…. texted postive
Offline
Re: Mysterious urlencode() error
Sorry, I mistakenly had two colons in the link and the link got garbled… I’ve corrected it in my post.
TXP Builders – finely-crafted code, design and txp
Offline
Re: Mysterious urlencode() error
Thanks wet & jakob for the suggestions. Still no joy I’m afraid.
I’ve posted the plugin code on Gist — a clumsy re-write of txp_css.php from 4.6-dev.
Any clues to the origin of the urlencode() warning greatfully received.
Thanks.
Offline
Re: Mysterious urlencode() error
spiffin wrote #296170:
I’ve posted the plugin code on Gist
You are trying to display an array of strings as a help text while a scalar string is expected:
$titleblock = inputLabel(
[...]
array('', 'instructions_spf_js_name'), // <=== HERE
array('class' => 'txp-form-field'),
''
);
You can easily find the location of such errors by setting a breakpoint at the start of both adminErrorHandler()
and pluginErrorHandler()
and inspecting the call stack once the breakpoint fires.
Unrelated: One cannot compare versions like that:
[...] txp_version >= '4.5.7' [...]
$ php -r "echo '10.1.1' > '4.5.7' ? 'true' : 'false';"
false
$ php -r "echo '4.10.0' > '4.5.7' ? 'true' : 'false';"
false
Use version_compare instead.
Offline
Re: Mysterious urlencode() error
Great – thanks for your help Robert.
Offline
Pages: 1