[FX.php List] Thoughts about line 1425 of FX.php

Gjermund Gusland Thorsen ggt667 at gmail.com
Mon Jun 15 06:57:57 MDT 2009


I looked through this and here is my suggestion.

if( is_array( $value ) ) {
	foreach( $value as $partKey => $partValue ) {
		$tmpQueryArray[] = urlencode( $key ) . urlencode( '[' . $partKey .
']' ) . '=' . urlencode( $partValue );
	}
	$tempQueryString = implode( '&', $tmpQueryArray );
	unset( $tmpQueryArray );
} else {
	$tempQueryString .= urlencode( $key ) . '=' . urlencode( $value ) . '&';
}

http://pastebin.com/f31ef9b88

ggt

2009/6/11 Steve Winter <steve at bluecrocodile.co.nz>:
> Hi Chris,
> Yeah I do... that wasn't a complete copy-paste from Eclipse into the email,
> so I stuffed it up slightly in the email, now corrected below...
> cheers
> Steve
>
> On 11 Jun 2009, at 16:16, Chris Hansen wrote:
>
> Steve,
>
> Yes this would be a good addition to FX, and yes, I've seen this error
> before in specific situations.  Kudos for actually doing something about it
> (don't I feel sheepish... =)  Looks like a good addition to me, though it
> does appear that you've got an extra concatenation operator within your
> foreach() loop.
>
> --Chris
>
> On Jun 10, 2009, at 1:34 PM, Steve Winter wrote:
>
> Partially answering my own question, but not wanting to stifle the raging
> debate ;-) I turned line 1425 into;
>
> if(is_array($value)) {
>
>       foreach($value as $partKey => $partValue) {
>
>                   $tempQueryString .= urlencode($key) .
> urlencode('['.$partKey.']') . '=' . urlencode($partValue) . '&';
>
>             }
>
>        } else {
>
>             $tempQueryString .= urlencode($key) . '=' . urlencode($value) .
> '&';
>
>        }
>
> which seems to make the error go away (which is always nice ;-). Anyone see
> any issues with this...?
>
> Cheers
>
> Steve
>
>
> On 10 Jun 2009, at 18:13, Steve Winter wrote:
>
> Hi all,
>
> Not sure if anyone's ever seen this wee error;
>
> Warning: urlencode() expects parameter 1 to be string, array given in
> /path/to/fx/FX.php on line 1425
>
> but I periodically get it, and today I decided to try and find out why...
>
> Turns out that the function it's part of BuildLinkQueryString () is taking
> the posted parameters and attempting to create a nice URL friendly string...
>
> Nice idea and all that, and maybe I'm the only one who ever does it, but I
> periodically push form data into an array, and it's that which is causing
> the issue...
>
> So, does anyone know how important (or not) that function is to the internal
> workings of FX...? it appears that it's attempting to create the old CDML
> style LinkNext, LinkPrevious type URL strings... anyone ever use those these
> days...?? Is this data also sued for anything else, I don't think so, since
> previously I've just ignored the error, with seemingly no ill effects...
>
> If it is as legacy as it looks, is it perhaps time to retire that
> function...? Any thoughts on how to deal with the array concept in post
> variables...? I guess the array could be exploded and then rebuilt as a
> strong in the form array[]=fred&array[]=spoon&array[]=lives&array[]here but
> if it's not needed....???
>
> Cheers
>
> Steve
>
>
> Steve Winter
>
> steve at bluecrocodile.co.nz
>
> m: +44 77 7852 4776
>
> 3 Calshot Court, Channel Way
>
> Ocean Village, Southampton SO14 3GR
>
> _______________________________________________
>
> FX.php_List mailing list
>
> FX.php_List at mail.iviking.org
>
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
> Steve Winter
>
> steve at bluecrocodile.co.nz
>
> m: +44 77 7852 4776
>
> 3 Calshot Court, Channel Way
>
> Ocean Village, Southampton SO14 3GR
>
> _______________________________________________
>
> FX.php_List mailing list
>
> FX.php_List at mail.iviking.org
>
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
> Steve Winter
> steve at bluecrocodile.co.nz
> m: +44 77 7852 4776
> 3 Calshot Court, Channel Way
> Ocean Village, Southampton SO14 3GR
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>


More information about the FX.php_List mailing list