Commit Graph

151 Commits

Author SHA1 Message Date
Remi Collet
2233625e02 Merge branch 'PHP-5.6'
* PHP-5.6:
  NEWS
  NEWS
  Fix bug #63595 GMP memory management conflicts with other libraries using GMP

Conflicts:
	ext/gmp/gmp.c
2014-10-27 07:53:54 +01:00
Remi Collet
0146505187 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  NEWS
  Fix bug #63595 GMP memory management conflicts with other libraries using GMP

Conflicts:
	ext/gmp/gmp.c
2014-10-27 07:50:42 +01:00
Remi Collet
3c925b18fa Fix bug #63595 GMP memory management conflicts with other libraries using GMP
Drop use of php memory allocators as this raise various conflicts
with other extensions and libraries which use libgmp.

No other solution found.
We cannot for ensure correct use of allocator with shared lib.

Some memory can allocated before php init
Some memory can be freed after php shutdown

Known broken run cases
- php + curl + gnutls + gmp
- mod_gnutls + mod_php + gnutls + gmp
- php + freetds + gnutls + gmp
- php + odbc + freetds + gnutls + gmp
- php + php-mapi (zarafa) + gnutls + gmp
2014-10-27 07:45:34 +01:00
Anatol Belski
9a969fdd3b fix datatype 2014-10-22 17:56:31 +02:00
Stanislav Malyshev
afdaedaa26 Merge branch 'PHP-5.6'
* PHP-5.6:
  update NEWS and UPGRADING
  Upated NEWS
  Address issues raised by @nikic
  Make sure min < max
  Mersenne Twister was added in GMP 4.2
  Add test files
  Add gmp_random_bits(bits) and gmp_random_range(min, max)
  Change GMPs default PRNG to Mersenne Twister

Conflicts:
	ext/gmp/gmp.c
2014-10-14 00:43:15 -07:00
Nikita Popov
bb0c142156 Drop support for GMP 4.1
* Consistent base conversion support (max: 62)
 * mpz_remroot always available
 * Use gmp_randinit_mt instead of LCG
2014-09-28 20:46:22 +02:00
Leigh
581c86c07f Make gmp_setbit and gmp_clrbit return values consistent 2014-09-28 20:18:14 +02:00
Leigh
adf8f0f284 Address issues raised by @nikic
- Thread safety on rand init function.
 - Ret false on validation failure
 - Add _dep of temp_a to temp_b
 - Special case int sized min values
 - More tests!
2014-09-24 22:01:09 +01:00
Leigh
3e9a31748d Make sure min < max 2014-09-24 07:56:46 +01:00
Leigh
acd7fcf55f Mersenne Twister was added in GMP 4.2 2014-09-23 23:16:26 +01:00
Leigh
31e27fc89a Add test files 2014-09-23 22:54:40 +01:00
Leigh
831bb9260c Add gmp_random_bits(bits) and gmp_random_range(min, max) 2014-09-23 22:12:23 +01:00
Leigh
3d6d863ccb Change GMPs default PRNG to Mersenne Twister
Since we don't allow users to seed the RNG, there is no BC issue with changing the generator.
2014-09-23 19:51:56 +01:00
Nikita Popov
e33f3d3b7c Move smart_str implementation into Zend/
So we can use it there as well...

For now I've retained the zend_smart_str_public.h header, though
it would probably be better to just move that one struct into
zend_types.h.
2014-09-21 20:49:39 +02:00
Johannes Schlüter
d0cb715373 s/PHP 5/PHP 7/ 2014-09-19 18:33:14 +02:00
Dmitry Stogov
3bc8a958c5 Fixed useless or duplicated IS_INTERNED() checks 2014-09-19 15:41:01 +04:00
Nikita Popov
8a9dd4a1d7 Fix GMP serialization
Also fix same issue in PDO.
2014-09-18 23:03:27 +02:00
Nikita Popov
00805ffb92 Merge branch 'PHP-5.6'
Conflicts:
	ext/soap/php_http.c
2014-09-04 21:23:11 +02:00
Nikita Popov
15c139b99a Throw warnings when using zero modulus in gmp_powm
Also fixes a leak in this case.
2014-09-04 20:55:09 +02:00
Nikita Popov
6cceb54c09 Fix a number of format issues 2014-09-03 15:57:28 +02:00
Nikita Popov
2d364747ca Merge branch 'PHP-5.6'
Conflicts:
	ext/gmp/gmp.c
2014-09-02 19:07:54 +02:00
Nikita Popov
834daa455b Fixed bug #50175
0x and 0b prefix is now only handled if either no base is given
or if the base is 16 (0x) or 2 (0b). Always handling it is incorrect
because 0x and 0b are perfectly valid numbers in other bases.
2014-09-02 19:04:55 +02:00
Nikita Popov
7533243f0c Fix C89 build and small cleanup 2014-09-02 18:52:13 +02:00
Nikita Popov
5138f3ba22 Skip 64bit test on 32bit
Also minor type improvements
2014-09-02 18:42:39 +02:00
Anatol Belski
08b732f26b fix datatypes for gmp to be compatible with GMP/MPIR on different platforms 2014-09-02 18:19:51 +02:00
Anatol Belski
20e15f55e8 one semicolon too much 2014-09-02 16:40:41 +02:00
Nikita Popov
e3da88b898 mpz functions don't work on zend_ulongs...
If we really want to support zend_ulong > ulong in GMP the right
approach would be to only handle < LONG_MAX in ui shortcut functions
and use mpz_import in convert_to_gmp for number > LONG_MAX.
2014-09-02 14:37:15 +02:00
Nikita Popov
8e7cd7a0f9 Merge branch 'PHP-5.6'
Conflicts:
	ext/gmp/gmp.c
2014-09-02 14:28:07 +02:00
Leigh
47d630e7f0 Implement gmp_import() and gmp_export() 2014-09-02 14:19:18 +02:00
Nikita Popov
f099c3f2ec Merge branch 'PHP-5.6' 2014-08-27 22:18:55 +02:00
Nikita Popov
fc5f931663 Fix bug #67917 (gmp compound assignment operator leak) 2014-08-27 22:16:20 +02:00
Anatol Belski
6f9f0bf205 master renames phase 2 2014-08-25 19:28:33 +02:00
Anatol Belski
c3e3c98ec6 master renames phase 1 2014-08-25 19:24:55 +02:00
Anatol Belski
70de6180d5 fixes to %pd format usage 2014-08-24 02:35:34 +02:00
Anatol Belski
919b996527 ported ext/gmp 2014-08-19 22:10:20 +02:00
Anatol Belski
63d3f0b844 basic macro replacements, all at once 2014-08-19 08:07:31 +02:00
Dmitry Stogov
9eb89dddb1 Use optimized zend_array_dup() function. convert zend_hash_num_elements() and zend_hash_next_free_element() into macros. 2014-05-23 20:37:53 +04:00
Dmitry Stogov
f1720348ca Fixed access to uninitialized data and attempt to double free 2014-05-13 12:57:42 +04:00
Nikita Popov
4c5b5d7201 Port ext/gmp (one failure) 2014-05-06 19:03:48 +02:00
Stanislav Malyshev
c18ae51aeb Fix crashes in GMP serialize/unserialize 2014-04-28 01:22:02 -07:00
Anatol Belski
1a624e27a6 restored the old code in 5.4/5 related to bug #66872
The crash is reproducable in 5.6+ only, so 5.4 and 5.5 are fine
with the old code.
2014-03-11 11:50:14 +01:00
Pierre Joye
eef2978afc Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  update NEWS
  fix #66872, invalid argument crashes gmp_testbit
  fix #66872, invalid argument crashes gmp_testbit
  add vc12 (2013)

Conflicts:
	ext/gmp/gmp.c
2014-03-10 12:18:57 +01:00
Pierre Joye
af41914e15 fix #66872, invalid argument crashes gmp_testbit 2014-03-10 12:06:40 +01:00
datibbaw
aff56f3c45 add T_POW (**) operator
Fixed recognition of the operator

Added opcode, still doing multiply instead of pow()

opcode now always returns int(42)

The right answer, but always a float

Yanked code from pow() implementation.

Should not handle negative long as exponent ourselves

Added test cases from pow()

Moved precedence higher than '~'

Added GMP operator overloading

Added ZEND_ASSIGN_POW (**=) operator.

Added pow() as a language construct.

Adjusted test cases for changed precedence.

Reduced pow() to shell function around ZEND_API pow_function()

Reduced test case to only contain edge cases
Added overloading test case

Moved unary minus above T_POW

Revert "Added pow() as a language construct."

Bad bad bad idea.

This reverts commit f60b98cf7a8371233d800a6faa286ddba4432d02.

Reverted unary minus behaviour due to previous revert.
Convert arrays to int(0)
Exponent with array as a base becomes int(0)

Rebase against master

Fixed tokenizer test case
2014-02-06 14:41:21 +01:00
Xinchen Hui
c081ce628f Bump year 2014-01-03 11:08:10 +08:00
Xinchen Hui
c0d060f5c0 Bump year 2014-01-03 11:04:26 +08:00
Nikita Popov
5408f1e5a6 Throw warning when converting invalid string to GMP 2013-12-30 14:38:09 +01:00
Nikita Popov
00c74ccf69 Support gmp_remroot() on GMP 4.1 2013-12-02 20:11:06 +01:00
Nikita Popov
f54f308f71 Clean up GMP arginfos
Removed duplicate arginfos, specified number of required args
everywhere and removed weird pass-by-ref arguments.
2013-11-29 00:05:28 +01:00
Nikita Popov
6d38090c8d Add gmp_root() and gmp_rootrem() functions 2013-11-29 00:01:59 +01:00