Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] PHP6 & floatval() BC issue [RSS Feed]

#1 March 4, 2008 14:18:02

Christian S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PHP6 & floatval() BC issue


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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#2 March 4, 2008 14:29:37

Pierre J.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PHP6 & floatval() BC issue


Hi Christian,

On Tue, Mar 4, 2008 at 3:17 PM, Christian Schneider
<> wrote:
> 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).

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!
--
Pierrehttp://blog.thepimp.net|http://www.libgd.org--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#3 March 26, 2008 12:28:00

Christian S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PHP6 & floatval() BC issue


Pierre Joye wrote:
> On Tue, Mar 4, 2008 at 3:17 PM, Christian Schneider
> <> wrote:
>> 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.
>
>> 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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#4 March 26, 2008 12:56:13

Pierre J.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PHP6 & floatval() BC issue


On Wed, Mar 26, 2008 at 12:27 PM, Christian Schneider
<> wrote:
> Pierre Joye wrote:
> > On Tue, Mar 4, 2008 at 3:17 PM, Christian Schneider
> > <> wrote:
>
> >> 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.
> >
>
> >> 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?

--
Pierrehttp://blog.thepimp.net|http://www.libgd.org--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#5 March 26, 2008 13:02:37

Felipe P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PHP6 & floatval() BC issue


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.


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#6 March 26, 2008 20:48:56

Stanislav M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PHP6 & floatval() BC issue


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 intvaldoesn't, and neither does (float). I see no reason for floatval() to bedifferent from others.--
Stanislav Malyshev, Zend Software Architect
http://www.zend.com/(408)253-8829 MSN:

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#7 March 26, 2008 23:47:27

Christian S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PHP6 & floatval() BC issue


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 sinceintval doesn't, and neither does (float). I see no reason forfloatval() to be different from others.I agree but the reason it is different right now is that floatval hasbeen changed to use zend_parse_parameters().I'm not sure how this is best solved as I didn't want to revert itback to zend_get_parameters_ex(), otherwise I would have provided apatch.- Chris


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

  • Root
  • » PHP
  • » [PHP-DEV] PHP6 & floatval() BC issue [RSS Feed]

Board footer

Moderator control

Enjoy the 11th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support