Hi all,
playing around with PHP 6 I noticed the following BC issue:
floatval("4.2foo") gives an E_NOTICE
"A non well formed numeric value
encountered". The type casting (float)"4.2foo" still works as before.
The change was introduced with the conversion of floatval()
to
zend_parse_parameters with revision 1.43 of ext/standard/type.c on
2006/09/24 18:23:47 by pollita (PHP6 Updates).
In my opinion floatval()
should be restored to the previous behavour
because a) the documentation for floatval itself uses a non well formed
value in the example and b) to keep it the same as type casting to (float).
Or would the proper procedure for me be to open a ticket in the bug tracker?
- Chris
Hi Christian,
On Tue, Mar 4, 2008 at 3:17 PM, Christian Schneider
cschneid@cschneid.com wrote:
Hi all,
playing around with PHP 6 I noticed the following BC issue:
floatval("4.2foo") gives anE_NOTICE
"A non well formed numeric value
encountered". The type casting (float)"4.2foo" still works as before.The change was introduced with the conversion of
floatval()
to
zend_parse_parameters with revision 1.43 of ext/standard/type.c on
2006/09/24 18:23:47 by pollita (PHP6 Updates).In my opinion
floatval()
should be restored to the previous behavour
because a) the documentation for floatval itself uses a non well formed
value in the example and b) to keep it the same as type casting to (float).
If we keep this behavior (I don't understand this change), it would be
better to change (float) to behave like floatval, to be consistent. If
we keep the (float) casting instead, then I agree with you, floatval
notice should be removed. I prefer the second solution as it reduces
the pain to migrate, if one likes to have strict validation or
conversion it can rely on ext/filter.
Or would the proper procedure for me be to open a ticket in the bug tracker?
It would help to do not forget this problem yes :)
Thanks for your report!
Pierre
Pierre Joye wrote:
On Tue, Mar 4, 2008 at 3:17 PM, Christian Schneider
cschneid@cschneid.com wrote:playing around with PHP 6 I noticed the following BC issue:
floatval("4.2foo") gives anE_NOTICE
"A non well formed numeric value
encountered". The type casting (float)"4.2foo" still works as before.Or would the proper procedure for me be to open a ticket in the bug tracker?
It would help to do not forget this problem yes :)
I opened a bug report yesterday as you recommended and it was marked
bogus. As I never got another answer apart from yours here I wonder if
this BC break is thus intentional and what the motivation behind it is.
Do we have to change all floatval()
to (float) to be safe from suprises
from PHP 6?
- Chris
On Wed, Mar 26, 2008 at 12:27 PM, Christian Schneider
cschneid@cschneid.com wrote:
Pierre Joye wrote:
On Tue, Mar 4, 2008 at 3:17 PM, Christian Schneider
cschneid@cschneid.com wrote:playing around with PHP 6 I noticed the following BC issue:
floatval("4.2foo") gives anE_NOTICE
"A non well formed numeric value
encountered". The type casting (float)"4.2foo" still works as before.Or would the proper procedure for me be to open a ticket in the bug tracker?
It would help to do not forget this problem yes :)
I opened a bug report yesterday as you recommended and it was marked
bogus. As I never got another answer apart from yours here I wonder if
this BC break is thus intentional and what the motivation behind it is.Do we have to change all
floatval()
to (float) to be safe from suprises
from PHP 6?
I don't see why it has been bogufied. It should be either fixed (as
you described) or the documentation has to be updated (move the bug to
the doc category).
Which # is it?
--
Pierre
http://blog.thepimp.net | http://www.libgd.org
Em Qua, 2008-03-26 às 12:55 +0100, Pierre Joye escreveu:
I don't see why it has been bogufied. It should be either fixed (as
you described) or the documentation has to be updated (move the bug to
the doc category).Which # is it?
Re-opened. http://bugs.php.net/bug.php?id=44533
--
Regards,
Felipe Pena.
Which # is it?
Re-opened. http://bugs.php.net/bug.php?id=44533
So it's just gives additional notice? That's a bit strange since intval
doesn't, and neither does (float). I see no reason for floatval()
to be
different from others.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Am 26.03.2008 um 20:48 schrieb Stanislav Malyshev:
Which # is it?
Re-opened. http://bugs.php.net/bug.php?id=44533So it's just gives additional notice? That's a bit strange since
intval doesn't, and neither does (float). I see no reason for
floatval()
to be different from others.
I agree but the reason it is different right now is that floatval has
been changed to use zend_parse_parameters().
I'm not sure how this is best solved as I didn't want to revert it
back to zend_get_parameters_ex(), otherwise I would have provided a
patch.
- Chris