Commit Graph

1701 Commits

Author SHA1 Message Date
Nikita Popov
4e03ba4a6e Add GC support for ArrayObject
gc_024 test changes because the array that ArrayObject holds is
now counted separately from the ArrayObject.
2015-05-20 18:28:09 +02: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
Dmitry Stogov
d880ead8a7 Improve fast_is_[not_]identical() functions to teturn value instead of takeing additional arguments.
Pair INSTANCEOF with the following JMPZ/JMPNZ.
2015-04-29 16:43:23 +03:00
Nikita Popov
e0a39eecf1 Respect USE_OTHER in spl_array_is_object
Also a bit of code cleanup in get_hash_table.
2015-04-25 16:13:39 +02:00
Nikita Popov
66ce7cc083 Don't store $this reference for IS_SELF AO
The var_dump output changes in array_022.phpt were wrong previously,
the "storage" that was referenced there was not the actually used
storage.
2015-04-25 16:13:37 +02:00
Nikita Popov
3140d0c0c8 Drop ArrayObject IS_REF flag 2015-04-25 16:13:32 +02:00
Nikita Popov
c77d97f356 Implement GC for spl dll
As far as I can discern this should be safe, because the rc on the
linked list elements is only > 1 if an iterator points to it and
the iterator will also hold a reference to the list object.

The implementation for mangagement of the GC array is the same as
with the spl object storage.
2015-04-16 15:46:28 +02:00
Nikita Popov
6c98024f87 Drop unused is_self member 2015-04-16 15:33:47 +02:00
Nikita Popov
86152b18a3 Add GC support to SPL heap and PQ
ctor/dtor are now no longer called for insert/delete_top operations,
only for cloning and freeing of the object. Otherwise elements will
have a minimum rc of 2 and GC won't be able to free them.
2015-04-15 22:00:12 +02:00
Nikita Popov
dc764bf644 Use object apply count in var_dump / print_r
Instead of using the array apply count on the debug_info array, use
the object apply count for recursion detection when dumping. This
handles recursion in a more generic way and does not require each
debug_info handler to deal with this.

This allows returning a temporary debug_info array, instead of
having to store it in the object (thus delaying destruction of the
values).

Switch SPL debug_info handlers to use a temporary array.
2015-04-15 22:00:12 +02:00
Nikita Popov
eed18f0ee8 Return null on zpp failure in Array::exchangeArray()
Method was still returning a value despite zpp failing previously...
2015-04-15 20:43:41 +02:00
Nikita Popov
e10be0d0fd Remove unnecessary retval members in SPL
This is what the rv params are for. Avoid holding onto values
longer than necessary.
2015-04-15 20:39:08 +02:00
Nikita Popov
b4b872f4c9 Fix leak in RecursiveRegexIterator::getChildren() 2015-04-15 20:03:15 +02:00
Nikita Popov
7605e02e3b Fix leaks in recursive iterator construction 2015-04-15 19:51:02 +02:00
Dmitry Stogov
2b6a568df1 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. 2015-04-09 15:40:17 +03:00
Dmitry Stogov
4d9a1883aa Fixed bug #68887 (resources are not freed correctly) 2015-04-08 13:29:42 +03:00
Xinchen Hui
f23f7dfed0 Use new macros 2015-04-08 14:30:47 +08: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
Dmitry Stogov
dcaa79546b Don't relay on reference-counter when parameter expected to be a reference, but value given. 2015-04-03 16:35:06 +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
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
4796e0242b Merge branch 'InternalClassClean'
* InternalClassClean:
  Fixed test
  Patch improvement:
  Fixed indentation. Fixed comment style. Fixed commented out code.
  Reverted change to function name and added note of why it is different from the class it is actually changing.
  Made UConverter throw an exception if the constructor fails.
  Fixed PDO constructor to not return null.
  Fixed fileinfo behaviour.
  Made Phar throw exception on bad constructor.
  Converted intl extension to use IntlException in constructors.
  Fixed SplFixedArray and tests.
  Fixed ReflectionExtension and ReflectionProperty.
  Fixed ReflectionFunction, ReflectionMethod and ReflectionParameter.
  Fixed PDORow behaviour and message.
2015-04-01 12:11:13 +03:00
Xinchen Hui
fd1a7c5f2d Add XFAIL test 2015-03-31 11:53:52 +08:00
Dmitry Stogov
9155a267ad Merge branch 'InternalClassClean' of github.com:Danack/php-src into InternalClassClean
* 'InternalClassClean' of github.com:Danack/php-src:
  Fixed indentation. Fixed comment style. Fixed commented out code.
  Reverted change to function name and added note of why it is different from the class it is actually changing.
  Made UConverter throw an exception if the constructor fails.
  Fixed PDO constructor to not return null.
  Fixed fileinfo behaviour.
  Made Phar throw exception on bad constructor.
  Converted intl extension to use IntlException in constructors.
  Fixed SplFixedArray and tests.
  Fixed ReflectionExtension and ReflectionProperty.
  Fixed ReflectionFunction, ReflectionMethod and ReflectionParameter.
  Fixed PDORow behaviour and message.
2015-03-30 12:14:43 +03:00
Anatol Belski
663074b6b1 cleanup mod version macros and mod defs, round x 2015-03-23 21:30:22 +01:00
Dmitry Stogov
d146d15003 Optimize zend_string_realloc() add more specialized versions zend_string_extend() and zend_string_truncate() 2015-03-20 02:02:42 +03:00
Danack
910a324306 Fixed indentation. Fixed comment style. Fixed commented out code. 2015-03-16 23:14:56 +00:00
Xinchen Hui
9420a2a5b0 Merge branch 'PHP-5.6' 2015-03-14 11:32:09 +08:00
Xinchen Hui
96bb3b838c Merge branch 'PHP-5.5' into PHP-5.6 2015-03-14 11:31:53 +08:00
Xinchen Hui
5b87d52041 Fixed typo 2015-03-14 11:31:12 +08:00
Xinchen Hui
326ac546ab Remove TSRMLS 2015-03-14 01:04:00 +08:00
Xinchen Hui
e827d1a424 Merge branch 'PHP-5.6'
Conflicts:
	ext/spl/spl_observer.c
2015-03-14 01:01:02 +08:00
Xinchen Hui
396bc00caa Merge branch 'PHP-5.5' into PHP-5.6 2015-03-14 00:53:32 +08:00
Xinchen Hui
ed59370f0a Little improvement, update NEWs, added test 2015-03-14 00:52:53 +08:00
Dmitry Stogov
2b42d71908 Changed HashTable layout:
Removed HashTable->arHash (reduced memory consumption). Now hash slots may be accessed using HT_HASH() macro.
Hash slotas are allocated together with Buckets (before them) and lay in reverse order from HashTable->arData base address (see comments in Zend/zend_types.h)
Indexes in hash table and conflict resolution chains (Z_NEXT) may be stored as indeces or offsets in bytes, depending on system (32 or 64-bit).
HashTable data filelds are reordered to keep the most useful for zend_hash_find() data in the same CPU cache line.
2015-03-13 17:13:19 +03:00
Vektah
482500b455 Fix a leak 2015-03-13 15:54:30 +11:00
Vektah
950d3d6e9b Fix bug #69227 and #65967
This patch fixes a use (in zend_gc.c) after free (in spl_observer.c).
See https://bugs.php.net/bug.php?id=69227
2015-03-13 15:02:05 +11:00
Dmitry Stogov
8633685675 Use specialized macro for string zval creation 2015-03-12 16:53:51 +03:00
Dmitry Stogov
48deb1cd94 Free memory if destructor wasn't called 2015-03-11 00:57:28 +03:00
Dmitry Stogov
a30d328671 Errors converted to exceptions are not "recoverable" anymore. 2015-03-10 10:31:55 +03: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
Stanislav Malyshev
a8a77fff5c Merge branch 'PHP-5.6'
* PHP-5.6:
  Regression tests for SplFileInfo class setters
2015-03-08 17:13:32 -07:00
Stanislav Malyshev
dcc031470a Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Regression tests for SplFileInfo class setters
2015-03-08 17:13:25 -07:00
Stanislav Malyshev
a2a20d29a8 Merge branch 'pull-request/1134' into PHP-5.5
* pull-request/1134:
  Regression tests for SplFileInfo class setters
2015-03-08 17:13:02 -07:00
Dmitry Stogov
2fa8d67a5c Use zend_string* instead of char* for opened_patch handling. Avoid reallocations and improve string reuse. 2015-03-04 02:05:28 +03:00
Jeremy Mikola
dea7bc8786 Regression tests for SplFileInfo class setters
Adds tests for SplFileInfo class setters accepting either the base and child classes, and throwing an exception for unexpected classes.

Related: http://svn.php.net/viewvc?view=revision&revision=336017 and https://github.com/facebook/hhvm/pull/4917
2015-03-02 14:45:26 -05:00
Danack
c57bde7c9e Fixed SplFixedArray and tests. 2015-03-01 13:44:55 +00:00
Reeze Xia
1b240ff9e3 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fixed bug #69141 Missing arguments in reflection info for some builtin functions
2015-02-28 16:40:06 +08:00