Issues

ZF-2633: testToFloatSetlocale(Zend_Locale_FormatTest): "Zend_Locale_Math_Exception: subtraction overflow: 1234.5 - 1234 != 0,5"

Issue Type: Unit Tests: Problem Created: 2008-02-12T18:44:15.000+0000 Last Updated: 2008-03-21T16:25:47.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Alexander Veremyev (alexander) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale

Related issues: - ZF-2368

Attachments: - out.txt

Description

Error occurs while unit tests passing with the following diagnostic:

<pre class="highlight"> 
2) testToFloatSetlocale(Zend_Locale_FormatTest)
Zend_Locale_Math_Exception: subtraction overflow: 1234.5 - 1234 != 0,5
/home/cawa/ZendFramework/release-1.0/library/Zend/Locale/Format.php:399
/home/cawa/ZendFramework/release-1.0/library/Zend/Locale/Format.php:526
/home/cawa/ZendFramework/release-1.0/tests/Zend/Locale/FormatTest.php:913
/home/cawa/ZendFramework/release-1.0/tests/AllTests.php:51
/home/cawa/ZendFramework/release-1.0/tests/AllTests.php:65

Comments

Posted by Thomas Weidner (thomas) on 2008-02-13T01:47:11.000+0000

Have you tested with the branch or just with the release ??? This is part of another issue and has already been fixed in te past with the help of Darby and Sebastian.

It would be interesting if the same problem occurs within trunk or not.

Posted by Thomas Weidner (thomas) on 2008-02-13T01:49:45.000+0000

I need details... PHP Version, OS, BCMath activated, Used Locale, ZF Revision

Posted by Alexander Veremyev (alexander) on 2008-02-13T03:05:07.000+0000

It's current SVN version of release maintenance branch

I tested it using two different Linux machines.

PHP versions:

PHP 5.2.5 (cli) (built: Feb 12 2008 11:37:43) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

PHP 5.2.4 (cli) (built: Oct 16 2007 17:32:16) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies with Xdebug v2.0.2, Copyright (c) 2002-2007, by Derick Rethans

PHP 5.2.2RC2-dev (cli) (built: Feb 1 2008 01:09:49) Copyright (c) 1997-2007 The PHP Group

Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

BCMath extension is disabled (enabling bcmath extension doesn't help)

TESTS_ZEND_LOCALE_BCMATH_ENABLED tests configuration variable is set to true.

ZF revision 7971

Posted by Thomas Weidner (thomas) on 2008-02-15T02:11:33.000+0000

Can you please test with the latest release and give me response ?

Posted by Alexander Veremyev (alexander) on 2008-02-15T15:01:25.000+0000

Still fails:

<pre class="highlight">
1) testToFloatSetlocale(Zend_Locale_FormatTest)
Zend_Locale_Math_Exception: subtraction overflow: 1234.5 - 1234 != 0,5
/home/cawa/ZendFramework/release-1.0/library/Zend/Locale/Format.php:409
/home/cawa/ZendFramework/release-1.0/library/Zend/Locale/Format.php:532
/home/cawa/ZendFramework/release-1.0/tests/Zend/Locale/FormatTest.php:913
/home/cawa/ZendFramework/release-1.0/tests/Zend/Locale/AllTests.php:63
/home/cawa/ZendFramework/release-1.0/tests/Zend/Locale/AllTests.php:79

Posted by Thomas Weidner (thomas) on 2008-02-16T12:47:13.000+0000

I attached a debug version for Zend/Locale/Math/PhpMath.php

Please change yours with the debug file and return me the debug output for detail analysis. Thank you

Posted by Alexander Veremyev (alexander) on 2008-02-18T18:28:00.000+0000

Here is an output of the test code you provided (see the attachment).

Output is generated by passing Zend_Locale tests set (tests/Zend/Locale/AllTests.php).

Posted by Thomas Weidner (thomas) on 2008-02-19T14:02:48.000+0000

Unsure if it will make until 1.0.4... therefor downgrading to critical

Posted by Thomas Weidner (thomas) on 2008-02-19T15:31:19.000+0000

I attached a reworked PhpMath file. The problem is related to a autoconversion which is done even after casting to a specific type.

Please test the new version and give me feedback if it now works or if I have to find another way.

Posted by Alexander Veremyev (alexander) on 2008-02-19T16:57:09.000+0000

Aha. OK!

Here is next output (out1.txt)

Posted by Alexander Veremyev (alexander) on 2008-02-21T19:23:15.000+0000

Changeset 8266 is related to this issue (wrong issue number in the comment)

Posted by Alexander Veremyev (alexander) on 2008-02-21T19:25:55.000+0000

Fixed for trunk and release maintenance branch.

Thomas, please review the changes

Posted by Thomas Weidner (thomas) on 2008-02-22T02:26:13.000+0000

I reviewed them and found other problems related to this. I rewrote the class, now it should work in all different environments.

I have no problems in my 3 environments... can you verify that for your's ?

PS: I made the changes only to trunk ! If it works for you you can make the change also to branch (ask darby related to release date)

Posted by Alexander Veremyev (alexander) on 2008-02-22T10:21:12.000+0000

I've tested it and got a set of errors (see the attached file). I have fix for them and I'm going to commit it. Please review update.

PS Could you mention JIRA issue number within commit comments (like [ZF-xxxx])? JIRA automatically lists such commits within 'FishEye' tab for the specified issue and it's very helpful for linking changesets with issues and merging changes to branches.

Posted by Alexander Veremyev (alexander) on 2008-02-22T11:03:04.000+0000

Still have problems...

<pre class="highlight">
PHPUnit 3.2.12 by Sebastian Bergmann.

............................................................ 60 / 87
...............E...........

Time: 14 seconds

There was 1 error:

1) testToFloatSetlocale(Zend_Locale_FormatTest)
Zend_Locale_Math_Exception: subtraction overflow: 1234,5 - 1234 != 0
/home/cawa/ZendFramework/trunk/library/Zend/Locale/Format.php:414
/home/cawa/ZendFramework/trunk/library/Zend/Locale/Format.php:537
/home/cawa/ZendFramework/trunk/tests/Zend/Locale/FormatTest.php:913
/home/cawa/ZendFramework/trunk/tests/Zend/Locale/AllTests.php:63
/home/cawa/ZendFramework/trunk/tests/Zend/Locale/AllTests.php:79

FAILURES!
Tests: 87, Errors: 1.

Posted by Alexander Veremyev (alexander) on 2008-02-22T11:46:50.000+0000

Some problems still exist. Needs more complex solution.

Test is marked as skipped.

Posted by Alexander Veremyev (alexander) on 2008-02-22T11:47:56.000+0000

Priority is downgraded to postpone issue.

Posted by Thomas Weidner (thomas) on 2008-03-04T14:02:52.000+0000

Should be fixed with SVN-8532... please verify this and give me feedback... Thank you

Posted by Thomas Weidner (thomas) on 2008-03-05T10:51:52.000+0000

Fixed

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts