Commit Graph

398 Commits

Author SHA1 Message Date
Máté Kocsis
8f4f1dea34
Convert zend_parse_parameters_none() to fast ZPP
I've done the conversion in those extensions where fast ZPP is predominant.
2020-01-03 13:23:37 +01:00
Máté Kocsis
349a286461
Use RETURN_THROWS() after zend_throw_error() 2020-01-01 16:42:30 +01:00
Nikita Popov
742aaaa150 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove redundant variable rv and optimize code
2019-10-28 11:42:57 +01:00
ZiMuyang
99c84cd92a Remove redundant variable rv and optimize code
Closes GH-4864.
2019-10-28 11:42:45 +01:00
Christoph M. Becker
273731fb76 Add Zend class/interface arginfo stubs
We also change `Generator::throw()` to expect a `Throwable` in the
first place, and we now throw a TypeError instead of returning `false`
from `Exception::getTraceAsString()`.
2019-10-15 16:21:00 +02:00
Nikita Popov
db233501ff Use clean shutdown on uncaught exception 2019-10-11 12:41:15 +02:00
Peter Cowburn
bc61997571 add ValueError
ValueError is intended to be thrown when a function or method receives
an argument that has the right type (incorrect type should throw a
TypeError) but an inappropriate value.
2019-09-09 21:06:00 +01:00
Joe Watkins
d41ab64456
Merge branch 'PHP-7.4'
* PHP-7.4:
  simple ignore arguments in exceptions implementation
2019-07-02 13:19:25 +02:00
Joe Watkins
0819e6dc9b
simple ignore arguments in exceptions implementation 2019-07-02 13:18:39 +02:00
Nikita Popov
d5ff57477b Merge branch 'PHP-7.4' 2019-02-25 13:03:26 +01:00
Nikita Popov
a8daef51e1 Merge branch 'PHP-7.3' into PHP-7.4 2019-02-25 13:02:58 +01:00
Nikita Popov
461e140afc Merge branch 'PHP-7.2' into PHP-7.3 2019-02-25 13:01:18 +01:00
Nikita Popov
af37d58cf7 Fix assertion in Exception::getMessage() if $message is a ref
And same for other properties. Encountered in Symfony.
2019-02-25 13:00:16 +01: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
Nikita Popov
d0fd2be642 Revert removal of private __clone() methods
I thought these were redundant, because we already NULL out the
clone_obj object handler. However, it turns out that reflection is
using private __clone() to determine clonability (isCloneable) for
the case where we only have a class, rather than an object.

As such, removing these methods would be a BC break.

This reverts commit e7131a4e9f.
This reverts commit 55bd88ce0d.
2019-01-14 09:19:30 +01:00
Nikita Popov
e7131a4e9f Remove redundant Exception::__clone() method
Exceptions already prohibit cloning by setting clone_obj to NULL
(which is integrated with reflection). No need to additionally
define a dummy __clone() method.
2018-11-26 13:57:17 +01:00
Dmitry Stogov
0f7f1498be Use ZEND_THIS macro to hide implementation details in extensions code. 2018-11-15 19:54:19 +03:00
Dmitry Stogov
c6ad0b92b7 Replace getThis() by EX(This), when additional check is not necessary. 2018-11-14 02:44:25 +03: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
Gabriel Caruso
84b195d9fc Fix some misspellings 2018-08-12 16:15:45 +02: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
091d77f28a Avoid magic method hash lookups 2018-07-02 17:03:50 +03:00
Nikita Popov
4abf423d75 Merge branch 'PHP-7.2' 2018-06-24 22:29:19 +02:00
Nikita Popov
14b22704c7 Merge branch 'PHP-7.1' into PHP-7.2 2018-06-24 22:28:57 +02:00
Nikita Popov
701460ba84 Fixed bug #76502 2018-06-24 22:26:45 +02:00
Nikita Popov
d04917c7b3 Fixed bug #75218
I've introduced a new CompileError type, from which ParseError
inherits. These errors are not parse errors in the narrow sense
of the term, even though they happen to be generated during
parsing in our implementation. Additionally reusing the ParseError
class for this purpose would change existing error messages (if
the exception is not caught) from a "Fatal error:" to a "Parse
error:" prefix, and also the error kind from E_COMPILE_ERROR to
E_PARSE.
2018-06-16 12:41:03 +02:00
Dmitry Stogov
f2b4ec4bdc Export standard object handlers, to avoid indirect access 2018-05-31 11:57:22 +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
d03e95442a Use reference counting instead of duplication 2018-03-06 21:20:19 +03:00
Christoph M. Becker
ef255c9f0f Revert "[ci skip] Add missing return types to protos"
This reverts commit a2c7c46d5e.

Since apparently there have been some mistakes in this commit, and it's
not clear yet how to solve them, we're reverting for now.
2018-02-27 17:40:03 +01:00
Gabriel Caruso
a2c7c46d5e [ci skip] Add missing return types to protos 2018-02-24 11:45:17 +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
9e709e2fa0 Move constants into read-only data segment 2017-12-14 18:43:44 +03:00
Dmitry Stogov
cc12acefcd Use cheaper functions 2017-12-04 13:21:35 +03:00
Xinchen Hui
3fa0cee640 Revert "Use zend_get_executed_filename_ex"
This reverts commit 2a37625c20.
2017-11-02 12:12:40 +08:00
Xinchen Hui
2a37625c20 Use zend_get_executed_filename_ex 2017-11-01 15:40:54 +08:00
Dmitry Stogov
49ea143bbd Encapsulate reference-counting primitives.
Prohibit direct update of GC_REFCOUNT(), GC_SET_REFCOUNT(), GC_ADDREF() and GC_DELREF() shoukf be instead.
Added mactros to validate reference-counting (disabled for now).
These macros are going to be used to eliminate race-condintions during reference-counting on data shared between threads.
2017-10-27 01:28:58 +03:00
Dmitry Stogov
cb9d81ef4f Refactored recursion pretection 2017-10-06 01:34:50 +03:00
Anatol Belski
bc5811f361 further sync for vim mode lines 2017-07-04 18:12:45 +02: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
Anatol Belski
7e440f2209 rework fd521a22 to simplify for master, see github #2356 2017-02-07 12:40:10 +01:00
Anatol Belski
623478a2d6 Merge branch 'PHP-7.1'
* PHP-7.1:
  switch to smart str conversion routine to hide exact NAN type
2017-02-07 12:04:25 +01:00
Anatol Belski
265c53dbbf Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  switch to smart str conversion routine to hide exact NAN type
2017-02-07 12:03:21 +01:00
Anatol Belski
fd521a22f7 switch to smart str conversion routine to hide exact NAN type
see https://github.com/php/php-src/pull/2356#issuecomment-277564135
2017-02-07 12:01:14 +01: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
Nikita Popov
c7742e280a Export zend_s(tr)pprintf
It's annoying that in Zend you have to use zend_strpprintf instead
of strpprintf, while in PHP you have to use strpprintf instead of
zend_strpprintf.

Make zend_s(tr)pprintf always available and keep s(tr)pprintf as
macro aliases.
2017-01-01 21:28:20 +01:00
Dmitry Stogov
000d4a1a1b Merge branch 'PHP-7.1'
* PHP-7.1:
  Check if PHP is in execution state.
2016-12-07 15:13:00 +03:00
Dmitry Stogov
ee15891c35 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Check if PHP is in execution state.
2016-12-07 15:12:48 +03:00
Dmitry Stogov
3c8c347fa7 Check if PHP is in execution state. 2016-12-07 15:12:18 +03: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
Xinchen Hui
788368ff1c Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #73350 (Exception::__toString() cause circular references)
2016-10-22 14:50:42 +08:00
Xinchen Hui
eca84946a4 Fixed bug #73350 (Exception::__toString() cause circular references) 2016-10-22 14:50:21 +08:00
Anatol Belski
ee42529750 Revert "export symbol missing by phpdbg"
This reverts commit 611ab7fe5b.

Overseen strpprintf is there

(cherry picked from commit 3104882cf8)
2016-10-14 02:01:08 +02:00
Anatol Belski
b4ddf4e575 fix another mistake
(cherry picked from commit bec0121733)
2016-10-14 01:56:31 +02:00
Anatol Belski
4e338817d1 export symbol missing by phpdbg
(cherry picked from commit 611ab7fe5b)
2016-10-14 01:51:21 +02:00
Anatol Belski
2c38f70a94 fix wrong merge
(cherry picked from commit 821a230f29)
2016-10-14 01:49:39 +02:00
Anatol Belski
a8a11b669d Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug #73190: memcpy negative parameter _bc_new_num_ex

(cherry picked from commit af1bf873fe)
2016-10-14 01:46:18 +02:00
Anatol Belski
3104882cf8 Revert "export symbol missing by phpdbg"
This reverts commit 611ab7fe5b.

Overseen strpprintf is there
2016-10-13 09:50:32 +02:00
Anatol Belski
611ab7fe5b export symbol missing by phpdbg 2016-10-12 22:18:41 +02:00
Stanislav Malyshev
74b5662536 Fix bug #73190: memcpy negative parameter _bc_new_num_ex
(cherry picked from commit 40e7baab3c)
2016-10-12 19:48:25 +02:00
Davey Shafik
12ee17d5e0 Implement \ArgumentCountError exception 2016-08-30 19:35:56 -07: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
587668be56 Fix leak of class name when printing exception backtrace 2016-07-14 18:38:58 +02:00
Nikita Popov
5063b5aea1 Fix leak if throw_exception_object() fails 2016-07-14 18:37:21 +02:00
Xinchen Hui
0478e431cf Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed bug #72581 (previous property undefined in Exception after deserialization)

Conflicts:
	Zend/zend_exceptions.c
2016-07-12 11:52:21 +08:00
Xinchen Hui
42902919bc Fixed bug #72581 (previous property undefined in Exception after deserialization) 2016-07-12 11:51:20 +08:00
Dmitry Stogov
f8faffe37e Merge branch 'PHP-7.0'
* PHP-7.0:
  Allow "proxy" ovjects to substitute their class names through get_class_name() handler (similar to var_dump() and others).
2016-06-22 17:28:59 +03:00
Dmitry Stogov
3c84e5e1ce Allow "proxy" ovjects to substitute their class names through get_class_name() handler (similar to var_dump() and others). 2016-06-22 17:23:04 +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
7b94b958cc Intern some known (and offten used) strings. 2016-05-12 13:47:22 +03:00
Dmitry Stogov
2578d08033 Fixed compilation warnings 2016-04-29 14:44:56 +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
Dmitry Stogov
7abfaac901 Merge zend_execute_data->called_scope into zend_execute_data->This.
"called_scope" made sense only for static method calls, for dynamic calls it was always equal to the class of $this.
Now EG(This) may store IS_OBJECT + $this or IS_UNUSED + "called_scope" (of course, "called_scope" may be NULL).
Some code might need to be adopted to support this change.
Checks (Z_OBJ(EX(This))) might need to be converted into (Z_TYPE(EX(This)) == IS_OBJECT).
2016-04-01 16:17:49 +03:00
Dmitry Stogov
c67c166f93 Removed zend_fcall_info.symbol_table 2016-03-02 17:50:55 +03: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
7bfc4fca60 cleanup 2015-11-21 07:14:12 -08:00
Xinchen Hui
31d93fcf4b Port the fix of 5.6 to 7.0 2015-11-21 05:41:53 -08:00
Xinchen Hui
a2e4e64682 Merge branch 'PHP-5.6' into PHP-7.0
Conflicts:
	Zend/zend_exceptions.c
2015-11-20 16:38:00 +08:00
Xinchen Hui
a1c887964e Fixed bug #70944 (try{ } finally{} can create infinite chains of exceptions) 2015-11-20 16:24:53 +08:00
Dmitry Stogov
71af54e5f6 Mark error and exception functions as "cold" (Matt's idea) 2015-08-19 14:40:56 +03:00
Bob Weinand
a1c9c318ea Woops, accidentally made TS build fail... 2015-08-18 14:04:48 +02:00
Bob Weinand
501407aa49 Revert fix for nicer truncation on log_errors_max_len 2015-08-18 14:01:18 +02:00
Bob Weinand
c83cbdf6ce Better fix for exception traces truncation with anon classes 2015-08-18 12:48:06 +02:00
Dmitry Stogov
d9a9b8572b Revert "Do not truncate exception traces upon anon class name"
This reverts commit b0c77fb80c.
2015-08-18 12:03:04 +03:00
Bob Weinand
b0c77fb80c Do not truncate exception traces upon anon class name 2015-08-18 03:27:56 +02:00
Nikita Popov
6366679906 Executed file can be NULL
So revert this part to what it was originally.
2015-08-14 17:16:45 +02:00
Nikita Popov
2af19fb50a Fix leak in previous commit
Turns out zend_update_property_str already does the copy implicitly.
2015-08-14 17:04:33 +02:00
Nikita Popov
13567d5dee Don't copy zend_strings during exception creation
Minor optimization...
2015-08-14 16:16:27 +02:00
Stanislav Malyshev
f2f8ea9ac5 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  __wakeup doesn't have to be final
2015-08-04 16:13:43 -07:00
Stanislav Malyshev
f1acac154a __wakeup doesn't have to be final 2015-08-04 16:13:26 -07:00
Stanislav Malyshev
69ed3969dd Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Fix bug #70019 - limit extracted files to given directory
  Do not do convert_to_* on unserialize, it messes up references
  Fix #69793 - limit what we accept when unserializing exception
  Fixed bug #70169 (Use After Free Vulnerability in unserialize() with SplDoublyLinkedList)
  Fixed bug #70166 - Use After Free Vulnerability in unserialize() with SPLArrayObject
  ignore signatures for packages too
  Fix bug #70168 - Use After Free Vulnerability in unserialize() with SplObjectStorage
  Fixed bug #69892
  Fix bug #70014 - use RAND_bytes instead of deprecated RAND_pseudo_bytes
  Improved fix for Bug #69441
  Fix bug #70068 (Dangling pointer in the unserialization of ArrayObject items)
  Fix bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref)
  Fix bug #70081: check types for SOAP variables

Conflicts:
	.gitignore
	ext/date/php_date.c
	ext/spl/spl_array.c
	ext/spl/spl_observer.c
2015-08-04 14:10:57 -07:00
Stanislav Malyshev
4d2278143a Fix #69793 - limit what we accept when unserializing exception 2015-08-01 22:02:26 -07:00