Commit Graph

174 Commits

Author SHA1 Message Date
Xinchen Hui
c081ce628f Bump year 2014-01-03 11:08:10 +08:00
Ard Biesheuvel
60d2e70c06 Zend: fix overflow handling bug in non-x86 fast_add_function()
The 'result' argument of fast_add_function() may alias with either
of its operands (or both). Take care not to write to 'result' before
reading op1 and op2.
2013-12-10 12:12:14 +01:00
Bob Weinand
d36cf90291 Merge branch 'const_scalar_exprs' into PHP-5.6
Conflicts:
	Zend/zend_extensions.h
2013-11-28 13:41:42 +01:00
Anatol Belski
c694d1df7b Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  permanently deactivate that place, not on runtime only
2013-11-20 10:12:06 +01:00
Anatol Belski
18b2b2a0bc Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  permanently deactivate that place, not on runtime only
2013-11-20 10:11:39 +01:00
Anatol Belski
b902a25cc3 permanently deactivate that place, not on runtime only
besides the two "if" checks, this fixes static analyze which is sometimes
broken because of this
2013-11-20 10:09:11 +01:00
Dmitry Stogov
9647c61dc1 Constant expressions refactoring 2013-11-06 22:21:07 +04:00
Bob Weinand
ad967e1329 Added a few more operators 2013-11-03 01:58:39 +01:00
Bob Weinand
466c5dd1fe Fixed mem leaks, added tests and ternary operator 2013-10-31 18:21:37 +01:00
Bob Weinand
2361745806 Working commit for constant scalar expressions (with constants).
Tests will follow.
2013-10-31 08:57:12 +01:00
Xinchen Hui
72f80b2997 Merge branch 'PHP-5.5' 2013-08-27 15:45:27 +08:00
Xinchen Hui
0119bbba6b Fixed compiler warnings
warning: 'local_dval' may be used uninitialized in this function
[-Wmaybe-uninitialized]

warning: 'dval2' may be used uninitialized in this function
[-Wmaybe-uninitialized]
2013-08-27 15:44:30 +08:00
Andrey Hristov
92d27ccb05 Constify streams API and a few other calls down the rabbit hole.
(`char *` to `const char *` for parameters and few return values)
In a few places int len moved to size_t len.
2013-07-30 12:49:36 +02:00
Nikita Popov
3823321c5c Implement internal operator overloading
As pre RFC https://wiki.php.net/rfc/operator_overloading_gmp
2013-06-17 17:48:13 +02:00
Ard Biesheuvel
5b121eb04d Fix #64780 (PHP 5.5 builds are broken with GCC 3)
A recent change (by me) introduced a call to __builtin_offsetof()
into zend_operators.h which is not defined by GCC prior to
version 4.

Changed the code to use offsetof() instead: this is defined in
<stddef.h>, so #include this header conditionally (#ifdef GNUC)
2013-05-07 20:37:04 +02:00
Gustavo Lopes
a86fcfbc1d Fix rounding of zend_dval_to_lval
Now rounding is always towards zero; the rounding can be though as if
occurring on the original double. Only relevant for the 32-bit long
variant.
2013-02-23 16:55:50 +00:00
Gustavo Lopes
77566edbaf Fix zend_dval_to_lval outside 64bit integers range
PHP should preserve the least significant bits when casting from double
to long. Zend.m4 contains this:

AC_DEFINE([ZEND_DVAL_TO_LVAL_CAST_OK], 1, [Define if double cast to long preserves least significant bits])

If ZEND_DVAL_TO_LVAL_CAST_OK is not defined, zend_operators.h had an
inline implementation of zend_dval_to_lval() that would do a cast to an
int64_t (when sizeof(long) == 4), then a cast to unsigned long and
finally the cast to long.

While this works well for doubles inside the range of values of the type
used in the first cast (int64_t in the 32-bit version and unsigned long
in the 64-bit version), if outside the range, it is undefined behavior
that WILL give varying and not particularly useful results.

This commit uses fmod() to first put the double in a range that can
safely be cast to unsigned long and then casts this unsigned long to
long. This last cast is implementation defined, but it's very likely
that this gives the expected result (i.e. the internal 2's complement
representation is unchanged) on all platforms that PHP supports. In any
case, the previous implementationa already had this assumption.

This alternative code path is indeed significantly slower than simply
casting the double (almost an order of magnitude), but that should not
matter because casting doubles with a very high absolute value is a
rare event.
2013-02-23 17:23:49 +01:00
Ard Biesheuvel
aa12cdc361 Improve x86 inline assembler
- added cc annotation to inline asm that clobbers the condition
  flags
- remove hardcoded constants (IS_LONG,IS_DOUBLE)
- remove hardcoded offsets (zval->value, zval->type)
2013-02-11 13:53:27 +01:00
Remi Collet
dc47ec0490 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Fixed bug #64142 (dval to lval different behavior on ppc64)
2013-02-11 09:13:27 +01:00
Remi Collet
e67a2b9e47 Fixed bug #64142 (dval to lval different behavior on ppc64)
See discussion on internals
http://marc.info/?t=136042277700003&r=1&w=2
2013-02-11 09:10:51 +01:00
Remi Collet
7b75a941ef Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  revert
2013-02-05 12:29:01 +01:00
Remi Collet
e7ce002c01 revert 2013-02-05 12:28:47 +01:00
Remi Collet
79956330fe Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Fixed bug #64142 (dval to lval different behavior on ppc64)
2013-02-04 15:27:07 +01:00
Remi Collet
6533094d9e Fixed bug #64142 (dval to lval different behavior on ppc64)
On x86_64:
(long)(double)9223372036854775807+1 = -9223372036854775808
On ppc64
(long)(double)9223372036854775807-1 = 9223372036854775807
2013-02-04 15:19:32 +01:00
Lars Strojny
92965b033a Bug #46408: Fix double formatting for PostgreSQL bound parameters 2013-01-14 21:23:52 +01:00
Xinchen Hui
a666285bc2 Happy New Year 2013-01-01 16:37:09 +08:00
Xinchen Hui
0a7395e009 Happy New Year 2013-01-01 16:28:54 +08:00
Gustavo Lopes
3d0857938d zend_binary_strncasecmp_l used w/out declaration 2012-08-26 19:44:05 +02:00
Stanislav Malyshev
47db8a9aa1 fix bug #54547 2012-05-14 11:03:20 -07:00
Stanislav Malyshev
9344bf193c fix bug #54547 2012-05-13 14:40:44 -07:00
Felipe Pena
8775a37559 - Year++ 2012-01-01 13:15:04 +00:00
Felipe Pena
4e19825281 - Year++ 2012-01-01 13:15:04 +00:00
Dmitry Stogov
16c87163f0 Fixed bug #55644 (Math ops tests fail, diff min int value) 2011-09-16 07:59:34 +00:00
Dmitry Stogov
c3741ad973 Fixed bug #55644 (Math ops tests fail, diff min int value) 2011-09-16 07:59:34 +00:00
Derick Rethans
56a87c2806 - Zend engine part for bug #55158: Add SORT_NATURAL type to array_multisort
(patch by Arpad Ray).
2011-08-29 20:24:09 +00:00
Derick Rethans
b0be274324 - Zend engine part for bug #55158: Add SORT_NATURAL type to array_multisort
(patch by Arpad Ray).
2011-08-29 20:24:09 +00:00
Gwynne Raskind
ef0e34580b For 5.4, fix C++-style comments. For trunk, forward-port build fix. 2011-08-07 16:31:21 +00:00
Gwynne Raskind
9e9c9b3430 For 5.4, fix C++-style comments. For trunk, forward-port build fix. 2011-08-07 16:31:21 +00:00
Gwynne Raskind
0af1e412a4 Fix build under Clang 2.9 - see LLVM bug #9164 (http://llvm.org/bugs/show_bug.cgi?id=9164). Tested with GCC and Clang on Darwin and Ubuntu. 2011-08-07 05:20:49 +00:00
Pierre Joye
f169f6f478 - should not have been applied 2011-07-22 11:42:15 +00:00
Pierre Joye
cc1c7af037 - remove magic quotes support, functions are kept (see the NEWS entry for the details) for BC reasons but do not allow to set enable MQ 2011-07-22 11:25:30 +00:00
Felipe Pena
5f33819f9c - Removed accidental offsetof definition 2011-07-03 01:29:23 +00:00
Felipe Pena
3e6b211935 - Removed accidental offsetof definition 2011-07-03 01:29:23 +00:00
Felipe Pena
6ef38daf0e - Fixed compiler warning (redefinition of offsetof) 2011-06-18 18:11:27 +00:00
Felipe Pena
72c4e72570 - Fixed compiler warning (redefinition of offsetof) 2011-06-18 18:11:27 +00:00
Dmitry Stogov
c270347c0b MFH: Arithmetic speedup. Inlined most probable code-paths for arithmetic operations directly into executor. 2011-05-31 12:05:25 +00:00
Dmitry Stogov
b7eb3c1c5a Arithmetic speedup. Inlined most probable code-paths for arithmetic operations directly into executor. 2011-05-23 08:05:44 +00:00
Felipe Pena
0203cc3d44 - Year++ 2011-01-01 02:17:06 +00:00
Hartmut Holzgraefe
aaa2f1c30b marked char pointer arguments as const in lots of
places where strings pointed to are not modified 
to prevent compiler warnings about discarded qualifiers ...
2010-10-14 21:33:10 +00:00
Sebastian Bergmann
d2281d1dff sed -i "s#1998-2009#1998-2010#g" **/*.c **/*.h **/*.php 2010-01-05 20:46:53 +00:00