Commit graph

561 commits

Author SHA1 Message Date
Dmitry Stogov
bd8e76761f Use zval_ptr_dtor() instead of zval_dtor() in in-place array/object conversion functions 2018-07-06 12:07:13 +03:00
Dmitry Stogov
ca40664ad6 Conversion related optimizations 2018-07-06 01:26:43 +03:00
Dmitry Stogov
6c0ddcda47 Removed legacy zval_dtor() usage. It doesn't work with zvals with refcount == 0, anyway. 2018-07-05 02:28:00 +03:00
Dmitry Stogov
5898583e94 Fixed some incorrect zval_dtor() usages 2018-07-04 23:48:39 +03:00
Dmitry Stogov
af341213f7 se zval_ptr_dtor_str() instead of zend_string_release_ex(Z_STR(*), 0) 2018-07-04 12:08:07 +03:00
Dmitry Stogov
5f19816f53 concat_function() micro optimization 2018-07-04 12:05:51 +03:00
Dmitry Stogov
ff58d70548 Avoid agressive inlining in rarely used paths 2018-05-30 14:03:48 +03:00
Dmitry Stogov
d90c6f2443 Removed useless zval_ptr_dtor() 2018-05-29 17:58:06 +03:00
Dmitry Stogov
5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Dmitry Stogov
9716bd68a3 Avoid double copying 2018-03-06 21:58:40 +03:00
Gabriel Caruso
414aaa207c
Use bool instead of boolean 2018-02-08 10:00:49 +01:00
Dmitry Stogov
19676fdf55 Added zendi_smart_streq() for smart string equality check 2018-01-16 17:24:00 +03:00
Dmitry Stogov
9d7544aa1c Convert "sparse switch" statements into sequences of "if" with the most probable conditions first 2018-01-10 15:12:03 +03:00
Gabriel Caruso
6400264856 Trailing whitespaces
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-03 14:38:00 +01:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Nikita Popov
b2b2b437af Add _IS_NUMBER as cast_object() target type
convert_scalar_to_number() will now call cast_object() with an
_IS_NUMBER argument, in which case the cast handler should return
either an integer or floating point number, whichever is more
appropriate.

Previously convert_scalar_to_number() unconditionally converted
objects to integers instead.

Fixes bug #53033.
Fixes bug #54973.
Fixes bug #73108.
2017-12-26 12:39:06 +01:00
Dmitry Stogov
6a9d2b2190 Cleanup type conversion 2017-12-07 19:24:55 +03:00
Dmitry Stogov
74c84cd7f0 Use zend_string_equal*() API for zend_string equality check instead of direct memcmp() usage. 2017-12-04 17:17:02 +03:00
Dmitry Stogov
084c17fe0b Use zend_string_tolower() where it's possible (to avoid reallocations).
Allow zend_string_tolower_ex() to create parsistent strings
2017-11-30 01:13:39 +03:00
Nikita Popov
5dc6392d25 Fixed bug #75575
These functions are never called with needle longer than haystack,
but it makes sense to explicitly check for this, especially as we
already perform a check for empty haystack anyway, which is
naturally subsumed by a haystack_len < needle_len check.
2017-11-28 23:10:50 +01:00
Nikita Popov
26f8fc833b Enable and fix printf() format warnings
Add _unchecked() variants of zend_spprintf and zend_strpprintf for
cases where we specifically want to disable these checks, such as
use of %H.
2017-11-16 21:15:36 +01:00
Dmitry Stogov
ccc12b82da Avoid unnecessary reference-counting on strings. 2017-11-16 17:09:32 +03:00
Dmitry Stogov
ce18738a30 Removed "_" from API functions. 2017-11-16 17:09:01 +03:00
Dmitry Stogov
aeca761856 Removed useless reallocations 2017-10-26 19:13:53 +03:00
Dmitry Stogov
886d4d9ca1 Avoid reallocations when concatenate with empty string 2017-10-26 09:45:02 +03:00
Dmitry Stogov
9cf87aa196 Avoid HashTable allocations for empty arrays (using zend_empty_array). 2017-10-24 17:27:31 +03:00
Anatol Belski
793ca716fb Fix datatypes and compiler warnings
Switch to size_t

Not critical as an unsigned is already used, but fixes a couple of
warnings in other areas.

Normalize signature

It's a function with the usual compare semantics, returning a platform
specific at least produces unnecessary warnings elsewhere and is otherwise
inappropriate.

Fix return value

Drop unused var

Fix compiler warnings

Fix compiler warning

Fix var name in arginfo

Fix cast
2017-10-23 08:56:57 +02:00
Dmitry Stogov
cb9d81ef4f Refactored recursion pretection 2017-10-06 01:34:50 +03:00
Xinchen Hui
ac3c586ca7 Merge branch 'PHP-7.2'
* PHP-7.2:
  Update NEWS
  Update NEWS
  Fixed bug #75241 (Null pointer dereference in zend_mm_alloc_small()).
  Compiler warning
2017-09-24 17:25:26 +08:00
Xinchen Hui
bad5639386 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update NEWS
  Fixed bug #75241 (Null pointer dereference in zend_mm_alloc_small()).
  Compiler warning
2017-09-24 17:24:57 +08:00
Xinchen Hui
e8c200515a Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75241 (Null pointer dereference in zend_mm_alloc_small()).
  Compiler warning
2017-09-24 17:24:23 +08:00
Xinchen Hui
b05ff14a9a Fixed bug #75241 (Null pointer dereference in zend_mm_alloc_small()). 2017-09-24 17:24:11 +08:00
Dmitry Stogov
44e0b79ac6 Refactored array creation API. array_init() and array_init_size() are converted into macros calling zend_new_array(). They are not functions anymore and don't return any values. 2017-09-20 02:25:56 +03:00
Anatol Belski
0d1eeeb68d move zend_ato*() to size_t and remove casts 2017-07-28 14:59:31 +02:00
Sara Golemon
4a6ef8327a Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Simpler fix for #74974
2017-07-27 10:04:59 -04:00
Sara Golemon
b62fb3aa0c Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Simpler fix for #74974
2017-07-27 10:04:14 -04:00
Pedro Magalhães
34e5d3a87d Simpler fix for #74974 2017-07-27 09:25:38 -04:00
Sara Golemon
089f4ff885 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Use compatability zend_isnan() instead of POSIX isnan()
2017-07-22 21:33:28 -04:00
Sara Golemon
a4e3589966 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Use compatability zend_isnan() instead of POSIX isnan()
2017-07-22 21:33:20 -04:00
Sara Golemon
775b4b54d8
Use compatability zend_isnan() instead of POSIX isnan()
s/isnan/zend_isnan/g
2017-07-22 21:32:44 -04:00
Sara Golemon
e23c132940 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix compile-time optimization of NAN comparisons
2017-07-22 21:23:29 -04:00
Sara Golemon
1229b0f8cb Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix compile-time optimization of NAN comparisons
2017-07-22 21:23:17 -04:00
Sara Golemon
c562d44321
Fix compile-time optimization of NAN comparisons 2017-07-22 21:22:51 -04:00
Anatol Belski
bc5811f361 further sync for vim mode lines 2017-07-04 18:12:45 +02:00
Dmitry Stogov
a08723d3d3 Use interned empty and "one char" strings. 2017-05-18 17:59:59 +03:00
Anatol Belski
c698299550 Interned strings unification for TS/NTS
Hereby, interned strings are supported in thread safe PHP. The patch
implements two types of interned strings

- interning per process, strings are not freed till process end
- interning per request, strings are freed at request end

There is no runtime interning.

With Opcache, all the permanent iterned strings are copied into SHM on
startup, additional copying into SHM might happen on demand.
2017-03-04 10:39:13 +01:00
Xinchen Hui
963981df58 Merge branch 'PHP-7.1'
* PHP-7.1:
  Update NEWS
  Fixed bug #74084 (Out of bound read - zend_mm_alloc_small)
2017-02-12 20:36:43 +08:00
Xinchen Hui
b56114e8fb Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #74084 (Out of bound read - zend_mm_alloc_small)

Conflicts:
	Zend/zend_operators.c
2017-02-12 20:36:18 +08:00
Xinchen Hui
26fdebc63b Fixed bug #74084 (Out of bound read - zend_mm_alloc_small) 2017-02-12 20:34:08 +08:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00