Commit Graph

1208 Commits

Author SHA1 Message Date
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
Anatol Belski
bcb1dbf6e4 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed bug #76337
2018-05-20 13:33:46 +02:00
xKhorasan
5681f6523b Fixed bug #76337 2018-05-20 13:33:03 +02:00
Dmitry Stogov
524f5245c5 Avoid useless checks, using zend_string_efree(), in cases where the string is known to be a temporary allocated zend_string. 2018-05-08 17:30:15 +03:00
Dmitry Stogov
fdb347a753 zend_is_callable() improvement 2018-05-03 19:25:53 +03:00
Nikita Popov
32692bb083 Merge branch 'PHP-7.2' 2018-04-26 16:17:23 +02:00
Nikita Popov
7c852a7961 Merge branch 'PHP-7.1' into PHP-7.2 2018-04-26 16:17:13 +02:00
shiguangqi2008@gmail.com
98ef183ed0 Fix memory leak in zend_disable_class() 2018-04-26 16:16:37 +02:00
Gabriel Caruso
d0ee2a8254 Add is_countable function
RFC: https://wiki.php.net/rfc/is-countable
2018-03-11 16:41:16 +01:00
Dmitry Stogov
7e329a82c7 Improved ZPP to reduce amount of generated code. 2018-02-16 11:37:20 +03:00
Gabriel Caruso
fef879a2d6 Use bool instead of boolean while throwing a type error
PHP requires boolean typehints to be written "bool" and disallows
"boolean" as an alias. This changes the error messages to match
the actual type name and avoids confusing messages like "must be
of type boolean, boolean given".

This a followup to ce1d69a1f6, which
implements the same change for integer->int.
2018-02-04 23:09:40 +01:00
Gabriel Caruso
ce1d69a1f6 Use int instead of integer in type errors
PHP requires integer typehints to be written "int" and does not
allow "integer" as an alias. This changes type error messages to
match the actual type name and avoids confusing messages like
"must be of the type integer, integer given".
2018-02-04 19:08:23 +01:00
Dmitry Stogov
5c77bac9a7 A cheaper way to reset type flags. 2018-01-17 01:58:51 +03:00
Dmitry Stogov
c32d79b65f cleanup 2018-01-10 12:03:04 +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
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Xinchen Hui
ccd4716ec7 year++ 2018-01-02 12:53:31 +08:00
Dmitry Stogov
d9f5ea691f zend_fcall_info_cache.initialized is removed (zend_fcall_info_cache is initialized if zend_fcall_info_cache.function_handler is set). 2017-12-27 15:15:03 +03:00
Dmitry Stogov
a6fcbb7c87 Use zend_hash_find() instead of zend_hash_find_ptr() to avoid double check 2017-12-27 13:26:06 +03: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
Nikita Popov
76a001e32a Merge branch 'PHP-7.2' 2017-12-13 21:25:38 +01:00
Nikita Popov
652d30acdc Merge branch 'PHP-7.1' into PHP-7.2 2017-12-13 21:25:21 +01:00
Levi Morrison
580bae4a2c Fix copy-and-paste bugs 2017-12-13 21:25:00 +01:00
Dmitry Stogov
6a9d2b2190 Cleanup type conversion 2017-12-07 19:24:55 +03:00
Dmitry Stogov
134248164c Only functions of temporary modules have to be unregistered here 2017-11-30 11:40:52 +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
8795893f4f Make sure string property/class const values are interned
This was done for user-definde class constant values, however this
is also important for properties and internal classes.
2017-11-25 17:12:37 +01:00
Xinchen Hui
d56a534acc RC manipulation cleanup 2 2017-11-02 12:13:35 +08:00
Nikita Popov
cb2884679c Remove zend_get_parameters(_ex) APIs
zend_get_parameters_ex() has been marked as deprecated for a long
time already. What zend_get_paramers() does is even more
questionable under PHP7. Both functions are obsoleted by the ZPP
mechanism, so I'm dropping them.
2017-10-30 22:00:42 +01:00
Dmitry Stogov
fcc08ce19f Prevent reference-counting on persistent zvals (internal constants, default properties and constants of internal classes).
New macro ZVAL_COPY_OR_DUP() is used perform duplication, if necessary.
This should eliminate related race-coditions in ZTS build and prevent reference-counting bugs after unclean shutdown.
2017-10-30 23:13:10 +03:00
Dmitry Stogov
8e01026b82 Extend zend_register_class_alias_ex() with additional argument to allow creating persistent or per-request aliases 2017-10-27 14:44:21 +03:00
Dmitry Stogov
272f5a1716 Extend zend_string API to avoid reallocation in zend_string_init_interned() 2017-10-19 00:02:56 +03:00
Dmitry Stogov
ef5ea48741 Always use IS_CONSTANT_AST (IS_CONSTANT is removed). 2017-10-10 10:11:05 +03:00
Joe Watkins
e2e3c981b5
Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed #75220 - Segfault when calling is_callable on parent
2017-09-27 06:09:24 +01:00
Joe Watkins
0d6c56a8ea
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed #75220 - Segfault when calling is_callable on parent
2017-09-27 06:08:49 +01:00
Joe Watkins
2dd77456fe
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed #75220 - Segfault when calling is_callable on parent
2017-09-27 06:08:01 +01:00
Nester
a680d701ce
Fixed #75220 - Segfault when calling is_callable on parent 2017-09-27 06:07:24 +01: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
Dmitry Stogov
41e5f916bf Fixed bug #74878 (Data race in ZTS builds) 2017-09-18 11:27:10 +03:00
Dmitry Stogov
161c378cc8 Revert "Fixed bug #74878"
This reverts commit 9069734b57.
2017-07-10 12:21:58 +03:00
Nikita Popov
9069734b57 Fixed bug #74878 2017-07-07 22:41:48 +02:00
Anatol Belski
bc5811f361 further sync for vim mode lines 2017-07-04 18:12:45 +02:00
Julien Pauli
cf7ae70540 Merge branch 'PHP-7.1'
* PHP-7.1:
  Updated NEWS
  Updated NEWS
  Fix bug #74832, crash in extension loading
2017-06-29 20:25:18 +02:00
Julien Pauli
e57fce4d00 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Updated NEWS
  Fix bug #74832, crash in extension loading
2017-06-29 20:24:03 +02:00
Julien Pauli
3f4340a796 Fix bug #74832, crash in extension loading 2017-06-29 20:22:21 +02:00
Dmitry Stogov
c0be77aa75 Removed deprecated checks. 2017-06-27 13:12:09 +03:00
Nikita Popov
ee8e75aab4 Extract zend_get_callable_name() API
Instead of interleaving this inside zend_is_callable(), implement
this in a separate function instead.

Also add _deref() hash APIs. I've wanted these for a while, and
this is another place where they're useful, so finally do it...
2017-06-25 18:26:03 +02:00
Jakub Zelenka
eb6614e458 Constify str in add_assoc_string_ex and add_assoc_stringl_ex 2017-06-07 23:44:23 +02:00
Xinchen Hui
225f6cc11f Merge branch 'PHP-7.1'
* PHP-7.1:
  Correct the location
2017-05-27 12:12:17 +08:00
Xinchen Hui
1838f965bc Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Correct the location
2017-05-27 12:12:12 +08:00
Xinchen Hui
ece7d223e8 Correct the location 2017-05-27 12:11:53 +08:00
Xinchen Hui
8af21f3ca6 Merge branch 'PHP-7.1'
* PHP-7.1:
  Added NEWs
  Fixed bug #74657 (Undefined constants in array properties result in broken properties)
2017-05-27 12:09:28 +08:00
Xinchen Hui
cd3520c4d3 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #74657 (Undefined constants in array properties result in broken properties)
2017-05-27 12:08:48 +08:00
Xinchen Hui
5269c4cacb Fixed bug #74657 (Undefined constants in array properties result in broken properties) 2017-05-27 12:06:43 +08:00
Dmitry Stogov
f00d1c72b4 Added ZEND_GET_CLASS, ZEMD_GET_CALLED_CLASS, ZEND_GET_TYPE instructions, to implement corresponding builtin functions. 2017-05-25 18:41:28 +03:00
Nikita Popov
b6a4aad820 Remove the ZEND_ACC_CLONE flag
This one is completely unused
2017-04-22 15:47:53 +02:00
Nikita Popov
6ad0a6fb04 Merge branch 'PHP-7.1' 2017-03-15 19:50:26 +01:00
Nikita Popov
2bba4a0d7f Fix bug #69676 2017-03-15 19:49:02 +01: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
Dmitry Stogov
141d1ba980 Introduced "zend_type" - an abstraction for type-hinting representation. 2017-01-13 11:37:46 +03:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
478f119ab9 Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Sara Golemon
52db03b3e5 Support ZEND_PARSE_PARAMS_THROW in new ZPP API 2016-12-29 18:26:19 -08:00
Anatol Belski
b204b3abd1 further normalizations, uint vs uint32_t
fix merge mistake

yet one more replacement run
2016-11-26 17:29:01 +01:00
Kalle Sommer Nielsen
2104bea5d7 Remove Netware support
If this does not break the Unix system somehow, I'll be amazed. This should get most of it out, apologies for any errors this may cause on non-Windows ends which I cannot test atm.
2016-11-12 11:20:01 +01:00
Anatol Belski
a6715786a7 finish 7.1 port
(cherry picked from commit f1fff032fc)
2016-10-14 01:44:31 +02:00
Stanislav Malyshev
54003ab663 Fix bug #73147: Use After Free in PHP7 unserialize()
(cherry picked from commit 0e6fe3a4c9)
(cherry picked from commit f42cbd749c)
2016-10-14 01:44:16 +02:00
Anatol Belski
f1fff032fc finish 7.1 port 2016-10-12 18:31:59 +02:00
Anatol Belski
b1ef60f90e Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug #73147: Use After Free in PHP7 unserialize()
2016-10-12 17:56:13 +02:00
Stanislav Malyshev
f42cbd749c Fix bug #73147: Use After Free in PHP7 unserialize()
(cherry picked from commit 0e6fe3a4c9)
2016-10-12 17:51:15 +02:00
Nikita Popov
bf907b9961 Revert ReflectionType::__toString() behavior + deprecate 2016-09-28 19:21:51 +02:00
Dmitry Stogov
64a8048c53 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed inconsistent meaning of zend_startup_module_ex() return value used in zend_hash_apply()
2016-09-20 12:34:58 +03:00
Dmitry Stogov
3c16384ea2 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fixed inconsistent meaning of zend_startup_module_ex() return value used in zend_hash_apply()
2016-09-20 12:34:40 +03:00
Dmitry Stogov
4dd70b6e2f Fixed inconsistent meaning of zend_startup_module_ex() return value used in zend_hash_apply() 2016-09-20 12:29:57 +03:00
Stanislav Malyshev
19866fb76c Fix various int size overflows.
Add function for detection of string zvals with length that does not fit
INT_MAX.
2016-09-12 21:04:23 -07:00
Andrea Faulds
fc5497cb92 Merge branch 'PHP-7.0' into PHP-7.1 2016-09-11 22:46:20 +01:00
Andrea Faulds
d690014bf3 Remove zpp fallback code (always use Fast ZPP)
Squashed commit of the following:

commit 3e27fbb3d2
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Sep 11 19:14:37 2016 +0100

    Keep dummy FAST_ZPP macro for compatibility

commit 8a7cfd00de
Author: Andrea Faulds <ajf@ajf.me>
Date:   Mon Sep 5 22:36:03 2016 +0100

    Remove FAST_ZPP macro and plain zpp fallback code
2016-09-11 22:44:46 +01:00
Anatol Belski
0a50cbabf6 fix unused assignment 2016-09-01 23:45:31 +02:00
Davey Shafik
12ee17d5e0 Implement \ArgumentCountError exception 2016-08-30 19:35:56 -07:00
Nikita Popov
664e5f392d Merge branch 'PHP-7.0' 2016-07-14 21:41:49 +02:00
Nikita Popov
a50a5c1bf1 Fix is_callable() on abstract method via object 2016-07-14 21:41:41 +02:00
Nikita Popov
0bda0422af Merge branch 'PHP-7.0'
Conflicts:
	Zend/zend_vm_execute.h
2016-07-14 18:39:48 +02:00
Nikita Popov
00047fcf84 Fix leak when dynamically calling abstract method 2016-07-14 18:39:08 +02:00
Aaron Piotrowski
d9a9cf8eca Merge branch 'master' into iterable 2016-07-03 22:42:10 -05:00
Dmitry Stogov
ebb99a1a3a Fixed compilation warnings 2016-06-21 16:55:17 +03:00
Dmitry Stogov
1616038698 Added ZEND_ATTRIBUTE_FORMAT to some middind functions.
"%p" replaced by ZEND_LONG_FMT to avoid compilation warnings.
Fixed most incorrect use cases of format specifiers.
2016-06-21 16:00:37 +03:00
Dmitry Stogov
421843977f Fixed bug #71266 (Missing separation of properties HT in foreach etc). 2016-06-07 23:18:52 +03:00
Aaron Piotrowski
340a00008d Add iterable to zend_get_type_by_const() 2016-06-03 17:56:13 -05:00
Aaron Piotrowski
72692e9a9c Add iterable pseudo-type 2016-06-03 17:42:04 -05:00
Dmitry Stogov
9b27df8df5 Fixed white-spaces 2016-05-24 12:37:20 +03:00
Dmitry Stogov
7b94b958cc Intern some known (and offten used) strings. 2016-05-12 13:47:22 +03:00
Dmitry Stogov
c19cb70dac Revert "Refactor zval cleanup into single function"
This reverts commit bac6fdb0c5.
2016-05-06 10:47:58 +03:00
Bob Weinand
bac6fdb0c5 Refactor zval cleanup into single function
Also use zval_ptr_dtor_nogc() everywhere in Zend in favor of zval_dtor()
2016-05-05 23:31:57 +02:00
Xinchen Hui
d08df44425 Merge branch 'PHP-7.0'
* PHP-7.0:
  Mark fcc as initialized for object calls
2016-05-03 11:13:41 +08:00
Bob Weinand
b4c5009220 Mark fcc as initialized for object calls
This results in 1% speedup (cycle count) on some real world applications
2016-05-03 02:07:06 +02:00
Dmitry Stogov
6499162ff0 - get rid of EG(scope). zend_get_executed_scope() should be used instead.
- ichanged zval_update_constant_ex(). Use IS_TYPE_IMMUTABLE flag on shared constants and AST, instead of "inline_change" parameter.
2016-04-28 04:13:34 +03:00
Dmitry Stogov
f0a2e8eb13 Removed "zend_fcall_info.function_table". It was assigned in many places, but is never used. 2016-04-27 13:46:38 +03:00
Andrea Faulds
1e82ad8038 Warn about invalid strings in arithmetic
Squashed commit of the following:

commit e05d3b6732
Author: Andrea Faulds <ajf@ajf.me>
Date:   Wed Mar 30 01:43:35 2016 +0100

    UPGRADING and NEWS

commit 6caf1d4585
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Mar 20 21:18:33 2016 +0000

    Fixes

commit 6dadb1b0ef
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Feb 14 02:15:01 2016 +0000

    Add test for numeric string errors in assignment

commit bd5f04e8dd
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sat Feb 13 23:53:05 2016 +0000

    Add test for numeric string errors

commit c72e92f16d
Author: Andrea Faulds <ajf@ajf.me>
Date:   Tue Jan 26 23:28:33 2016 +0000

    Add test for scientific notation in integer operations

commit d94c08852d
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Feb 14 01:25:57 2016 +0000

    Disable optimiser evaluation for numeric string errors

commit 30ee954ed1
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Feb 14 01:46:25 2016 +0000

    fixup

commit a6403b79e0
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sat Feb 13 22:00:27 2016 +0000

    Do not convert error-causing numeric strings ahead-of-time

commit f9dc354014
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sat Feb 13 19:15:38 2016 +0000

    Disable compile-time evaluation for numeric string errors

commit e05b0cc849
Author: Andrea Faulds <ajf@ajf.me>
Date:   Fri Feb 5 11:42:26 2016 +0000

    Make _zval_get_long_func_noisy function for inlining

commit 84d66321a5
Author: Andrea Faulds <ajf@ajf.me>
Date:   Tue Jan 26 23:10:00 2016 +0000

    Update tests

commit 5ac4a0cc4b
Author: Andrea Faulds <ajf@ajf.me>
Date:   Tue Jan 26 22:08:19 2016 +0000

    Use is_numeric_string_ex for zval_get_long etc.

commit c21f088485
Author: Andrea Faulds <ajf@ajf.me>
Date:   Thu Jan 7 21:13:04 2016 +0000

    Update tests

commit 63e214cf81
Author: Andrea Faulds <ajf@ajf.me>
Date:   Wed Jan 6 00:28:01 2016 +0000

    Warn on non-/bad numeric strings in arithmetic
2016-03-30 01:44:27 +01:00
Dmitry Stogov
c67c166f93 Removed zend_fcall_info.symbol_table 2016-03-02 17:50:55 +03:00
Nikita Popov
37d1bbe456 Merge branch 'PHP-7.0' 2016-02-21 13:01:28 +01:00
Nikita Popov
0bd64b50b8 Fixed bug #71617 2016-02-21 13:00:37 +01:00
Nikita Popov
2d605e5f24 Merge branch 'PHP-7.0' 2016-02-14 14:47:42 +01:00
Nikita Popov
c9357f82d3 Format string fixes
Conflicts:
	ext/pgsql/pgsql.c
2016-02-14 14:45:53 +01:00
Xinchen Hui
563659822d Merge branch 'PHP-7.0' 2016-01-02 17:56:54 +08:00
Xinchen Hui
97a9470d97 bump year which is missed in rev 49493a2 2016-01-02 17:56:11 +08:00
Xinchen Hui
3537e95dae bump year which is missed in rev 49493a2 2016-01-02 17:51:24 +08:00
Xinchen Hui
ad51c709c3 Merge branch 'PHP-7.0' 2015-12-13 05:06:22 -08:00
Xinchen Hui
07b33992a2 Fixed bug #71109 (ZEND_MOD_CONFLICTS("xdebug") doesn't work) 2015-12-13 05:06:08 -08:00
Nikita Popov
04e3d82b55 Make duplicate class constant error for internal class
And drop two duplicate constant declarations from intl. These
were leaking previously.
2015-12-10 22:22:49 +01:00
Dmitry Stogov
a75c195000 Implemented the RFC Support Class Constant Visibility.
Squashed commit of the following:

commit f11ca0e7a5
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue Dec 8 12:38:42 2015 +0300

    Fixed test expectation

commit 211f873f54
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue Dec 8 12:28:38 2015 +0300

    Embed zend_class_constant.flags into zend_class_constants.value.u2.access_flags

commit 51deab84b2
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon Dec 7 11:18:55 2015 +0300

    Fixed issues found by Nikita

commit 544dbd5b47
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Sat Dec 5 02:41:05 2015 +0300

    Refactored immplementation of https://wiki.php.net/rfc/class_const_visibility
    @reeze created an RFC here and I emailed internals here and didn't get any responses positive/negative.
2015-12-08 12:40:42 +03:00
Xinchen Hui
0495bf5650 Revert "fix typos "paramer" -> "parameters""
ABI BC break

This reverts commit 6ac12f1337.
2015-12-08 10:52:50 +08:00
Márcio Almada
6ac12f1337 fix typos "paramer" -> "parameters" 2015-12-07 14:48:26 +08:00
Márcio Almada
2dcfd8d16f fix typos "paramer" -> "parameters" 2015-12-07 01:59:53 -04:00
Xinchen Hui
34bff5b91c Merge branch 'PHP-7.0' 2015-11-23 23:16:11 +08:00
Xinchen Hui
7e9f416218 Fixed bug #70959 (ArrayObject unserialize does not restore protected fields) 2015-11-23 23:15:33 +08:00
Xinchen Hui
f8bf1f33a5 Fixed bug #70959 (ArrayObject unserialize does not restore protected fields) 2015-11-23 07:08:47 -08:00
Andrea Faulds
366ba41334 Add void return type 2015-11-18 17:30:49 +00:00
Xinchen Hui
2bed2152e6 Revert "Fixed bug Bug #70895 null ptr deref and segfault"
This reverts commit 8eef11d317.
2015-11-12 14:34:00 +08:00
Xinchen Hui
c245fd7d91 Revert "refix bug #70895"
This reverts commit 93240102e0.
2015-11-12 14:33:14 +08:00
Xinchen Hui
75f85288f4 Revert "Fixed bug #70898 (SIGBUS/GPF zend_mm_alloc_small (zend_alloc.c:1291))"
This reverts commit e4e54f33ce.
2015-11-12 14:32:35 +08:00
Xinchen Hui
e4e54f33ce Fixed bug #70898 (SIGBUS/GPF zend_mm_alloc_small (zend_alloc.c:1291))
Include tail \0
2015-11-12 14:18:02 +08:00
Anatol Belski
93240102e0 refix bug #70895
move this code to where it belongs, no behavior change to actual
throwing function, thus retaining compat with old ZPP
2015-11-12 01:39:02 +01:00
Anatol Belski
8eef11d317 Fixed bug Bug #70895 null ptr deref and segfault 2015-11-12 00:52:36 +01:00
Dmitry Stogov
ca36b7bc13 Added zend_internal_function.reserved[] fields, to allow extensions keep additional associated information.
We didn't have zend_internal_function.reserved[] in PHP5, but we always allocated space for zend_function union, and extensions were able to reuse zend_function.op_array.reserved[] even for internal function. Now this is not possible. And extensions have to use zend_function.op_array.reserved[] for user functions and zend_function.internal_function.reserved[] for internal.
2015-09-29 13:31:47 +03:00
Dmitry Stogov
560e4fa393 Removed or simplified incorrect SEPARATE_*() macros usage. 2015-09-29 11:17:43 +03:00
Bob Weinand
95dbe1d03e Short-circuit zend_parse_parameters_none() so that expensive zpp() call never happens in non-exceptional case 2015-09-20 02:43:22 +02:00
Stanislav Malyshev
9b1a224d4e Merge branch 'PHP-5.6'
* PHP-5.6: (21 commits)
  fix unit tests
  update NEWS
  add NEWS for fixes
  Improve fix for #70172
  Fix bug #70312 - HAVAL gives wrong hashes in specific cases
  fix test
  add test
  Fix bug #70366 - use-after-free vulnerability in unserialize() with SplDoublyLinkedList
  Fix bug #70365 - use-after-free vulnerability in unserialize() with SplObjectStorage
  Fix bug #70172 - Use After Free Vulnerability in unserialize()
  Fix bug #70388 - SOAP serialize_function_call() type confusion
  Fixed bug #70350: ZipArchive::extractTo allows for directory traversal when creating directories
  Improve fix for #70385
  Fix bug #70345 (Multiple vulnerabilities related to PCRE functions)
  Fix bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte value of 32 bytes)
  Fix bug #70219 (Use after free vulnerability in session deserializer)
  Fix bug ##70284 (Use after free vulnerability in unserialize() with GMP)
  Fix for bug #69782
  Add CVE IDs asigned (post release) to PHP 5.4.43
  Add CVE IDs asigned to #69085 (PHP 5.4.39)
  ...

Conflicts:
	ext/exif/exif.c
	ext/gmp/gmp.c
	ext/pcre/php_pcre.c
	ext/session/session.c
	ext/session/tests/session_decode_variation3.phpt
	ext/soap/soap.c
	ext/spl/spl_observer.c
	ext/standard/var.c
	ext/standard/var_unserializer.c
	ext/standard/var_unserializer.re
	ext/xsl/xsltprocessor.c
2015-09-02 00:37:20 -07:00
Dmitry Stogov
66770f9c37 Added missing set of fcc->initialized flag. 2015-09-01 03:15:50 +03:00
Dmitry Stogov
37f0c6b5cb Add myself into list of authors of the most refactored files. 2015-08-31 11:38:16 +03:00
Dmitry Stogov
71af54e5f6 Mark error and exception functions as "cold" (Matt's idea) 2015-08-19 14:40:56 +03:00
Julien Pauli
9a138b47c9 Removed unused code 2015-08-18 14:33:04 +02:00
Xinchen Hui
0bddc18619 Fixed bug #70156 (Segfault in zend_find_alias_name) 2015-07-28 16:39:58 +08:00
Dreamsxin
7554e83037 Updated zend_update_static_property 2015-07-13 08:42:18 +08:00
Aaron Piotrowski
5df893ce3c Use NULL where possible for exception class
Matches usage of zend_throw_exception()/zend_throw_exception_ex().
2015-07-07 12:10:55 -05:00
Aaron Piotrowski
1adf3df81e Throw TypeError for invalid callback
Matches behavior of zend_internal_type_error() if E_ERROR is passed to
zend_wrong_callback_error().
2015-07-06 15:03:35 -05:00
Aaron Piotrowski
22c38b2ef5 Remove need to pass error level 2015-07-03 17:53:41 -05:00
Aaron Piotrowski
5a99c07ecc Enable throwing custom exceptions from errors 2015-07-03 17:53:40 -05:00
Dmitry Stogov
7aa7627172 Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes). 2015-06-30 13:59:27 +03:00
Dmitry Stogov
4bd22cf1c1 Improved zend_string API (Francois Laupretre)
Squashed commit of the following:

commit d96eab8d79
Author: Francois Laupretre <francois@tekwire.net>
Date:   Fri Jun 26 01:23:31 2015 +0200

    Use the new 'ZSTR' macros in the rest of the code.

    Does not change anything to the generated code (thanks to compat macros) but cleaner.

commit b352643910
Author: Francois Laupretre <francois@tekwire.net>
Date:   Thu Jun 25 13:45:06 2015 +0200

    Improve zend_string API

    Add missing methods
2015-06-29 16:44:54 +03:00
Nikita Popov
628d439402 Drop superfluous __toString handling code
This is already covered by the cast_object invokation above it. We
do not use this kind of fallback in any other casting code anymore.
2015-06-22 15:33:41 +02:00
Dmitry Stogov
8e10e8f921 Avoid zval duplication in ZVAL_ZVAL() macro (it was necessary only in few places).
Switch from ZVAL_ZVAL() to simpler macros where possible (it makes sense to review remaining places)
2015-06-12 12:33:23 +03:00
Dmitry Stogov
6bcf121f5b micro-optimization 2015-06-03 13:43:05 +03:00
Dmitry Stogov
ca64b41b99 Fixed zend_update_class_constants() to always resolve all constants.
Call zend_update_class_constants() only when necessary.
2015-05-21 04:13:10 +03:00
Dmitry Stogov
70c86732cb Use zend_string to represent pdo_column_data.name and avoid duplication. 2015-05-05 16:19:51 +03:00
Dmitry Stogov
388c2cbdbc Micro optimizations 2015-04-28 19:11:45 +03:00
Dmitry Stogov
49cf7c5d12 Don't propogate "fake" EX(called_scope) and EX(This) into each internal function.
They need quite seldom and it's cheaper to get them from corresponfing upper stack frame.
2015-04-23 12:16:37 +03:00
Dmitry Stogov
15a5f61cf4 Use fast method to check if first arguments should be passed by reference (not tested onbig endian). 2015-04-22 21:46:13 +03:00
Xinchen Hui
ec8671d429 Remove duplicated assignment 2015-04-16 11:58:50 +08:00
Dmitry Stogov
5e8133f453 Squashed commit of the following:
commit 2399fc84c5
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 12:38:08 2015 +0300

    Removed useless assignment

commit 796b633817
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 12:35:31 2015 +0300

    Fixed execution with overriden zend_execute_ex()

commit 4a9fb125aa
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 02:02:58 2015 +0300

    Fixed executor without global registers

commit d456c30e00
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 01:30:35 2015 +0300

    Restored original behavior for tests/classes/__call_004.phpt

commit 479646d37f
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 00:32:17 2015 +0300

    Fixed test. We don't keep stack frame for fake function anymore.

commit 9ae61e33e2
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 00:30:09 2015 +0300

    Use ZEND_ACC_CALL_VIA_TRAMPOLINE instead of ZEND_ACC_CALL_VIA_HANDLER. Keep ZEND_ACC_CALL_VIA_HANDLER for compatibility.

commit 0a8403a2a0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 00:05:43 2015 +0300

    Rename PROXY_CALL into CALL_TRAMPLINE.
    Generalize API to allow reuse EG(trampline) for other purposes.

commit 4ea0525c10
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 23:22:25 2015 +0300

    Reuse EG(proxy_call_op) for all proxy. Move proxy related functions from zend_objects_API to zend_object_handlers.

commit 529bf737ca
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 21:42:23 2015 +0300

    Accurate use of proxy_call

commit 5d62837d5b
Merge: 83e749f 690843f
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 19:40:00 2015 +0300

    Merge branch 'master' into opcodefy-call

    * master:
      Fixed GOTO executor
      Fixed typo
      Changed ArrayIterator implementation using zend_hash_iterator_... API. Allowed modification of itterated ArrayObject using the same behavior as proposed in `Fix "foreach" behavior`. Removed "Array was modified outside object and internal position is no longer valid" hack.

commit 83e749ff3b
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 19:39:10 2015 +0300

    Improved ZEND_PROXY_CALL

commit 0c829afc53
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 15:14:49 2015 +0300

    Reverted white-space changes

commit df65144488
Merge: 5fd2f97 97756d9
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 14:37:07 2015 +0300

    Merge branch 'opcodefy-call' of github.com:laruence/php-src into opcodefy-call

    * 'opcodefy-call' of github.com:laruence/php-src:
      Ready for PR
      Fixed static call
      Improve performance by using prealloated op_arrray
      Respect called_scope
      Support internal magical __call/__callStatic
      opcode-fy magical __callStatic
      Opcode-fy magical __call

commit 97756d9190
Author: Xinchen Hui <laruence@gmail.com>
Date:   Thu Apr 9 19:07:59 2015 +0800

    Ready for PR

commit 74f9930846
Author: Xinchen Hui <laruence@gmail.com>
Date:   Thu Apr 9 19:03:00 2015 +0800

    Fixed static call

commit ec1d9eb592
Author: Xinchen Hui <laruence@gmail.com>
Date:   Thu Apr 9 18:23:17 2015 +0800

    Improve performance by using prealloated op_arrray

commit df7fbbf949
Author: Xinchen Hui <laruence@gmail.com>
Date:   Thu Apr 9 15:10:02 2015 +0800

    Respect called_scope

commit 769d1d59fb
Author: Xinchen Hui <laruence@gmail.com>
Date:   Thu Apr 9 12:19:23 2015 +0800

    Support internal magical __call/__callStatic

commit a980fedd5b
Author: Xinchen Hui <laruence@gmail.com>
Date:   Wed Apr 8 18:35:41 2015 +0800

    opcode-fy magical __callStatic

commit 73855f7d53
Author: Xinchen Hui <laruence@gmail.com>
Date:   Wed Apr 8 14:21:55 2015 +0800

    Opcode-fy magical __call
2015-04-10 23:01:00 +03:00
Nikita Popov
122d759618 Always throw TypeException on throwing zpp failures
Introduces a ZEND_PARSE_PARAMS_THROW flag for zpp, which forces to
report FAILURE errors using a TypeException instead of a Warning,
like it would happen in strict mode.

Adds a zend_parse_parameters_throw() convenience function, which
invokes zpp with this flag.

Converts all cases I could identify, where we currently have
throwing zpp usage in constructors and replaces them with this API.
Error handling is still replaced to EH_THROW in some cases to handle
other, domain-specific errors in constructors.
2015-04-06 11:27:34 +02:00
Nikita Popov
f920f974c4 Clarify that some zpp errors are just for debugging
These occur when the extension author messed up, not during normal
script execution.

Make these core errors and show them even with PARAMS_QUIET.
2015-04-04 10:28:37 +02:00
Dmitry Stogov
ad863c1740 Convert fatal errors into EngineException 2015-04-02 14:19:52 +03:00
Dmitry Stogov
53d20140fb Fixed performance degradation introduced with lateast EnfineException related changes.
Restore original errors order in executor.
2015-04-02 03:56:42 +03:00
Dmitry Stogov
ea09a9fa32 Convert fatal errors into EngineExceptions
Make zval_update_constant_ex(), zval_update_constant(), zend_update_class_constants() and zend_ast_evaluate() return SUCCESS or FAILURE.
2015-04-02 02:05:25 +03:00
Dmitry Stogov
ec760d8fff Convert fatal errors into EngineExceptions 2015-04-01 20:01:57 +03:00
Dmitry Stogov
780a8123fe Convert fatal errors into EngineExceptions 2015-04-01 16:48:15 +03:00
Dmitry Stogov
acfc31c0f8 Use zend_error_noreturn() for fatal errors 2015-04-01 13:32:23 +03:00
Nikita Popov
085774997b Drop support for static calls from incompatible context
Implemented by NULLing $this.
2015-04-01 11:42:05 +02:00
Nikita Popov
8d00385871 Reclassify E_STRICT notices
Per RFC https://wiki.php.net/rfc/reclassify_e_strict

While reviewing this, found that there are still three E_STRICTs
left in libraries - need to discuss those.
2015-04-01 11:17:55 +02:00
Dmitry Stogov
1018f462d8 Patch improvement:
Removed the corresponding core code.
Fixed ext/com_dotnet and ext/date.
Refactored ext/intl changes.
Improved ext/fileinfo and ext/pdo changes.
Fixed tests.
2015-03-30 18:53:38 +03:00
Kalle Sommer Nielsen
02be73b5fa Constness to zend_get_object_type(), thanks Michael! 2015-03-25 07:01:04 +01:00
Kalle Sommer Nielsen
927d53fda4 Change "Cannot redeclare class X" into "Cannot redeclare class/interface/trait X", meaning that the following:
C:\> php -r "trait A { } trait A { }"

Will now properly print "Cannot redeclare trait A" instead of "Cannot redeclare class A" to make error messages a tiny bit clearer. Admittedly, a better solution can most likely be made by actually telling what the colliding object is a type of.

Internally this adds a new function:
 zend_get_object_type()
2015-03-25 06:31:11 +01:00
Nikita Popov
a50e9d87f2 Partially revert "Fix uninitialized value condition"
This reverts commit e874f76096,
which broke zpp quite mode.

Only the initialization of the "severity" variable is retained.
2015-03-22 09:25:32 +01:00
Bob Weinand
e874f76096 Fix uninitialized value condition 2015-03-22 00:14:47 +01:00
Dmitry Stogov
35f9b90bb8 ZPP changed to lazely check for "strict/weak" only if it's really necessary.
Cleanup.
2015-03-20 23:18:52 +03:00
Dmitry Stogov
5935612666 Improved type hinting:
EX_PREV_USES_STRICT_TYPES() and family changed/renamed to fit with other macros
Optimized zend_verify_internal_arg_type() and family (they don't need "strict" argument anymore)
Standerd ZPP is called from VM only for weak type check or strict exception (int -> double)
Fixed ZEND_RECV_VARIADIC
Fixed ZEND_STRLEN

TODO: should we accept IS_NULL for non-nullable arguments?
2015-03-20 16:04:04 +03:00
Dmitry Stogov
44669e8f41 Fixed white spaces 2015-03-20 11:10:29 +03:00
Anthony Ferrara
7044f9c6df Refactor as to not use call info, but add the flag to the op_array. 2015-03-19 13:30:11 -04:00
Anthony Ferrara
0ef80ac351 Fix severity issues with callbacks, start work porting ZEND_STRLEN opcode to work with strict mode, more refactoring to come 2015-03-19 12:26:34 -04:00
Anthony Ferrara
78d2399493 Fix C89 compatibility by moving a misplaced if statement 2015-03-18 18:38:16 -04:00
Anthony Ferrara
579e7fa457 Style cleanup, as well as fixing bug with missing argument for WRONG_PARAM_COUNT_WITH_RETVAL 2015-03-18 15:45:16 -04:00
Anthony Ferrara
8be4266f6a Clean up API renames for zend_wrong_param_count to maintain BC, introducing a zend_wrong_param_count_ex() function when you know strict value 2015-03-18 15:42:49 -04:00
Anthony Ferrara
7feebead1b Refactor error implementation significantly to centralize error mode behavior. Add zend_internal_type_error() function 2015-03-18 12:23:09 -04:00
Anthony Ferrara
d22bfb8aa6 Merge in master, fix merge conflicts and update patch to support exceptions everywhere 2015-03-18 10:50:11 -04:00
Stanislav Malyshev
69d183dd19 Merge branch 'pull-request/1049'
* pull-request/1049:
  Rename __callstatic (internal name) to __callStatic (userland name) in error message
2015-03-08 17:57:47 -07:00
Dmitry Stogov
ff039c3c6d Merge commit 'refs/pull/1066/head' of git://github.com/php/php-src
* git://github.com/php/php-src:
  Add zend assert deleted by accident
  Let's keep it simple
  Improve internal function return types checking for parent
2015-03-04 18:17:06 +03:00
Xinchen Hui
aa63449b6e Remove wrong commit committed by accident 2015-03-03 18:29:26 +08:00
Xinchen Hui
7ad6711a4d Fixed bug #69167 (call_user_func does not support references anymore) 2015-03-03 18:11:56 +08:00
Anthony Ferrara
dc35868a77 Merge branch 'master' into scalar_type_hints_v5 2015-02-20 13:33:35 -05:00
Dmitry Stogov
5f76eed14e don't count op_arrays stored in opcache SHM 2015-02-20 14:59:30 +03:00
Anthony Ferrara
9109e48749 Merge in master 2015-02-18 10:35:39 -05:00
Guilherme Blanco
8c81d80e10 Made ZEND_ACC_TRAIT a saner value
CC_TRAIT valued as 0x120 is too magical to be comprehensible by others.
2015-02-12 23:20:19 +01:00
Anatol Belski
07fdc1c78b fix data types 2015-02-12 18:39:40 +01:00
Andrea Faulds
86b0685f55 Prefix zend_wrong_param_count with _ to discourage use 2015-02-10 15:48:07 +00:00
Andrea Faulds
fe663cc404 Partial ZPP strictness implementation 2015-02-10 15:48:06 +00:00
Andrea Faulds
1a28ad036e Forbid scalar type hint names for use, class_alias 2015-02-10 15:48:05 +00:00
Andrea Faulds
c3c0f531a2 Scalar type hints with ZPP casting rules 2015-02-10 15:48:04 +00:00
Reeze Xia
49073fcf38 Add zend assert deleted by accident 2015-02-07 19:45:22 +08:00
Reeze Xia
61239e1e8b Let's keep it simple 2015-02-07 19:43:00 +08:00
Reeze Xia
d9c28c5581 Improve internal function return types checking for parent
Previously the checking was against 'self', 'parent' need
to be checked as user land declearation as well.

This also add two missing test cases.
2015-02-07 14:19:56 +08:00
Dmitry Stogov
f5a9cfc33a Merge branch 'internal-function-return-types' of github.com:reeze/php-src into test
* 'internal-function-return-types' of github.com:reeze/php-src:
  Add load time return type checking to match user land logic
  Add test function arguments
  Implemented internal function return types
2015-02-05 11:01:07 +03:00
Reeze Xia
601fcc31af Add load time return type checking to match user land logic 2015-02-05 11:22:11 +08:00
Reeze Xia
bff4c47fa7 Implemented internal function return types 2015-02-05 01:04:54 +08:00
Dmitry Stogov
9e70d7672d Move zend_object->guards into additional slot of zend_object->properties_table[]. As result size of objects without __get/__set/__unset/__isset magic methods is reduced. 2015-02-04 15:24:13 +03:00
Dejan Marjanovic
836dcb1da7 Rename __callstatic (internal name) to __callStatic (userland name) in error message 2015-02-03 17:04:52 +01:00
Levi Morrison
c8576c5a46 Implement return types
RFC is documented here: https://wiki.php.net/rfc/return_types
2015-01-27 11:49:56 -07:00
Dmitry Stogov
061c0ed9ee Fixed double free and cleanup 2015-01-22 12:59:53 +03:00
Dmitry Stogov
3e31838d19 zend_read_property() has to provide a holder for return value.
Previously it was possible that zend_read_property() returned pointer to zval allocated on stack.
2015-01-22 11:50:42 +03:00
Xinchen Hui
6f67d5ad6e Unused parse_arg_object_to_string 2015-01-20 12:02:54 +08:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Xinchen Hui
0579e8278d bump year 2015-01-15 23:26:37 +08:00
Xinchen Hui
2193de0d18 Faster sorting algo 2015-01-14 18:02:41 +08:00
Dmitry Stogov
7e93de101f Handle run-time cache for static properties directly in executor.
Removed cache_slot argument in zend_std_get_static_property() and zend_std_unset_static_property().
2015-01-13 09:33:15 +03:00
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00
Xinchen Hui
84f2311bc9 Fixed #68779 (Incorrect sizeof) 2015-01-10 10:58:22 -05:00
Andrea Faulds
41e3fdba8e Make zend_parse_parameters share fast zpp implementation where possible
Rename shared implementation functions and build them unconditionally

Don't fail on empty path for zend_parse_arg_path

Update type names

Fix behaviour of by-reference "z"

Make 'o' use zend_parse_arg_object

Fix NULL string check in zend_parse_arg_path(_str)
2014-12-29 12:28:28 +00:00
Dmitry Stogov
f2c2acb9a9 For disabled function, to disable arguments checks, we have to reset num_args and some related flags (in addition to arg_info) 2014-12-24 15:34:52 +03:00
Dmitry Stogov
c42ac09518 Added new API function 'zend_string* zend_string_tolower(zend_string*)'.
It simplifies code and avoids unnecessary allocation and copying if string is already in lower case.
2014-12-24 15:04:51 +03:00
Dmitry Stogov
2646f7bcb9 Don't count variadic argument in zend_func.common.num_args. This allows faster CALL/RETURN code. 2014-12-22 16:44:39 +03:00
Andrea Faulds
e5eb9530ab Use "float" and "integer" in typehint and zpp errors 2014-12-21 13:23:02 +00:00
Anatol Belski
61f90fbe0b Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
  Save 8 bytes on 64 bits

Conflicts:
	Zend/zend_API.c
2014-12-15 07:13:09 +01:00
Xinchen Hui
8f177fde90 Save 8 bytes on 64 bits 2014-12-15 00:43:28 -05:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Andrea Faulds
0ea0b591d7 Merge branch 'zppFailOnOverflow'
* zppFailOnOverflow:
  Fix MySQLi tests
  Fixed gd test
  Refactor ZEND_LONG_MAX/MIN checks into ZEND_DOUBLE_FITS_LONG()
  Fixed copy-and-paste error
  Fix more 32-bit tests
  Skip buncha tests on 32-bit
  skip simplexml
  skip posix 32-bit
  skip tests on 32-bit
  Fixes simplexml test
  Fixes posix tests
  Fixes iconv tests
  Marked tests as 32-bit
  Fixed more 32-bit tests
  Fixed some 32-bit tests
  Mark said ext/date tests as 32-bit only
  Fixed ext/date tests broken by zpp error on overflow
  Fixed broken tests
  Make zpp fail if NaN passed for int, or out-of-range float for non-capping int

Conflicts:
	ext/date/tests/getdate_variation7.phpt
	ext/date/tests/localtime_variation3.phpt
2014-12-13 18:38:15 +00:00
Dmitry Stogov
3893c1fc3d Fixed compilation warnings 2014-12-12 21:57:34 +03:00
Michael Wallner
f0a17c293b Fix zend_fcall_info_arg*() to use ZVAL_COPY
As zend_fcall_info_args_clear() calls zval_ptr_dtor() we also have
to increase the refcount of refcounted zvals added as params,
like it is already done in zend_fcall_info_args_ex().
2014-12-04 13:02:30 +01:00
Dmitry Stogov
5dd427eac2 Use zend_string* for op_array->arg_info[]->name and op_array->arg_info[]->class_name. For internal functions we still use char*. 2014-12-03 16:56:09 +03:00
Andrea Faulds
f90b877f41 Refactor ZEND_LONG_MAX/MIN checks into ZEND_DOUBLE_FITS_LONG() 2014-11-29 02:13:20 +00:00
Andrea Faulds
01554bf3e4 Merge branch 'master' into zppFailOnOverflow 2014-11-29 01:45:54 +00:00
Dmitry Stogov
dcfe58773e Rename EX_VAR_2() into ZEND_CALL_VAR() and EX_VAR_NUM_2() into ZEND_CALL_VAR_NUM(). 2014-11-28 11:11:33 +03:00
Dmitry Stogov
11384ba77b Pack EX(num_args) into EX(This).u2.num_args 2014-11-28 10:28:49 +03:00
Andrea Faulds
d22f3b18ea Merge branch 'master' into zppFailOnOverflow 2014-11-08 18:28:43 +00:00
Dmitry Stogov
75041379a6 Improved object property access. 2014-11-06 14:50:03 +03:00
Andrea Faulds
71566b994f Merge branch 'master' into zppFailOnOverflow 2014-11-01 22:49:53 +00:00
Xinchen Hui
ccb09eb352 Merge branch 'PHP-5.6'
Conflicts:
	Zend/zend_API.c
2014-10-31 17:37:56 +08:00
Xinchen Hui
d9d181e5ad Fixed Bug #68104 (Segfault while pre-evaluating a disabled function) 2014-10-31 17:32:23 +08:00
Anatol Belski
f7d3355e75 fix datatype mismatches
and convert len args to size_t where the underlaying API uses zend_string
2014-10-24 20:50:06 +02:00
Anatol Belski
ca46bd04b1 fix datatype mismatch warnings 2014-10-24 20:50:04 +02:00
Anatol Belski
f227922446 move key lengths to use size_t as zend_string is used internally anyway 2014-10-23 10:29:54 +02:00
Dmitry Stogov
7471c21781 Optimized property access handlers. Removed EG(std_property_info). 2014-10-17 19:10:05 +04:00
Anatol Belski
8a55159258 Merge branch 'PHP-5.6'
* PHP-5.6:
  DLL export several APIs needed for phpdbg
2014-10-12 19:22:40 +02:00
Anatol Belski
c96a6b4493 DLL export several APIs needed for phpdbg 2014-10-12 19:22:03 +02:00
Nikita Popov
df79b9b27a Update get_class_name semantics
* get_class_name is now only used for displaying the class name
   in debugging functions like var_dump, print_r, etc. It is no
   longer used in get_class() etc.
 * As it is no longer used in get_parent_class() the parent
   argument is now gone. This also fixes incorrect parent classes
   being reported in COM.
 * get_class_name is now always required (previously some places
   made it optional and some required it) and is also required
   to return a non-NULL value.
 * Remove zend_get_object_classname. This also fixes a number of
   potential leaks due to incorrect usage of this function.
2014-10-09 20:48:27 +02:00
Nikita Popov
e5e9d8346f Remove zend_get_class_entry function 2014-10-09 14:17:30 +02:00
Nikita Popov
b3a779de68 Remove get_class_entry object handler 2014-10-09 14:08:10 +02:00
Nikita Popov
ee5b30fa19 Remove support for classes without class entries
get_class_entry must be non-NULL and return non-NULL.
2014-10-09 13:58:14 +02:00
Dmitry Stogov
bd9a234645 Replaced EG(This) and EX(object) with EX(This).
Internal functions now recieves zend_execute_data as the first argument.
2014-10-03 19:32:46 +04:00
Xinchen Hui
f248b17e07 Fixed segfault 2014-09-29 12:06:56 +08:00
Andrea Faulds
bb55397bab Make zpp fail if NaN passed for int, or out-of-range float for non-capping int 2014-09-22 17:06:16 +01:00
Nikita Popov
c343ca4efb Split inheritance into separate file
This moves handling of inheritance and interface implementation
from zend_compile.c into a separate zend_inheritance.c file, as
this is not really related to compilation.
2014-09-19 19:54:37 +02:00
Dmitry Stogov
3bc8a958c5 Fixed useless or duplicated IS_INTERNED() checks 2014-09-19 15:41:01 +04:00
Anatol Belski
d3622c2445 fix signed/unsigned mismatch 2014-09-15 12:58:42 +02:00
Nikita Popov
ebc6da5628 zend_get_property_info takes a zend_string* now 2014-09-14 16:18:08 +02:00
Nikita Popov
88e07324d9 Drop dead assignments 2014-09-13 22:31:21 +02:00
Anatol Belski
d6faac2cb2 make array/object APIs accept large strings as values of elements/props 2014-08-28 19:17:47 +02:00
Anatol Belski
3234480827 first show to make 's' work with size_t 2014-08-27 20:49:31 +02:00
Nikita Popov
46b53e815c Add zend_string_equals and zend_string_equals_literal 2014-08-25 22:40:58 +02:00
Anatol Belski
af59e92b24 master renames phase 7 2014-08-25 21:51:49 +02:00
Anatol Belski
4d997f63d9 master renames phase 3 2014-08-25 20:22:49 +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
21a45d9aca Merge remote-tracking branch 'php/master' 2014-08-21 15:55:56 +02:00
Dmitry Stogov
b9a5db2b55 Fixed incorrect string length 2014-08-21 17:30:34 +04:00
Anatol Belski
cd18b5884b Merge remote-tracking branch 'php/master' 2014-08-20 23:27:26 +02:00
Dmitry Stogov
8cda420ff4 Fixed ext/pdo_*/tests/pdo_005.phpt tests failure 2014-08-20 23:28:32 +04:00
Anatol Belski
90d6f60bc1 mostly fixes to spl, but also some other 2014-08-17 13:31:39 +02:00
Anatol Belski
864172d9a4 further fixes to ext/standard and zend 2014-08-16 17:31:40 +02:00
Anatol Belski
1169de3e61 fix some cases with fast zpp 2014-08-16 14:00:02 +02:00
Anatol Belski
b7e7a89541 several fixes -
- param parsing Z_PARAM_STR vs Z_PARAM_STRING
- some functions for new params
- etc
2014-08-16 12:55:13 +02:00
Anatol Belski
cb25136f4e fix macros in the 5 basic extensions 2014-08-16 11:37:14 +02:00
Anatol Belski
8ee2a4a9b5 first shot on merging the core fro the int64 branch 2014-08-16 11:16:11 +02:00
krakjoe
dc70139d85 update zend_make_printable_zval to take TSRM context 2014-08-11 06:09:46 +01:00
Dmitry Stogov
42c4bcaed1 Fixed ZTS build 2014-07-14 14:25:04 +04:00
Dmitry Stogov
27f38798a1 Fast parameter parsing API
This API is experemental. It may be changed or removed.
It should be used only for really often used functions.
(Keep the original parsing code and wrap usage with #ifndef FAST_ZPP)
2014-07-11 16:32:20 +04:00
Dmitry Stogov
9d6e45a0ee Changed zend_make_printable_zval() to return "use_copy" instead of additional reference argument.
Improved branch prediction.
2014-07-09 16:05:55 +04:00
Dmitry Stogov
2ed8a17045 Refactored run_time_cache usage in object handlers 2014-07-07 20:54:31 +04:00
Dmitry Stogov
c4d99ec982 Removed EG(called_scope) and use corresponding value from EG(current_execute_data) 2014-07-03 02:34:43 +04:00
Dmitry Stogov
0a77dcd4b9 Removed EG(in_execution). If EG(currentent_execute_data) is not NULL we are executing something. 2014-07-03 01:02:25 +04:00
Dmitry Stogov
63c057e331 Removed EG(opline_ptr) and use corresponding value from EG(current_execute_data) 2014-07-02 23:29:53 +04:00
Dmitry Stogov
4b09dd69e6 Removed EG(active_op_array) and use corresponding value from EG(current_execute_data) 2014-07-02 22:03:21 +04:00
Dmitry Stogov
412ad4b254 Uinified call frame handling for user and internal functions.
Now EG(current_execute_data) always point to the call frame of the currently executed function.
2014-07-02 22:01:25 +04:00
Dmitry Stogov
04c87b9961 Merge branch 'phpng' into call-frame
* phpng:
  Reverted 387c491559 (it broke ext/standard/tests/file/bug44607.phpt)
  op2 is null terminated string
  IS_OBJECT and IS_RESOURCE is obviously exclusive
  No need to initialize it
  More optimizations
  Let's assume the name is already lowercased
  Save some strlen
  Use ZEND_HANDLE_NUMERIC
  Fixed stack usage
2014-06-27 01:28:58 +04:00
Dmitry Stogov
c69781393c Refactoring: merge call_frame and end_execute_data into single data structure. Keep only single copy of each argument on VM stack (previously ZE kept two copies of each arguments for user functions) 2014-06-26 23:51:14 +04:00
Xinchen Hui
f75c04ac8d No need to initialize it 2014-06-26 18:10:18 +08:00
Xinchen Hui
a7ce96d01f More optimizations 2014-06-26 18:09:04 +08:00
Xinchen Hui
64c5eb00b8 Let's assume the name is already lowercased 2014-06-26 17:56:55 +08:00
Dmitry Stogov
0f9d5baba2 Merge branch 'phpng' into call-frame
* phpng:
  Remove temp file committed by accident
  Don't use zend_string for other fields (only name here is enough)
  Fixed _zend_get_parameters_array
  Fixed use of uninitialized value
  Cleanup (refactoring is finish)
  We don't need extra 1 byte anymore

Conflicts:
	Zend/zend_API.c
2014-06-25 11:12:32 +04:00
Xinchen Hui
284141ca8f Fixed _zend_get_parameters_array
it should not decrease the refcount (spotted by
register_shutdown_function in ext/mysqli/tests/bug49442.phpt)
2014-06-25 00:39:37 +08:00
Dmitry Stogov
43477bc7a2 Refactoring: use call_frames instead of call_slots 2014-06-24 02:17:16 +04:00
Dmitry Stogov
e1b18e59f7 Use arena allocator for zend_class_entry, zend_op_array and zend_property_info that live till the end of request 2014-06-18 02:47:01 +04:00
Dmitry Stogov
909acec231 Avoid useles constants update 2014-06-16 23:32:58 +04:00
Dmitry Stogov
bd10db271c Use new zend_hash iteration API 2014-06-16 21:11:52 +04:00
Dmitry Stogov
c1965f58d4 Use reference counting instead of zval duplication 2014-06-05 16:04:11 +04:00
Dmitry Stogov
6e7338700e Avoid useless merge 2014-06-04 02:11:26 +04:00
Dmitry Stogov
e34a6e9211 Use new zend_hash API 2014-05-27 00:38:58 +04:00
Xinchen Hui
0175d994c0 Fixed apply_func_arg_t, and it's better not using cast (compiler friendly) 2014-05-25 19:56:51 +08:00
Xinchen Hui
c2082ece52 Fixed apply_func_t (they should be broken before) 2014-05-25 18:32:35 +08:00
Dmitry Stogov
3e131b41b2 Fixed memory leaks 2014-05-15 16:18:19 +04:00
Dmitry Stogov
c446e57588 ext/soap support for phpng (incomplete - just compilable) 2014-05-15 02:44:47 +04:00
Xinchen Hui
075a6ced0a Save one type checking if the type is already string 2014-05-13 14:05:28 +08:00
Dmitry Stogov
f089be8291 Fixed wrong buffer length (added place for terminating zero) 2014-05-12 11:17:12 +04:00
Dmitry Stogov
0c6a6f0fba Re-applyed Bob's patch with minor fixes 2014-05-07 15:03:56 +04:00
Dmitry Stogov
4ecc527976 Reverted Bob's patch (it breaks many tests when run with opcache and needs to be fixed first). 2014-05-07 03:26:13 +04:00
Nikita Popov
4d8c59f0da Fix parse_method_params 2014-05-06 21:56:01 +02:00
Nikita Popov
ccc2c8ae16 Fix error message in parse_method_params 2014-05-06 20:32:49 +02:00
Bob Weinand
f3c1881f1d Re-added fix for bug #66015 and adapted for phpng branch 2014-05-06 14:59:03 +02:00
Xinchen Hui
bea30846bb Refactor Zip (1 test failed) 2014-05-05 10:49:27 +08:00
Dmitry Stogov
17d027ed47 Split IS_BOOL into IS_FALSE and IS_TRUE 2014-04-30 18:32:42 +04:00
Dmitry Stogov
f9927a6c97 Merge mainstream 'master' branch into refactoring
During merge I had to revert:
	Nikita's patch for php_splice() (it probably needs to be applyed again)
	Bob Weinand's patches related to constant expression handling (we need to review them carefully)
	I also reverted all our attempts to support sapi/phpdbg (we didn't test it anyway)

Conflicts:
	Zend/zend.h
	Zend/zend_API.c
	Zend/zend_ast.c
	Zend/zend_compile.c
	Zend/zend_compile.h
	Zend/zend_constants.c
	Zend/zend_exceptions.c
	Zend/zend_execute.c
	Zend/zend_execute.h
	Zend/zend_execute_API.c
	Zend/zend_hash.c
	Zend/zend_highlight.c
	Zend/zend_language_parser.y
	Zend/zend_language_scanner.c
	Zend/zend_language_scanner_defs.h
	Zend/zend_variables.c
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
	ext/date/php_date.c
	ext/dom/documenttype.c
	ext/hash/hash.c
	ext/iconv/iconv.c
	ext/mbstring/tests/zend_multibyte-10.phpt
	ext/mbstring/tests/zend_multibyte-11.phpt
	ext/mbstring/tests/zend_multibyte-12.phpt
	ext/mysql/php_mysql.c
	ext/mysqli/mysqli.c
	ext/mysqlnd/mysqlnd_reverse_api.c
	ext/mysqlnd/php_mysqlnd.c
	ext/opcache/ZendAccelerator.c
	ext/opcache/zend_accelerator_util_funcs.c
	ext/opcache/zend_persist.c
	ext/opcache/zend_persist_calc.c
	ext/pcre/php_pcre.c
	ext/pdo/pdo_dbh.c
	ext/pdo/pdo_stmt.c
	ext/pdo_pgsql/pgsql_driver.c
	ext/pgsql/pgsql.c
	ext/reflection/php_reflection.c
	ext/session/session.c
	ext/spl/spl_array.c
	ext/spl/spl_observer.c
	ext/standard/array.c
	ext/standard/basic_functions.c
	ext/standard/html.c
	ext/standard/mail.c
	ext/standard/php_array.h
	ext/standard/proc_open.c
	ext/standard/streamsfuncs.c
	ext/standard/user_filters.c
	ext/standard/var_unserializer.c
	ext/standard/var_unserializer.re
	main/php_variables.c
	sapi/phpdbg/phpdbg.c
	sapi/phpdbg/phpdbg_bp.c
	sapi/phpdbg/phpdbg_frame.c
	sapi/phpdbg/phpdbg_help.c
	sapi/phpdbg/phpdbg_list.c
	sapi/phpdbg/phpdbg_print.c
	sapi/phpdbg/phpdbg_prompt.c
2014-04-26 00:32:51 +04:00
Dmitry Stogov
5864ce8a44 Fixed compilation warnings 2014-04-22 17:46:34 +04:00
Nikita Popov
0d43a277b8 Use zval_get_string in a few more places 2014-04-21 17:55:58 +02:00
Dmitry Stogov
acd77dec81 Use alloca() for temporary allocation 2014-04-21 15:18:19 +04:00
Dmitry Stogov
7652a977a8 Use ZEND_FETCH_FOREACH_* macros to iterate over HashTables instead of zend_hash_move_forward() and family. 2014-04-18 19:18:11 +04:00
Dmitry Stogov
e96073b1e4 Moved zend_literal->cache_slot right into zval.
It should be accessed using Z_CACHE_SLOT() macro.
zend_literal structure is removed.
API functions that accepted pointer to zend_literal now accept pointer to zval or cache_slot directly.
Calls of such functiond that now accept cache_slot need to be changed to pass -1 instead of NULL.
2014-04-17 15:40:45 +04:00
Dmitry Stogov
f9b26bc39a Cleanup (2-nd round) 2014-04-15 21:56:30 +04:00
Dmitry Stogov
050d7e38ad Cleanup (1-st round) 2014-04-15 15:40:40 +04:00
Xinchen Hui
a0690ff288 Fixed zend_object_get_t in simpleXML 2014-04-15 11:05:03 +08:00
Bob Weinand
ccf863c8ce Merge branch 'PHP-5.6' 2014-04-11 19:35:11 +02:00
Bob Weinand
35b895fdf0 Removed useless void* parameter and replaced with zend_bool on zval_update_constant* functions 2014-04-11 19:18:58 +02:00
Bob Weinand
9663193bbc Merge branch 'PHP-5.6' 2014-04-11 10:11:58 +02:00
Bob Weinand
f614fc6898 Fix bug #66015 by reverting "Removed operations on constant arrays." 2014-04-11 10:08:44 +02:00
Nikita Popov
20f2e5986e Fix ZTS build
This only makes it compile, it doesn't actually work, presumably
because interned strings are assumed in some places.
2014-04-09 23:41:16 +02:00
Dmitry Stogov
7402af380b Fixed destruction of objects and iterators on unclean request shutdown and GC (few cases are still unfixed).
Now we destroy objects it two steps. At first - object properties of all objects and only then the objects their selves.
2014-04-09 01:50:15 +04:00
Dmitry Stogov
3bc8810b1e Constant duplication optimization
Argument receiving optimization
2014-04-04 03:55:27 +04:00
Dmitry Stogov
58f0f2503c Various VM optimizations 2014-04-04 02:52:53 +04:00
Dmitry Stogov
76cc99fe60 Refactored ZVAL flags usage to simplify various checks (e.g. Z_REFCOUNTED(), candidate for GC, etc) 2014-04-03 15:26:23 +04:00
Dmitry Stogov
042c937f69 Use STR_COPY() instead of STR_DUP() where possible 2014-04-01 17:10:15 +04:00
Xinchen Hui
3647fc6fcc Refactor session (incompleted) 2014-03-28 18:46:25 +08:00
Dmitry Stogov
ea85451b65 Refactored data structures to keep zend_object* instead of a whole zval in some places 2014-03-28 02:11:22 +04:00
Dmitry Stogov
d83d34ba6d Cleanup 2014-03-27 14:55:52 +04:00
Dmitry Stogov
c6cba55454 Use ZVAL_DEREF() macro 2014-03-27 13:39:09 +04:00
Dmitry Stogov
54d559d893 Replaced (Z_TYPE(x) == IS_REFERENCE) with (Z_ISREF(x)) 2014-03-27 11:50:45 +04:00
Dmitry Stogov
887189ca31 Refactored IS_INDIRECT usage for CV and object properties to support HashTable resizing 2014-03-26 18:07:31 +04:00
Dmitry Stogov
acc719766d More accurate zval comparison 2014-03-19 22:43:36 +04:00
Dmitry Stogov
d708d3c596 Fixed passing arguments by reference from internal functions 2014-03-11 22:33:28 +04:00
Xinchen Hui
3da247e7a8 Forgot to remove unused codes 2014-03-07 17:41:02 +08:00
Xinchen Hui
4b3e6fc129 Refactor reference handling 2014-03-07 17:08:14 +08:00
Dmitry Stogov
81531116c1 Fixed support for references 2014-03-07 11:32:07 +04:00
Xinchen Hui
84f20dc212 Invalid free of args("+") 2014-03-05 22:19:02 +08:00
Xinchen Hui
581fa5822e Merge branch 'refactoring2' of github.com:zendtech/php into refactoring2
Conflicts:
	ext/standard/array.c
2014-03-05 18:02:35 +08:00
Dmitry Stogov
3733737328 Handle interned strings as non-refcounted scalars 2014-03-05 13:55:56 +04:00
Xinchen Hui
36f01f158c Fixed NULL pointer dereference 2014-03-05 17:29:29 +08:00
Dmitry Stogov
040dea8b82 Arguments taken by internal functions using zend_parse_parameters() with "+" and "*" specifications must not be deallocated anymore. 2014-03-05 11:10:52 +04:00
Dmitry Stogov
19670c2bbc Fixied calling object closures from internal functions 2014-03-05 01:54:21 +04:00
Xinchen Hui
ca146a6e14 Elements in array could be reference 2014-03-03 17:44:21 +08:00
Dmitry Stogov
843423716b Fixed user stream filters 2014-02-28 23:05:22 +04:00
Xinchen Hui
0680cdb4ac Fixed refcount handling 2014-02-28 22:47:24 +08:00
Dmitry Stogov
d0311ad28e Fixed method argument parsing 2014-02-28 15:47:12 +04:00
Dmitry Stogov
9d1294e33d Fixed memory leak 2014-02-28 13:29:18 +04:00
Dmitry Stogov
3ed445f749 Fixed IS_REFERENCE support 2014-02-28 12:54:38 +04:00
Dmitry Stogov
1c3ba95bb5 Refactored read_property() and read_dimension() handlers 2014-02-27 15:40:13 +04:00
Dmitry Stogov
639e4e1afa Changes zend_is_callable() to use zend_string* instead of char* 2014-02-25 16:03:34 +04:00
Xinchen Hui
71dac3d54f Don't add_ref in add_*_str functions 2014-02-25 15:47:24 +08:00
Dmitry Stogov
ff162410f0 Fixed traits support 2014-02-25 01:18:06 +04:00
Dmitry Stogov
844887ed56 Fixed IS_RESOURCE handling 2014-02-24 13:12:53 +04:00
Xinchen Hui
6f6573ef6a Fixed several memory leaks 2014-02-24 15:03:35 +08:00