Commit Graph

239 Commits

Author SHA1 Message Date
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
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
Dmitry Stogov
1c94ff0595 Implement engine exceptions
RFC: https://wiki.php.net/rfc/engine_exceptions_for_php7

Pending changes regarding naming of BaseException and whether it
should be an interface.
2015-03-09 14:01:32 +01: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
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Xinchen Hui
73c1be2653 Bump year 2015-01-15 23:26:03 +08:00
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Dmitry Stogov
3893c1fc3d Fixed compilation warnings 2014-12-12 21:57:34 +03:00
Dmitry Stogov
1480d26fb9 fixed compilation error 2014-10-20 12:51:02 +04: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
2a0c4edfda Drop convert_to usage in zend_exceptions
To make everything work correctly with refs.

I'm unsure whether the GET_PROPERTY_SILENT distinction is really
necessary, because the choice seemed pretty random, but kept it
around.
2014-10-06 20:14:30 +02:00