Re: Strange conversion
| From: | Derick Rethans | Date: | Sun, 17 Dec 2000 17:57:42 +0000 |
| Subject: | Re: Strange conversion | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-41677@lists.php.net to get a copy of this message | ||
php4@developersdesk.com wrote:
>
> Addressed to: Derick Rethans <d.rethans@jdimedia.nl>
> Stanislav Malyshev <stas@zend.com>
> php-dev@lists.php.net
>
> ** Reply to note from Derick Rethans <d.rethans@jdimedia.nl> Sun, 17 Dec 2000 16:50:15
> +0100
> >
> > Stanislav Malyshev wrote:
> > >
> > > DR>> I have no problem changing all the functions in strings.c to check if no
> > > DR>> array is passed. I simply find it strange that an array is converted to
> > >
> > > That would be silly thing to do. convert_to_string_ex should be changed,
> > > not every function using it. That's the purpose of making functions, after
> > > all.
> > >
> > > DR>> the string "Array", when it is taken as a function parameter.
> > > DR>> Another
> > >
> > > That's PHP 3 legacy, I guess.
> >
> > I can't imagine that anyone relies on this, so I think it could be
> > changed without pain. What do you think?
>
> I think I may have used this in PHP. I know I have used it in Perl.
> It allows a function to work with either a single string, or a list.
> If the content of the incoming variable is 'Array' then you pass it
> thru a foreach, or while to handle all the parts - else you handle
> the single scalar. Many Perl functions work this way, even the built
> in ones.
What happens here is that any array passwd to a "String-function" gets
converted to the string "Array", no matter what the contents of the
array is. So it seems somebody is relying on this, how strange it seems
to me. So I guess, we'll have to use a notice message for this. I'll
do a patch on this, if nobody objects.
Derick Rethans
---------------------------------------------------------------------
PHP: Scripting the Web - www.php.net - derick@php.net
---------------------------------------------------------------------
JDI Media Solutions - www.jdimedia.nl - d.rethans@jdimedia.nl
H.v. Tussenbroekstraat 1 - 6952 BL Dieren - The Netherlands
---------------------------------------------------------------------
"I don't have a solution but I admire the problem."
---------------------------------------------------------------------