[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/gmp gmp.c

2008-02-04 Thread Ilia Alshanetsky
iliaa   Mon Feb  4 21:31:52 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/gmpgmp.c 
/php-srcNEWS 
  Log:
  
  Revert fix for bug #43981, not yet ready for 5.2
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gmp/gmp.c?r1=1.49.2.2.2.13&r2=1.49.2.2.2.14&diff_format=u
Index: php-src/ext/gmp/gmp.c
diff -u php-src/ext/gmp/gmp.c:1.49.2.2.2.13 php-src/ext/gmp/gmp.c:1.49.2.2.2.14
--- php-src/ext/gmp/gmp.c:1.49.2.2.2.13 Wed Jan 30 18:27:03 2008
+++ php-src/ext/gmp/gmp.c   Mon Feb  4 21:31:52 2008
@@ -552,9 +552,6 @@
if (use_ui && gmp_ui_op) {
if (allow_ui_return) {
long_result = gmp_ui_op(*gmpnum_result, *gmpnum_a, 
(unsigned long)Z_LVAL_PP(b_arg));
-   if (mpz_sgn(*gmpnum_a) == -1) {
-   long_result = -long_result;
-   }
} else {
gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned 
long)Z_LVAL_PP(b_arg));
}
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1072&r2=1.2027.2.547.2.1073&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1072 php-src/NEWS:1.2027.2.547.2.1073
--- php-src/NEWS:1.2027.2.547.2.1072Mon Feb  4 19:43:34 2008
+++ php-src/NEWSMon Feb  4 21:31:52 2008
@@ -11,8 +11,6 @@
 
 - Fixed bug #44028 (crash inside stream_socket_enable_crypto() when enabling  
   encryption without crypto type). (Ilia)
-- Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st argument).
-  (Ilia)
 - Fixed bug #43954 (Memory leak when sending the same HTTP status code
   multiple times). (Scott)
 - Fixed bug #43927 (koi8r is missing from html_entity_decode()). 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/gmp gmp.c

2008-02-02 Thread Antony Dovgal
On 02.02.2008 13:49, Dmitry Stogov wrote:
> I talk about PHP_5_2 (I thought it was clear from the email subject).
> PHP_5_3 works fine on the same system.

These two tests fail for ages, AFAIK the reason is that GMP produces 
different results on different architectures.

5_2/ext/gmp/tests/021.phpt
5_2/ext/gmp/tests/026.phpt


-- 
Wbr, 
Antony Dovgal

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/gmp gmp.c

2008-02-02 Thread Dmitry Stogov

I talk about PHP_5_2 (I thought it was clear from the email subject).
PHP_5_3 works fine on the same system.

Thanks. Dmitry.

Ilia Alshanetsky wrote:
Ok, i'll take a peak at the code, I am really surprised certain tests 
pass here and fail for you... Are you testing on a 32bit platform in 5.3 
branch?



On 1-Feb-08, at 4:19 AM, Dmitry Stogov wrote:


It's very strange, because I still have the test failed.

ext/gmp/tests/021.php

The exactly broken thing is gmp_gcd(-1,0) that now returns -1 instead 
of 1. However you can see that return value of gmp_gcd(-2,2) now is 
not equal to gmp_gcd(2,-2). :(


Thanks. Dmitry.

Ilia Alshanetsky wrote:

Dmitry,
I've just tried to run the test on a patched 5.3 system and the test 
passes without any problems. Why is the test failing on your machine?

On 31-Jan-08, at 3:50 AM, Dmitry Stogov wrote:

Hi Ilia,

Probably your fix is not accurate, because it breaks 
ext/gmp/tests/021.phpt, however it shouldn't from my point of view.


BTW my math knowledge is not excellent.

Could you please take a look.
May be the fix should be done only for gmp_div_r() and shouldn't 
affect other functions.


Thanks. Dmitry.

Ilia Alshanetsky wrote:

iliaaWed Jan 30 18:27:04 2008 UTC
Modified files:  (Branch: PHP_5_2)
  /php-src/ext/gmpgmp.c /php-srcNEWS   Log:
  MFB: Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st
argument)
http://cvs.php.net/viewvc.cgi/php-src/ext/gmp/gmp.c?r1=1.49.2.2.2.12&r2=1.49.2.2.2.13&diff_format=u 


Index: php-src/ext/gmp/gmp.c
diff -u php-src/ext/gmp/gmp.c:1.49.2.2.2.12 
php-src/ext/gmp/gmp.c:1.49.2.2.2.13

--- php-src/ext/gmp/gmp.c:1.49.2.2.2.12Mon Dec 31 07:20:06 2007
+++ php-src/ext/gmp/gmp.cWed Jan 30 18:27:03 2008
@@ -552,6 +552,9 @@
   if (use_ui && gmp_ui_op) {
   if (allow_ui_return) {
   long_result = gmp_ui_op(*gmpnum_result, *gmpnum_a, 
(unsigned long)Z_LVAL_PP(b_arg));

+if (mpz_sgn(*gmpnum_a) == -1) {
+long_result = -long_result;
+}
   } else {
   gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned 
long)Z_LVAL_PP(b_arg));

   }
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1067&r2=1.2027.2.547.2.1068&diff_format=u 


Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1067 
php-src/NEWS:1.2027.2.547.2.1068

--- php-src/NEWS:1.2027.2.547.2.1067Wed Jan 30 15:30:44 2008
+++ php-src/NEWSWed Jan 30 18:27:03 2008
@@ -8,6 +8,8 @@
 which to group by data is specified. (Ilia)
- Upgraded PCRE to version 7.6 (Nuno)
+- Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st 
argument).

+  (Ilia)
- Fixed bug #43954 (Memory leak when sending the same HTTP status code
 multiple times). (Scott)
- Fixed bug #43927 (koi8r is missing from html_entity_decode()).


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Ilia Alshanetsky


Ilia Alshanetsky



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/gmp gmp.c

2008-02-01 Thread Antony Dovgal
On 01.02.2008 18:36, Rasmus Lerdorf wrote:
> All the gmp tests pass for me as well here with gmp-4.2.2 on an ancient
> FreeBSD 4.10 box.

Same here on Linux 64bit (gmp-4.2.1, 5_3-CVS).

-- 
Wbr, 
Antony Dovgal

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/gmp gmp.c

2008-02-01 Thread Rasmus Lerdorf
All the gmp tests pass for me as well here with gmp-4.2.2 on an ancient
FreeBSD 4.10 box.

-Rasmus

Ilia Alshanetsky wrote:
> Ok, i'll take a peak at the code, I am really surprised certain tests  
> pass here and fail for you... Are you testing on a 32bit platform in  
> 5.3 branch?
> 
> 
> On 1-Feb-08, at 4:19 AM, Dmitry Stogov wrote:
> 
>> It's very strange, because I still have the test failed.
>>
>> ext/gmp/tests/021.php
>>
>> The exactly broken thing is gmp_gcd(-1,0) that now returns -1  
>> instead of 1. However you can see that return value of gmp_gcd(-2,2)  
>> now is not equal to gmp_gcd(2,-2). :(
>>
>> Thanks. Dmitry.
>>
>> Ilia Alshanetsky wrote:
>>> Dmitry,
>>> I've just tried to run the test on a patched 5.3 system and the  
>>> test passes without any problems. Why is the test failing on your  
>>> machine?
>>> On 31-Jan-08, at 3:50 AM, Dmitry Stogov wrote:
 Hi Ilia,

 Probably your fix is not accurate, because it breaks ext/gmp/tests/ 
 021.phpt, however it shouldn't from my point of view.

 BTW my math knowledge is not excellent.

 Could you please take a look.
 May be the fix should be done only for gmp_div_r() and shouldn't  
 affect other functions.

 Thanks. Dmitry.

 Ilia Alshanetsky wrote:
> iliaaWed Jan 30 18:27:04 2008 UTC
> Modified files:  (Branch: PHP_5_2)
>   /php-src/ext/gmpgmp.c /php-srcNEWS   Log:
>   MFB: Fixed bug #43981 (gmp_div_r() does not preserve the sign  
> of 1st
> argument)
> http://cvs.php.net/viewvc.cgi/php-src/ext/gmp/gmp.c?r1=1.49.2.2.2.12&r2=1.49.2.2.2.13&diff_format=u
> Index: php-src/ext/gmp/gmp.c
> diff -u php-src/ext/gmp/gmp.c:1.49.2.2.2.12 php-src/ext/gmp/gmp.c: 
> 1.49.2.2.2.13
> --- php-src/ext/gmp/gmp.c:1.49.2.2.2.12Mon Dec 31 07:20:06 2007
> +++ php-src/ext/gmp/gmp.cWed Jan 30 18:27:03 2008
> @@ -552,6 +552,9 @@
>if (use_ui && gmp_ui_op) {
>if (allow_ui_return) {
>long_result = gmp_ui_op(*gmpnum_result, *gmpnum_a,  
> (unsigned long)Z_LVAL_PP(b_arg));
> +if (mpz_sgn(*gmpnum_a) == -1) {
> +long_result = -long_result;
> +}
>} else {
>gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned  
> long)Z_LVAL_PP(b_arg));
>}
> http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1067&r2=1.2027.2.547.2.1068&diff_format=u
> Index: php-src/NEWS
> diff -u php-src/NEWS:1.2027.2.547.2.1067 php-src/NEWS:1.2027.2.547.2.1068
> --- php-src/NEWS:1.2027.2.547.2.1067Wed Jan 30 15:30:44 2008
> +++ php-src/NEWSWed Jan 30 18:27:03 2008
> @@ -8,6 +8,8 @@
>  which to group by data is specified. (Ilia)
> - Upgraded PCRE to version 7.6 (Nuno)
> +- Fixed bug #43981 (gmp_div_r() does not preserve the sign of  
> 1st argument).
> +  (Ilia)
> - Fixed bug #43954 (Memory leak when sending the same HTTP status  
> code
>  multiple times). (Scott)
> - Fixed bug #43927 (koi8r is missing from html_entity_decode()).
 -- 
 PHP CVS Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

>>> Ilia Alshanetsky
> 
> Ilia Alshanetsky
> 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/gmp gmp.c

2008-02-01 Thread Ilia Alshanetsky
Ok, i'll take a peak at the code, I am really surprised certain tests  
pass here and fail for you... Are you testing on a 32bit platform in  
5.3 branch?



On 1-Feb-08, at 4:19 AM, Dmitry Stogov wrote:


It's very strange, because I still have the test failed.

ext/gmp/tests/021.php

The exactly broken thing is gmp_gcd(-1,0) that now returns -1  
instead of 1. However you can see that return value of gmp_gcd(-2,2)  
now is not equal to gmp_gcd(2,-2). :(


Thanks. Dmitry.

Ilia Alshanetsky wrote:

Dmitry,
I've just tried to run the test on a patched 5.3 system and the  
test passes without any problems. Why is the test failing on your  
machine?

On 31-Jan-08, at 3:50 AM, Dmitry Stogov wrote:

Hi Ilia,

Probably your fix is not accurate, because it breaks ext/gmp/tests/ 
021.phpt, however it shouldn't from my point of view.


BTW my math knowledge is not excellent.

Could you please take a look.
May be the fix should be done only for gmp_div_r() and shouldn't  
affect other functions.


Thanks. Dmitry.

Ilia Alshanetsky wrote:

iliaaWed Jan 30 18:27:04 2008 UTC
Modified files:  (Branch: PHP_5_2)
  /php-src/ext/gmpgmp.c /php-srcNEWS   Log:
  MFB: Fixed bug #43981 (gmp_div_r() does not preserve the sign  
of 1st

argument)
http://cvs.php.net/viewvc.cgi/php-src/ext/gmp/gmp.c?r1=1.49.2.2.2.12&r2=1.49.2.2.2.13&diff_format=u
Index: php-src/ext/gmp/gmp.c
diff -u php-src/ext/gmp/gmp.c:1.49.2.2.2.12 php-src/ext/gmp/gmp.c: 
1.49.2.2.2.13

--- php-src/ext/gmp/gmp.c:1.49.2.2.2.12Mon Dec 31 07:20:06 2007
+++ php-src/ext/gmp/gmp.cWed Jan 30 18:27:03 2008
@@ -552,6 +552,9 @@
   if (use_ui && gmp_ui_op) {
   if (allow_ui_return) {
   long_result = gmp_ui_op(*gmpnum_result, *gmpnum_a,  
(unsigned long)Z_LVAL_PP(b_arg));

+if (mpz_sgn(*gmpnum_a) == -1) {
+long_result = -long_result;
+}
   } else {
   gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned  
long)Z_LVAL_PP(b_arg));

   }
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1067&r2=1.2027.2.547.2.1068&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1067 php-src/NEWS:1.2027.2.547.2.1068
--- php-src/NEWS:1.2027.2.547.2.1067Wed Jan 30 15:30:44 2008
+++ php-src/NEWSWed Jan 30 18:27:03 2008
@@ -8,6 +8,8 @@
 which to group by data is specified. (Ilia)
- Upgraded PCRE to version 7.6 (Nuno)
+- Fixed bug #43981 (gmp_div_r() does not preserve the sign of  
1st argument).

+  (Ilia)
- Fixed bug #43954 (Memory leak when sending the same HTTP status  
code

 multiple times). (Scott)
- Fixed bug #43927 (koi8r is missing from html_entity_decode()).


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Ilia Alshanetsky


Ilia Alshanetsky

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/gmp gmp.c

2008-02-01 Thread Dmitry Stogov

It's very strange, because I still have the test failed.

ext/gmp/tests/021.php

The exactly broken thing is gmp_gcd(-1,0) that now returns -1 instead of 
1. However you can see that return value of gmp_gcd(-2,2) now is not 
equal to gmp_gcd(2,-2). :(


Thanks. Dmitry.

Ilia Alshanetsky wrote:

Dmitry,

I've just tried to run the test on a patched 5.3 system and the test 
passes without any problems. Why is the test failing on your machine?



On 31-Jan-08, at 3:50 AM, Dmitry Stogov wrote:


Hi Ilia,

Probably your fix is not accurate, because it breaks 
ext/gmp/tests/021.phpt, however it shouldn't from my point of view.


BTW my math knowledge is not excellent.

Could you please take a look.
May be the fix should be done only for gmp_div_r() and shouldn't 
affect other functions.


Thanks. Dmitry.

Ilia Alshanetsky wrote:

iliaaWed Jan 30 18:27:04 2008 UTC
 Modified files:  (Branch: PHP_5_2)
   /php-src/ext/gmpgmp.c /php-srcNEWS   Log:
   MFB: Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st
 argument)
 http://cvs.php.net/viewvc.cgi/php-src/ext/gmp/gmp.c?r1=1.49.2.2.2.12&r2=1.49.2.2.2.13&diff_format=u 


Index: php-src/ext/gmp/gmp.c
diff -u php-src/ext/gmp/gmp.c:1.49.2.2.2.12 
php-src/ext/gmp/gmp.c:1.49.2.2.2.13

--- php-src/ext/gmp/gmp.c:1.49.2.2.2.12Mon Dec 31 07:20:06 2007
+++ php-src/ext/gmp/gmp.cWed Jan 30 18:27:03 2008
@@ -552,6 +552,9 @@
if (use_ui && gmp_ui_op) {
if (allow_ui_return) {
long_result = gmp_ui_op(*gmpnum_result, *gmpnum_a, 
(unsigned long)Z_LVAL_PP(b_arg));

+if (mpz_sgn(*gmpnum_a) == -1) {
+long_result = -long_result;
+}
} else {
gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned 
long)Z_LVAL_PP(b_arg));

}
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1067&r2=1.2027.2.547.2.1068&diff_format=u 


Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1067 
php-src/NEWS:1.2027.2.547.2.1068

--- php-src/NEWS:1.2027.2.547.2.1067Wed Jan 30 15:30:44 2008
+++ php-src/NEWSWed Jan 30 18:27:03 2008
@@ -8,6 +8,8 @@
  which to group by data is specified. (Ilia)
- Upgraded PCRE to version 7.6 (Nuno)
+- Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st 
argument).

+  (Ilia)
- Fixed bug #43954 (Memory leak when sending the same HTTP status code
  multiple times). (Scott)
- Fixed bug #43927 (koi8r is missing from html_entity_decode()).


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Ilia Alshanetsky



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/gmp gmp.c

2008-01-31 Thread Ilia Alshanetsky

Dmitry,

I've just tried to run the test on a patched 5.3 system and the test  
passes without any problems. Why is the test failing on your machine?



On 31-Jan-08, at 3:50 AM, Dmitry Stogov wrote:


Hi Ilia,

Probably your fix is not accurate, because it breaks ext/gmp/tests/ 
021.phpt, however it shouldn't from my point of view.


BTW my math knowledge is not excellent.

Could you please take a look.
May be the fix should be done only for gmp_div_r() and shouldn't  
affect other functions.


Thanks. Dmitry.

Ilia Alshanetsky wrote:

iliaa   Wed Jan 30 18:27:04 2008 UTC
 Modified files:  (Branch: PHP_5_2)
   /php-src/ext/gmp gmp.c /php-src  NEWS   Log:
   MFB: Fixed bug #43981 (gmp_div_r() does not preserve the sign of  
1st

 argument)
 
http://cvs.php.net/viewvc.cgi/php-src/ext/gmp/gmp.c?r1=1.49.2.2.2.12&r2=1.49.2.2.2.13&diff_format=u
Index: php-src/ext/gmp/gmp.c
diff -u php-src/ext/gmp/gmp.c:1.49.2.2.2.12 php-src/ext/gmp/gmp.c: 
1.49.2.2.2.13

--- php-src/ext/gmp/gmp.c:1.49.2.2.2.12 Mon Dec 31 07:20:06 2007
+++ php-src/ext/gmp/gmp.c   Wed Jan 30 18:27:03 2008
@@ -552,6 +552,9 @@
if (use_ui && gmp_ui_op) {
if (allow_ui_return) {
			long_result = gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned  
long)Z_LVAL_PP(b_arg));

+   if (mpz_sgn(*gmpnum_a) == -1) {
+   long_result = -long_result;
+   }
} else {
			gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned  
long)Z_LVAL_PP(b_arg));

}
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1067&r2=1.2027.2.547.2.1068&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1067 php-src/NEWS:1.2027.2.547.2.1068
--- php-src/NEWS:1.2027.2.547.2.1067Wed Jan 30 15:30:44 2008
+++ php-src/NEWSWed Jan 30 18:27:03 2008
@@ -8,6 +8,8 @@
  which to group by data is specified. (Ilia)
- Upgraded PCRE to version 7.6 (Nuno)
+- Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st  
argument).

+  (Ilia)
- Fixed bug #43954 (Memory leak when sending the same HTTP status  
code

  multiple times). (Scott)
- Fixed bug #43927 (koi8r is missing from html_entity_decode()).


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Ilia Alshanetsky

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/gmp gmp.c

2008-01-31 Thread Ilia Alshanetsky
When I ran the tests on my machine here all the tests had passed. I'll  
take a look again.



On 31-Jan-08, at 3:50 AM, Dmitry Stogov wrote:


Hi Ilia,

Probably your fix is not accurate, because it breaks ext/gmp/tests/ 
021.phpt, however it shouldn't from my point of view.


BTW my math knowledge is not excellent.

Could you please take a look.
May be the fix should be done only for gmp_div_r() and shouldn't  
affect other functions.


Thanks. Dmitry.

Ilia Alshanetsky wrote:

iliaa   Wed Jan 30 18:27:04 2008 UTC
 Modified files:  (Branch: PHP_5_2)
   /php-src/ext/gmp gmp.c /php-src  NEWS   Log:
   MFB: Fixed bug #43981 (gmp_div_r() does not preserve the sign of  
1st

 argument)
 
http://cvs.php.net/viewvc.cgi/php-src/ext/gmp/gmp.c?r1=1.49.2.2.2.12&r2=1.49.2.2.2.13&diff_format=u
Index: php-src/ext/gmp/gmp.c
diff -u php-src/ext/gmp/gmp.c:1.49.2.2.2.12 php-src/ext/gmp/gmp.c: 
1.49.2.2.2.13

--- php-src/ext/gmp/gmp.c:1.49.2.2.2.12 Mon Dec 31 07:20:06 2007
+++ php-src/ext/gmp/gmp.c   Wed Jan 30 18:27:03 2008
@@ -552,6 +552,9 @@
if (use_ui && gmp_ui_op) {
if (allow_ui_return) {
			long_result = gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned  
long)Z_LVAL_PP(b_arg));

+   if (mpz_sgn(*gmpnum_a) == -1) {
+   long_result = -long_result;
+   }
} else {
			gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned  
long)Z_LVAL_PP(b_arg));

}
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1067&r2=1.2027.2.547.2.1068&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1067 php-src/NEWS:1.2027.2.547.2.1068
--- php-src/NEWS:1.2027.2.547.2.1067Wed Jan 30 15:30:44 2008
+++ php-src/NEWSWed Jan 30 18:27:03 2008
@@ -8,6 +8,8 @@
  which to group by data is specified. (Ilia)
- Upgraded PCRE to version 7.6 (Nuno)
+- Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st  
argument).

+  (Ilia)
- Fixed bug #43954 (Memory leak when sending the same HTTP status  
code

  multiple times). (Scott)
- Fixed bug #43927 (koi8r is missing from html_entity_decode()).


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Ilia Alshanetsky

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/gmp gmp.c

2008-01-31 Thread Dmitry Stogov

Hi Ilia,

Probably your fix is not accurate, because it breaks 
ext/gmp/tests/021.phpt, however it shouldn't from my point of view.


BTW my math knowledge is not excellent.

Could you please take a look.
May be the fix should be done only for gmp_div_r() and shouldn't affect 
other functions.


Thanks. Dmitry.

Ilia Alshanetsky wrote:

iliaa   Wed Jan 30 18:27:04 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/gmp	gmp.c 
/php-src	NEWS 
  Log:
  
  MFB: Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st

  argument)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gmp/gmp.c?r1=1.49.2.2.2.12&r2=1.49.2.2.2.13&diff_format=u

Index: php-src/ext/gmp/gmp.c
diff -u php-src/ext/gmp/gmp.c:1.49.2.2.2.12 php-src/ext/gmp/gmp.c:1.49.2.2.2.13
--- php-src/ext/gmp/gmp.c:1.49.2.2.2.12 Mon Dec 31 07:20:06 2007
+++ php-src/ext/gmp/gmp.c   Wed Jan 30 18:27:03 2008
@@ -552,6 +552,9 @@
if (use_ui && gmp_ui_op) {
if (allow_ui_return) {
long_result = gmp_ui_op(*gmpnum_result, *gmpnum_a, 
(unsigned long)Z_LVAL_PP(b_arg));
+   if (mpz_sgn(*gmpnum_a) == -1) {
+   long_result = -long_result;
+   }
} else {
gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned 
long)Z_LVAL_PP(b_arg));
}
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1067&r2=1.2027.2.547.2.1068&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1067 php-src/NEWS:1.2027.2.547.2.1068
--- php-src/NEWS:1.2027.2.547.2.1067Wed Jan 30 15:30:44 2008
+++ php-src/NEWSWed Jan 30 18:27:03 2008
@@ -8,6 +8,8 @@
   which to group by data is specified. (Ilia)
 - Upgraded PCRE to version 7.6 (Nuno)
 
+- Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st argument).

+  (Ilia)
 - Fixed bug #43954 (Memory leak when sending the same HTTP status code
   multiple times). (Scott)
 - Fixed bug #43927 (koi8r is missing from html_entity_decode()). 



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/gmp gmp.c

2008-01-30 Thread Ilia Alshanetsky
iliaa   Wed Jan 30 18:27:04 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/gmpgmp.c 
/php-srcNEWS 
  Log:
  
  MFB: Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st
  argument)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gmp/gmp.c?r1=1.49.2.2.2.12&r2=1.49.2.2.2.13&diff_format=u
Index: php-src/ext/gmp/gmp.c
diff -u php-src/ext/gmp/gmp.c:1.49.2.2.2.12 php-src/ext/gmp/gmp.c:1.49.2.2.2.13
--- php-src/ext/gmp/gmp.c:1.49.2.2.2.12 Mon Dec 31 07:20:06 2007
+++ php-src/ext/gmp/gmp.c   Wed Jan 30 18:27:03 2008
@@ -552,6 +552,9 @@
if (use_ui && gmp_ui_op) {
if (allow_ui_return) {
long_result = gmp_ui_op(*gmpnum_result, *gmpnum_a, 
(unsigned long)Z_LVAL_PP(b_arg));
+   if (mpz_sgn(*gmpnum_a) == -1) {
+   long_result = -long_result;
+   }
} else {
gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned 
long)Z_LVAL_PP(b_arg));
}
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1067&r2=1.2027.2.547.2.1068&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1067 php-src/NEWS:1.2027.2.547.2.1068
--- php-src/NEWS:1.2027.2.547.2.1067Wed Jan 30 15:30:44 2008
+++ php-src/NEWSWed Jan 30 18:27:03 2008
@@ -8,6 +8,8 @@
   which to group by data is specified. (Ilia)
 - Upgraded PCRE to version 7.6 (Nuno)
 
+- Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st argument).
+  (Ilia)
 - Fixed bug #43954 (Memory leak when sending the same HTTP status code
   multiple times). (Scott)
 - Fixed bug #43927 (koi8r is missing from html_entity_decode()). 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/gmp gmp.c /ext/gmp/tests 011.phpt

2007-04-26 Thread Antony Dovgal
tony2001Thu Apr 26 13:44:02 2007 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/gmp/tests  011.phpt 

  Modified files:  
/php-srcNEWS 
/php-src/ext/gmpgmp.c 
  Log:
  MFH: add test & GMP_VERSION constant
  do not allow zero operand in gmp_divexact()
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.662&r2=1.2027.2.547.2.663&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.662 php-src/NEWS:1.2027.2.547.2.663
--- php-src/NEWS:1.2027.2.547.2.662 Tue Apr 24 13:54:59 2007
+++ php-src/NEWSThu Apr 26 13:44:01 2007
@@ -1,6 +1,7 @@
 PHPNEWS
 |||
 ?? Apr 2007, PHP 5.2.2RC2
+- Added GMP_VERSION constant. (Tony)
 - Fixed commandline handling fro CLI and CGI. (Marcus, Johannes)
 - Upgraded SQLite 3 to version 3.3.16 (Ilia)
 - Updated timezone database to version 2007.5. (Derick)
http://cvs.php.net/viewvc.cgi/php-src/ext/gmp/gmp.c?r1=1.49.2.2.2.10&r2=1.49.2.2.2.11&diff_format=u
Index: php-src/ext/gmp/gmp.c
diff -u php-src/ext/gmp/gmp.c:1.49.2.2.2.10 php-src/ext/gmp/gmp.c:1.49.2.2.2.11
--- php-src/ext/gmp/gmp.c:1.49.2.2.2.10 Wed Apr 18 20:53:28 2007
+++ php-src/ext/gmp/gmp.c   Thu Apr 26 13:44:02 2007
@@ -389,6 +389,7 @@
REGISTER_LONG_CONSTANT("GMP_ROUND_ZERO", GMP_ROUND_ZERO, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("GMP_ROUND_PLUSINF", GMP_ROUND_PLUSINF, CONST_CS 
| CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("GMP_ROUND_MINUSINF", GMP_ROUND_MINUSINF, 
CONST_CS | CONST_PERSISTENT);
+   REGISTER_STRING_CONSTANT("GMP_VERSION", (char *)gmp_version, CONST_CS | 
CONST_PERSISTENT);
 
mp_set_memory_functions(gmp_emalloc, gmp_erealloc, gmp_efree);
 
@@ -415,6 +416,7 @@
 {
php_info_print_table_start();
php_info_print_table_row(2, "gmp support", "enabled");
+   php_info_print_table_row(2, "GMP version", gmp_version);
php_info_print_table_end();
 }
 /* }}} */
@@ -996,7 +998,13 @@
Divide a by b using exact division algorithm */
 ZEND_FUNCTION(gmp_divexact)
 {
-   gmp_binary_op(mpz_divexact);
+   zval **a_arg, **b_arg;
+
+   if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) 
== FAILURE){
+   WRONG_PARAM_COUNT;
+   }
+   
+   gmp_zval_binary_ui_op_ex(return_value, a_arg, b_arg, mpz_divexact, 
NULL, 0, 1 TSRMLS_CC);
 }
 /* }}} */
 

http://cvs.php.net/viewvc.cgi/php-src/ext/gmp/tests/011.phpt?view=markup&rev=1.1
Index: php-src/ext/gmp/tests/011.phpt
+++ php-src/ext/gmp/tests/011.phpt
--TEST--
gmp_divexact() tests (OK to fail with GMP =< 4.2.1)
--FILE--

--EXPECTF-- 
string(1) "0"

Warning: gmp_divexact(): Zero operand not allowed in %s on line %d
string(1) "0"
string(2) "10"
string(3) "512"
string(19) "500"
string(18) "20"
string(9) "-1000"
Done
--UEXPECTF--
unicode(1) "0"

Warning: gmp_divexact(): Zero operand not allowed in %s on line %d
unicode(1) "0"
unicode(2) "10"
unicode(3) "512"
unicode(19) "500"
unicode(18) "20"
unicode(9) "-1000"
Done

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php