Re: Re: [PATCH] Notice on array to string convertion
| From: | Paul Dragoonis | Date: | Mon, 31 Oct 2011 02:55:14 +0000 |
| Subject: | Re: Re: [PATCH] Notice on array to string convertion | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-55998@lists.php.net to get a copy of this message | ||
On Mon, Oct 31, 2011 at 2:36 AM, Laruence <laruence@php.net> wrote:
> Paul:
> sure, there is some usage in ext/reflection and what was said in
> the bug report.
>
> so if there is no a argument to suppress it, these codes have to
> change to something like:
understood. indeed doesn't seem quite right.
On overriding functions in subclasses it shouldn't moan about the
declaration change (array to str cast), and only in E_STRICT mode
should it complain about the declaration change.
</$0.02>
- Paul.
> if (Z_TYPE_P(val) == IS_ARRAY) {
> } else {
> zend_make_printable_zval..
> }
>
> which is ugly.
>
> thanks
>
> 2011/10/31 Paul Dragoonis <dragoonis@gmail.com>:
>> On Sun, Oct 30, 2011 at 1:23 PM, Laruence <laruence@php.net> wrote:
>>> s /second/third/
>>
>> Laurence,
>>
>> What Jordi was saying was that in a production environment is there
>> any justified reason why you'd want to convert an array into a string,
>> otherwise it's a good thing that it reports you "Array to string" as
>> you've probably messed something up.
>>
>> Regards,
>> - Paul.
>>
>>>
>>> 2011/10/30 Laruence <laruence@php.net>:
>>>> Hi:
>>>> I don't think this(you think there is no use) can used for the
>>>> reason to do such a change.
>>>>
>>>> actully I ask for a sencond argument for zend_make_printable_zval
>>>> to suppress the warning *intentionally*.
>>>>
>>>> thanks
>>>>
>>>> 2011/10/30 Jordi Boggiano <j.boggiano@seld.be>:
>>>>> On 30.10.2011 13:19, Laruence wrote:
>>>>>> Hi:
>>>>>> like the following script:
>>>>>> <?php
>>>>>> $str = (string)array();
>>>>>> echo $str;
>>>>>>
>>>>>> it is obviously intentionally convert a array to string , but the
>>>>>> warning is coming:
>>>>>
>>>>> It is obviously intentional but also obviously pointless. You might as
>>>>> well just echo 'Array'; I don't think I have ever encountered a
>>>>> case
>>>>> where you actually want to convert an array to a string and use the
>>>>> result in a useful way.
>>>>>
>>>>> Cheers
>>>>>
>>>>> --
>>>>> Jordi Boggiano
>>>>> @seldaek - http://nelm.io/jordi
>>>>>
>>>>> --
>>>>> PHP Internals - PHP Runtime Development Mailing List
>>>>> To unsubscribe, visit:
>>>>> http://www.php.net/unsub.php
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Laruence Xinchen Hui
>>>> http://www.laruence.com/
>>>>
>>>
>>>
>>>
>>> --
>>> Laruence Xinchen Hui
>>> http://www.laruence.com/
>>>
>>> --
>>> PHP Internals - PHP Runtime Development Mailing List
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>
> --
> Laruence Xinchen Hui
> http://www.laruence.com/
>