Commit Graph

349 Commits

Author SHA1 Message Date
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
Stanislav Malyshev
e488690d95 Fix bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref) 2015-07-26 17:10:24 -07:00
Stanislav Malyshev
feeb2fba93 fix merge 2015-08-04 23:51:55 -07:00
Stanislav Malyshev
3e416bba90 fix merge 2015-08-04 16:46:53 -07:00
Stanislav Malyshev
54daa5317f Merge branch 'PHP-5.6'
* PHP-5.6:
  __wakeup doesn't have to be final
2015-08-04 16:14:32 -07:00
Stanislav Malyshev
97047e7665 Merge branch 'PHP-5.6'
* PHP-5.6:
  update NEWS
  fix test
  update NEWS
  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:
	Zend/zend_exceptions.c
	ext/date/php_date.c
	ext/openssl/openssl.c
	ext/phar/phar_internal.h
	ext/soap/php_http.c
	ext/spl/spl_array.c
	ext/spl/spl_dllist.c
	ext/spl/spl_observer.c
	ext/standard/tests/serialize/bug69152.phpt
	sapi/cli/tests/005.phpt
2015-08-04 16:14:24 -07:00
Aaron Piotrowski
a1a83bf5f0 Switch code on thrown TypeError and ParseError to 0, update related tests 2015-07-07 16:54:39 -05: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
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
Aaron Piotrowski
ed1b64877d Switch position of ce in exception ce variable names 2015-07-03 09:45:03 -05:00
Aaron Piotrowski
f9e9d3a437 Cleanup exception ce API
Removed recently added functions to get Error ce's and marked the old functions
fetching default_exception_ce and error_exception_ce as deprecated.
2015-07-03 09:44:30 -05:00
Bob Weinand
94722e12cf Introduce ArithmeticError 2015-07-02 20:47:44 +02:00
Bob Weinand
007d7ac7ca Use DivisionByZeroError instead of exception for %/intdiv() 2015-07-02 02:20:58 +02: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
Bob Weinand
5e16722309 Show exception source in phpdbg 2015-06-29 01:41:04 +02:00
Aaron Piotrowski
8813b389ea Fix bug when constructing an Error with invalid params 2015-06-17 19:48:17 -05:00
Anatol Belski
f97dbb058f cleanup unused var 2015-06-18 00:53:23 +02:00
Anatol Belski
577c1f3e95 preserve the orig class name when extending the ErrorException 2015-06-18 00:30:16 +02:00
Anatol Belski
9076eb26c7 dont use function to fetch default exception ce 2015-06-18 00:21:38 +02:00
Anatol Belski
57940664a8 fix crash when invalid exception arguments passed 2015-06-18 00:14:57 +02:00
Christoph M. Becker
653c869348 Fix #61362: Exception::getTraceAsString and ::__toString scramble Unicode
The logic in smart_str_append_escaped() relies on unsigned values of c, so we
have to declare it as such.
2015-06-17 22:31:07 +02:00
Aaron Piotrowski
c5eb924e9e Rename interface macros
Renamed REGISTER_INTERFACE (formerly
REGISTER_ITERATOR_INTERFACE) to
REGISTER_MAGIC_INTERFACE and renamed
REGISTER_ITERATOR_IMPLEMENT to
REGISTER_MAGIC_IMPLEMENT. Both have now been
moved to zend_interfaces.h.
2015-06-17 13:54:09 -05:00
Aaron Piotrowski
47d838a7ca Move definition of Throwable to zend_exceptions.h/c
Also moved REGISTER_ITERATOR_INTERFACE macro to
zend_interfaces.h and renamed it to REGISTER_INTERFACE.
2015-06-15 18:07:27 -05:00
Aaron Piotrowski
0265cf5aeb Check for zend_ce_throwable instead 2015-06-15 17:35:24 -05:00
Aaron Piotrowski
8e7e4fb608 Fix previous exception type check 2015-06-15 01:36:49 -05:00
Aaron Piotrowski
4d590ac35a Update exception error messages 2015-06-14 22:43:11 -05:00
Aaron Piotrowski
110e0a5a2c Merge branch 'master' into throwable-interface
# Conflicts:
#	Zend/zend_language_scanner.c
#	Zend/zend_language_scanner.l
#	ext/simplexml/tests/SimpleXMLElement_xpath.phpt
2015-06-14 18:53:11 -05:00
Dmitry Stogov
e57aceed42 Fixed access to wrong opline (it may be the last ZEND_THROW in op_array->opcodes) 2015-05-20 22:49:37 +03:00
Aaron Piotrowski
99640cd013 Merge branch 'master' into throwable-interface 2015-05-18 13:34:46 -05:00
Xinchen Hui
a5f408c91b 1. Fixed bug #69640 Unhandled EngineExceptions thrown from userland do not produce any output
2. Fixed Segfault introduced by latest changes
2015-05-18 11:13:55 +08:00
Aaron Piotrowski
7e18df82a3 Merge exception formatting changes. 2015-05-17 17:31:06 -05:00
Nikita Popov
440481fb3e Display TypeExceptions like normal exceptions
We currently don't show the argument at which the error actually
occured in the trace - should probably either add it or don't
display args on incomplete frames altogether, otherwise this'll
probably be confusing.
2015-05-17 19:54:12 +02:00
Nikita Popov
3ae995f03c Tweak uncaught exception message display
This implements a reduced variant of #1226 with just the following
change:

-Fatal error: Uncaught exception 'EngineException' with message 'Call to private method foo::bar() from context ''' in %s:%d
+Fatal error: Uncaught EngineException: Call to private method foo::bar() from context '' in %s:%d

The '' wrapper around messages is very weird if the exception
message itself contains ''. Futhermore having the message wrapped
in '' doesn't work for the "and defined" suffix of
TypeExceptions.
2015-05-17 18:47:06 +02:00
Nikita Popov
c9f27ee422 Display EngineExceptions like ordinary exceptions
TypeException stays as-is for now because it uses messages that are
incompatible with the way exception messages are displayed.

closure_038.phpt and a few others now show that we're generating
too many exceptions for compound operations on undefined properties
-- this needs to be fixed in a followup.
2015-05-15 23:40:32 +02:00
Nikita Popov
230b435ed4 Fix exception leak in interactive console
Shows up there because it throws at E_WARNING severity level and
as such leak detection is not suppressed.
2015-05-15 22:43:13 +02:00
hakre
6551f996b9 Minor Typo in Comment 2015-04-27 20:06:55 +02:00
Xinchen Hui
0d562a8f44 Fixed res leak 2015-04-14 21:15:50 -07:00
Xinchen Hui
82ec0d5fc5 Fixed res leak 2015-04-15 10:38:55 +08:00
Xinchen Hui
e68b851217 Merge branch 'PHP-5.6'
Conflicts:
	Zend/zend_exceptions.c
2015-04-14 19:33:46 +08:00
Xinchen Hui
4b27569dc3 codes standard 2015-04-14 19:32:01 +08:00
Stanislav Malyshev
b3709bfc52 Merge branch 'PHP-5.6'
* PHP-5.6: (27 commits)
  fix non-standard C
  update NEWS
  5.4.41 next
  fix CVE num
  update NEWS
  Fix bug #69441 (Buffer Overflow when parsing tar/zip/phar in phar_set_inode)
  fix test
  fix type in fix for #69085
  fix memory leak & add test
  Fix tests
  fix CVE num
  Fix bug #69337 (php_stream_url_wrap_http_ex() type-confusion vulnerability)
  Fix test
  Additional fix for bug #69324
  More fixes for bug #69152
  Fixed bug #69353 (Missing null byte checks for paths in various PHP extensions)
  Fixed bug #69324 (Buffer Over-read in unserialize when parsing Phar)
  Fixed bug #69316 (Use-after-free in php_curl related to CURLOPT_FILE/_INFILE/_WRITEHEADER)
  Fix bug #68486 and bug #69218 (segfault in apache2handler with apache 2.4)
  Fix bug #68819 (Fileinfo on specific file causes spurious OOM and/or segfault)
  ...

Conflicts:
	Zend/zend_exceptions.c
	ext/curl/interface.c
	ext/dom/document.c
	ext/fileinfo/libmagic/softmagic.c
	ext/gd/gd.c
	ext/hash/hash.c
	ext/pgsql/pgsql.c
	ext/phar/phar.c
	ext/phar/phar_internal.h
	ext/standard/http_fopen_wrapper.c
	ext/standard/link.c
	ext/standard/streamsfuncs.c
	ext/xmlwriter/php_xmlwriter.c
	ext/zlib/zlib.c
2015-04-14 01:28:06 -07:00
Stanislav Malyshev
0cb9d75cb6 Merge branch 'PHP-5.4.40' into PHP-5.5.24
* PHP-5.4.40:
  Additional fix for bug #69324
  More fixes for bug #69152
  Fixed bug #69353 (Missing null byte checks for paths in various PHP extensions)
  Fixed bug #69324 (Buffer Over-read in unserialize when parsing Phar)
  Fixed bug #69316 (Use-after-free in php_curl related to CURLOPT_FILE/_INFILE/_WRITEHEADER)
  Fix bug #68486 and bug #69218 (segfault in apache2handler with apache 2.4)
  Fix bug #68819 (Fileinfo on specific file causes spurious OOM and/or segfault)
  Fixed bug #68901 (use after free)
  Fixed bug #68740 (NULL Pointer Dereference)
  Fix bug #66550 (SQLite prepared statement use-after-free)
  Better fix for #68601 for perf 81e9a993f2
  Fix bug #68601 buffer read overflow in gd_gif_in.c
  Revert "Merge branch 'PHP-5.4' of https://git.php.net/repository/php-src into PHP-5.4"
  Fixed bug #69293
  Add ZEND_ARG_CALLABLE_INFO to allow internal function to type hint against callable.
2015-04-11 16:56:12 -07:00
Stanislav Malyshev
a894a8155f More fixes for bug #69152 2015-04-11 16:53:22 -07:00
Dmitry Stogov
ad863c1740 Convert fatal errors into EngineException 2015-04-02 14:19:52 +03:00
Dmitry Stogov
acfc31c0f8 Use zend_error_noreturn() for fatal errors 2015-04-01 13:32:23 +03:00
Dmitry Stogov
7cf05ce8da Fixed error messages 2015-03-20 17:26:12 +03:00
Anthony Ferrara
724f7118f1 Refactor error messages to only append defined in the event of rendering as a fatal error. Fix relative typehints to not work 2015-03-18 16:38:51 -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