Commit graph

741 commits

Author SHA1 Message Date
Dmitry Stogov
457392fa64 Cheaper checks for exceptions thrown from __toString() 2019-06-06 01:47:22 +03:00
Nikita Popov
7686b0b889 Merge branch 'PHP-7.4' 2019-06-05 14:53:50 +02:00
Nikita Popov
a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Nikita Popov
45a0656e95 Remove get() object handler
Now that set() is gone, there is little point in keeping get(), as
it is essentially just a different way of writing cast_object()
now.

Closes GH-4202.
2019-05-29 17:15:19 +02:00
Nikita Popov
31a516cf96 Remove set() object handler 2019-05-29 10:00:06 +02:00
Nikita Popov
e06ec226bc Merge branch 'PHP-7.4' 2019-05-24 09:33:58 +02:00
Nikita Popov
49a3b03e9f Implement basic variance support
This is a minimal variance implementation: It does not support any
cyclic type dependencies. Additionally the preloading requirements
are much more restrictive than necessary. Hopefully we can relax
these in the future.
2019-05-24 09:30:37 +02:00
Dmitry Stogov
0deb6419e8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Make is_identical() functions return zend_bool (instead of int)
2019-04-04 18:18:52 +03:00
Dmitry Stogov
9038d5c6ee Make is_identical() functions return zend_bool (instead of int) 2019-04-04 18:18:12 +03:00
Dmitry Stogov
91ef4124e5 Refactor zend_object_handlers API to pass zend_object* and zend_string* insted of zval(s). 2019-02-04 13:20:25 +03:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Zeev Suraski
a81202ac49 Adios, yearly copyright ranges 2019-01-30 11:48:28 +01:00
Zeev Suraski
9afce019e0 Future-proof email addresses 2018-11-01 18:35:32 +02:00
Zeev Suraski
54dc07f3dc Update email addresses. We're still @Zend, but future proofing it... 2018-11-01 17:20:07 +02:00
Peter Kokot
902d39a3a7 Trim trailing whitespace in source code files 2018-10-13 14:14:50 +02:00
Nikita Popov
7ec8087f80 Introduce get_properties_for() handler
This handler allows getting the object properties for a particular
purpose, such as array casting, serialization, etc.
2018-10-10 10:39:10 +02:00
Dmitry Stogov
c1706980c0 Remove dead code (only IS_ARRAY may relive zendi_convert_scalar_to_number()), and micro-optimization. 2018-09-27 13:11:48 +03:00
Dmitry Stogov
689c6fb188 Replace ZEND_ACC_ANON_BOUND, ZEND_ACC_UNRESOLVED_PARENT and ZEND_ACC_UNRESOLVED_INTERFACES with single ZEND_ACC_LINKED. 2018-09-18 11:41:40 +03:00
Nikita Popov
dfa166e7ed Remove unused ZEND_FILE_LINE in i_zval_ptr_dtor 2018-09-16 17:16:26 +02:00
Remi Collet
2e4489fdf4 Merge branch 'PHP-7.3'
* PHP-7.3:
  fix double cast to int on 32-bit
2018-08-30 09:05:01 +02:00
Remi Collet
cf6c32545e Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  fix double cast to int on 32-bit
2018-08-30 09:04:43 +02:00
Remi Collet
6e703c957e Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  fix double cast to int on 32-bit
2018-08-30 09:04:13 +02:00
Remi Collet
c1729272b1 fix double cast to int on 32-bit 2018-08-30 09:03:50 +02:00
Dmitry Stogov
d140df58e6 Keep information about unresolved interfaces in zend_class_entry->interface_names.
Move interface implementation code into ZEND_DECLARE_*CLASS opcodes.
Remove ZEND_ADD_INTERFACE and ZEND_VERIFY_ABSTRACT_CLASS opcodes.
2018-08-23 17:16:28 +03:00
Dmitry Stogov
aed3de1bc5 Split add/sub_function(s) into fast and slow parts 2018-07-25 12:48:16 +03:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Dmitry Stogov
ebd1f5af3e API cleanup.
Removed useless filename and lineno arguments, used in DEBUG build.
The patch doesn't break source compatibility of public API (only binary compatibility).
2018-07-23 15:24:07 +03:00
Dmitry Stogov
62b3464871 Removed deprecated condition 2018-07-10 11:04:10 +03:00
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
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Xinchen Hui
ccd4716ec7 year++ 2018-01-02 12:53:31 +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