Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-10-23 00:14:17

spiffin
Plugin Author
From: London, UK
Registered: 2004-06-08
Posts: 95
Website

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

#2 2015-10-23 05:50:12

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

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

#3 2015-10-23 05:57:36

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,595
Website

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

#4 2015-10-23 16:42:35

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,075
Website Mastodon

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

#5 2015-10-23 19:32:10

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,595
Website

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

#6 2015-10-23 20:31:05

spiffin
Plugin Author
From: London, UK
Registered: 2004-06-08
Posts: 95
Website

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

#7 2015-10-27 06:31:43

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

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

#8 2015-10-27 10:31:45

spiffin
Plugin Author
From: London, UK
Registered: 2004-06-08
Posts: 95
Website

Re: Mysterious urlencode() error

Great – thanks for your help Robert.

Offline

Board footer

Powered by FluxBB