Commit Graph

1976 Commits

Author SHA1 Message Date
Dmitry Stogov
ae88a243e4 Rmoved opcache.load_comments. 2015-06-15 14:01:26 +03:00
Aaron Piotrowski
103bf7eda0 Add Throwable tests 2015-06-15 01:47:34 -05:00
Aaron Piotrowski
482985ca38 Changed AssertionException to AssertionError 2015-06-14 23:52:39 -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
Bob Weinand
7221bd682f Revert "Revert "Expand optimizations regarding short-circuting a bit""
This reverts commit 3770a5ac66.
Fixes the bug which probably made make install fail on travis
(It never happened to me that all tests passed, but make install failed...)
2015-06-14 15:46:11 +02:00
Xinchen Hui
3770a5ac66 Revert "Expand optimizations regarding short-circuting a bit"
This break the CI  (build error)

This reverts commit 3cfa58367b.
2015-06-14 14:27:48 +08:00
Bob Weinand
3cfa58367b Expand optimizations regarding short-circuting a bit 2015-06-14 06:01:01 +02:00
Bob Weinand
f263932f38 Fix short-circuting (bug #69825) 2015-06-14 02:00:55 +02:00
Xinchen Hui
d96dda8d49 Fixed Bug #69761 (Serialization of anonymous classes should be prevented)
And also cleanup anonymous class compiling, it make no sense prefix a
namespace to anonymous class name. and it is always lowcased and
interned string.
2015-06-13 10:49:20 +08:00
Xinchen Hui
49a8f801c7 Fixed bug #69805 (null ptr deref and seg fault in zend_resolve_class_name) 2015-06-12 21:07:23 +08:00
Nikita Popov
5d3cf577aa Make convert_to_* safe with rc>1
This only involves switching zval_dtor to zval_ptr_dtor for arrays
and making the convert_to_object for arrays a bit more generic.

All the other changes outside zend_operators.c just make use of
this new ability (use COPY instead of DUP).

What's still missing: Proper references handling. I've seen many
convert_to* calls that will break when a reference is used.

Also fixes bug #69788.
2015-06-11 23:23:57 +02:00
Nikita Popov
580eb56fb7 Merge branch 'PHP-5.6'
Conflicts:
	Zend/zend_generators.c
2015-06-11 17:44:51 +02:00
Nikita Popov
8405265578 Fix bug #69740 2015-06-11 17:40:10 +02:00
Márcio Almada
fdda34e0bc fix bad formatted "undefined offset" notice when key is negative 2015-06-10 22:18:23 +02:00
Anatol Belski
a96345d12b Merge branch 'PHP-5.6'
* PHP-5.6:
  updated NEWS
  updated NEWS
  fixed bug, where a linebreak immediately after an opening quote of a value caused a segfault
  made failing test more meaningful
  added failing test
2015-06-10 10:44:44 +02:00
Anatol Belski
ca467d5117 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  updated NEWS
  fixed bug, where a linebreak immediately after an opening quote of a value caused a segfault
  made failing test more meaningful
  added failing test
2015-06-10 10:43:23 +02:00
Christoph M. Becker
2ba9681e8e made failing test more meaningful 2015-06-10 10:39:36 +02:00
Christoph M. Becker
616b932ab0 added failing test 2015-06-10 10:39:35 +02:00
Xinchen Hui
6c89d2d9de Also reflects the case change 2015-06-08 12:37:11 +08:00
Xinchen Hui
cea801cce2 Fixed bug #69767 (Default parameter value with wrong type segfaults) 2015-06-08 11:47:22 +08:00
Xinchen Hui
497f9f2cda Fixed bug #69758 (Item added to array not being removed by array_pop/shift) 2015-06-05 11:54:22 +08:00
Dmitry Stogov
adb5f93f85 Fixed bug #69755 (segfault in ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDLER) 2015-06-04 09:38:22 +03:00
Bob Weinand
1d3f77d13d Fix Bug #69754 (Compile failure with ::class in array) 2015-06-03 23:59:59 +02:00
Dmitry Stogov
8bf76bae40 Merge branch 'PHP-5.6'
* PHP-5.6:
  Fixed bug #69732 (can induce segmentation fault with basic php code).
2015-06-01 12:21:48 +03:00
Dmitry Stogov
f863d89b5c Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fixed bug #69732 (can induce segmentation fault with basic php code).

Conflicts:
	Zend/zend_vm_execute.h
2015-06-01 12:17:32 +03:00
Dmitry Stogov
9031a902e3 Fixed bug #69732 (can induce segmentation fault with basic php code). 2015-06-01 11:40:14 +03:00
Nikita Popov
39753fa222 Merge branch 'PHP-5.6'
Preserving HAS_RETURN_TYPE for __invoke() here as well.

Conflicts:
	Zend/zend_alloc.c
2015-05-29 11:11:02 +02:00
Nikita Popov
e7d0ca39e5 Preserve VARIADIC flag for Closure::__invoke()
The 13 arguments are for the benefit of PHP 7, where the first
twelve use the bitmask.
2015-05-29 11:07:23 +02:00
Bob Weinand
b73f87b1e4 Add test for memory leak with wrong return type 2015-05-27 01:37:00 +02:00
Bob Weinand
8cd62071ab Add class to semi_reserved tests 2015-05-25 23:07:37 +02:00
Márcio Almada
e67a129ea6 updates grammar tests with class members named as method modifiers \cc @bwoebi 2015-05-25 23:00:39 +02:00
Bob Weinand
69b54ba926 Also unreserve T_CLASS 2015-05-25 22:58:30 +02:00
Bob Weinand
886cbea94f Merge context sensitive lexer RFC 2015-05-25 18:38:40 +02:00
Nikita Popov
d0e265392f Drop FREE_ON_RETURN flag, check brk_cont->start instead
Start >= 0 already tells us whether or not the loop has a loop
variable, no need to add extra flags to opcodes.

Also added a test for a case where FREE_ON_RETURN is relevant,
we didn't seem to have any coverage for this.
2015-05-23 10:51:33 +02:00
Nikita Popov
3dba00bc31 Fix scope_is_known() for class constants
Here the active_op_array is still the surrounding file, but we
do know the scope.
2015-05-21 21:07:05 +02:00
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
4ea1d8a9c7 Show argument causing TypeException in trace
Not sure why that check was there, did I miss something?
2015-05-20 18:28:09 +02:00
Aaron Piotrowski
99640cd013 Merge branch 'master' into throwable-interface 2015-05-18 13:34:46 -05:00
Xinchen Hui
ab680e7f6e Added Test (the lineno should be fixed) 2015-05-18 11:16:57 +08:00
Aaron Piotrowski
e97d5fab35 Update exception names in tests after formatting changes. 2015-05-17 17:31:43 -05:00
Aaron Piotrowski
fb7206e452 Merge branch 'master' into throwable-interface 2015-05-17 16:15:35 -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
Aaron Piotrowski
0eba6f597a Merge branch 'master' into throwable-interface 2015-05-17 12:12:02 -05: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
0df2f470fa Don't write prop if read prop threw exception 2015-05-17 13:46:54 +02:00
Aaron Piotrowski
64b167d201 Updated tests to reflect exception class changes. 2015-05-16 16:49:14 -05: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
Bob Weinand
c6a6b9746d Fix memleak in generators using symtable 2015-05-14 17:17:39 +02:00
Dmitry Stogov
fc75d07652 Fixed memory leak 2015-05-14 17:07:32 +03:00
Nikita Popov
c6b986b4e7 Merge branch 'PHP-5.6'
Conflicts:
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
2015-05-12 15:09:25 +02:00
Nikita Popov
e1cb22a23e Fix bug #69599 2015-05-12 15:08:12 +02:00
Aaron Piotrowski
071111ecfc Add support for $callable() sytnax with 'Class::method'
Using the $callable() syntax when used with a string of
the form 'Class::method' would error as an undefined
function, even if the string passed is_callable() or the
callable type-hint. The fix adds support for the $callable()
syntax for any string accepted by is_callable() or the
callable type-hint.

Fix bug 68475 test with deprecated notice

Reduced scope of unit test.

Added tests with arguments.
2015-05-12 13:33:28 +02:00
Julien Pauli
0b22cf04e3 Fixed tests 2015-05-12 11:18:35 +02:00
Stanislav Malyshev
ef8bb69a14 Ban rebinding closures to different internal classes 2015-05-12 10:54:59 +02:00
Nikita Popov
8f9f21e8d2 Fix static closure error in call_user_func opcode
I'm assuming this is the only error that is_callable() can generate
with retval=1.

This problem manifested after making closures in static methods
not implicitly static, but would also occur when binding any non-static
closure to a scope without a $this.
2015-05-08 15:17:15 +02:00
Nikita Popov
6ef8ae65a2 Allow self etc in eval / file scope
This fixes a regression from 16a9bc1ec2.
Together with the recent closure related changes this should allow
all usages of self etc, while previously (in PHP 5) some things like
self::class did not work.
2015-05-07 15:38:16 +02:00
Dmitry Stogov
2a9f9860d7 Fixed bug #69534 (Cycle leaks through declared properties on internal classes) 2015-05-06 21:33:49 +03:00
Nikita Popov
ab97606b8a Fix compiler assumptions about self/etc wrt closures
* Don't throw an error if self/parent/static are used in a closure
  (outside a class).
* Don't propagate self:: constants into closures
* Use runtime fetch for self::class in closures

Fixes bug #66811.
2015-05-06 18:13:19 +02:00
Nikita Popov
bc2ff4a299 Don't implicitly make closures in static methods static
It makes no sense that you can't write a closure using $this in a
static method, even though you can write one outside a class.

Now only closures that have been marked as static will be considered
to be static.

Fixes bug #65598.
2015-05-06 17:29:05 +02:00
Nikita Popov
d9c2959c27 Fix LSB handling for closures
Closures will now use the called_scope from their instantiation
site. If they are rebound either the class of $this is used or if
no $this is provided the bound scope is used.

With this change the scope for static closures can be changed back
to use EG(scope) rather than EX(called_scope), thus fixing
bug #69568.
2015-05-05 21:14:03 +02:00
Márcio Almada
a54e1237ec add tests for semi reserved words and remove obsolete ones 2015-04-30 03:03:29 -03:00
Nikita Popov
16a9bc1ec2 Disallow self etc outside classes at compile-time
Also fix a bug with return types where "self" was rejected inside
a class, but not on a method.

Fallout: A couple of tests changed to more generic error messages.
2015-04-29 20:51:08 +02:00
Nikita Popov
8361893444 Fix implementing_class handling 2015-04-26 16:03:58 +02:00
krakjoe
49608e0608 Rebase Joe's anon classes implementation 2015-04-26 15:04:22 +02:00
Nikita Popov
75b4fa079f Fix bug #69532
Partial revert of ea2fc7f935.
2015-04-25 18:47:26 +02:00
Dmitry Stogov
fc80305e48 Cleanup comments and add related tests. 2015-04-23 17:52:05 +03:00
Nikita Popov
62aabf5d9f Fix "invalid opcode" error
Method call can happen on CONST, it'll just throw an error.

Not forbidding this at compile-time, so this can be overridden in
an extension.
2015-04-22 17:46:25 +02:00
Bob Weinand
4376373da3 Fix yield from with iterator (first element missing) 2015-04-21 19:42:23 +02:00
Nikita Popov
d2607a0110 Move more stuff to file_context
Introduce helper macro FC(x) for CG(file_context).x.

end_compilation() now handled by file_context_end().

While at it, dropped zval wrapper for ticcks.
2015-04-21 17:39:07 +02:00
Xinchen Hui
a090977419 Merge branch 'PHP-5.6'
Conflicts:
	Zend/zend_compile.c
2015-04-21 22:39:46 +08:00
Xinchen Hui
9d9ba493a2 Merge branch 'PHP-5.5' into PHP-5.6 2015-04-21 22:37:00 +08:00
Xinchen Hui
c667c26f61 Fixed Bug #69467 (Wrong checked for the interface by using Trait) 2015-04-21 22:36:32 +08:00
Xinchen Hui
8362aebdbf Fixed mem leak in assign_to_obj with reference 2015-04-21 21:04:20 +08:00
Dmitry Stogov
736b7cf419 Added test 2015-04-17 18:45:46 +03:00
Nikita Popov
5c214fc10d Add test for recursive __debugInfo()
This also got fixed by switching to object apply count.
2015-04-15 22:38:50 +02:00
Bob Weinand
3dcad2eea2 Fix bug #69458 2015-04-15 21:56:11 +02:00
Nikita Popov
acd61be985 Add "yield from" support to ast pretty printer 2015-04-14 19:15:40 +02:00
Dmitry Stogov
00445ba22d Fixed bug #69446 (GC leak relating to removal of nested data after dtors run) 2015-04-14 19:53:56 +03:00
Bob Weinand
f3e124d58d Merge branch 'coroutineDelegation' of https://github.com/bwoebi/php-src 2015-04-14 17:58:58 +02:00
Nikita Popov
a7059f1eac Merge branch 'PHP-5.6'
Conflicts:
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
2015-04-14 16:38:09 +02:00
Nikita Popov
ed7e6d4758 Merge branch 'PHP-5.5' into PHP-5.6 2015-04-14 16:36:36 +02:00
Nikita Popov
95650d0942 Fixed bug #69419 2015-04-14 16:35:23 +02:00
Dmitry Stogov
65baab7741 Merge branch 'PHP-5.6'
* PHP-5.6:
  Bug #63336 is not a bug
  fix test

Conflicts:
	Zend/tests/bug63336.phpt
2015-04-14 17:18:55 +03:00
Dmitry Stogov
e8fb5201ba Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Bug #63336 is not a bug
2015-04-14 17:16:57 +03:00
Dmitry Stogov
dc024f0bdc Bug #63336 is not a bug 2015-04-14 17:15:50 +03:00
Dmitry Stogov
9806a62545 GC improved to support inner-cycles. 2015-04-14 00:16:27 +03:00
Xinchen Hui
cefad04f0d Fixed bug #69427 (Segfault on magic method __call of private method in superclass) 2015-04-11 23:57:42 +08:00
Dmitry Stogov
5e8133f453 Squashed commit of the following:
commit 2399fc84c5
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 12:38:08 2015 +0300

    Removed useless assignment

commit 796b633817
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 12:35:31 2015 +0300

    Fixed execution with overriden zend_execute_ex()

commit 4a9fb125aa
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 02:02:58 2015 +0300

    Fixed executor without global registers

commit d456c30e00
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 01:30:35 2015 +0300

    Restored original behavior for tests/classes/__call_004.phpt

commit 479646d37f
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 00:32:17 2015 +0300

    Fixed test. We don't keep stack frame for fake function anymore.

commit 9ae61e33e2
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 00:30:09 2015 +0300

    Use ZEND_ACC_CALL_VIA_TRAMPOLINE instead of ZEND_ACC_CALL_VIA_HANDLER. Keep ZEND_ACC_CALL_VIA_HANDLER for compatibility.

commit 0a8403a2a0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 00:05:43 2015 +0300

    Rename PROXY_CALL into CALL_TRAMPLINE.
    Generalize API to allow reuse EG(trampline) for other purposes.

commit 4ea0525c10
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 23:22:25 2015 +0300

    Reuse EG(proxy_call_op) for all proxy. Move proxy related functions from zend_objects_API to zend_object_handlers.

commit 529bf737ca
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 21:42:23 2015 +0300

    Accurate use of proxy_call

commit 5d62837d5b
Merge: 83e749f 690843f
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 19:40:00 2015 +0300

    Merge branch 'master' into opcodefy-call

    * master:
      Fixed GOTO executor
      Fixed typo
      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.

commit 83e749ff3b
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 19:39:10 2015 +0300

    Improved ZEND_PROXY_CALL

commit 0c829afc53
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 15:14:49 2015 +0300

    Reverted white-space changes

commit df65144488
Merge: 5fd2f97 97756d9
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 14:37:07 2015 +0300

    Merge branch 'opcodefy-call' of github.com:laruence/php-src into opcodefy-call

    * 'opcodefy-call' of github.com:laruence/php-src:
      Ready for PR
      Fixed static call
      Improve performance by using prealloated op_arrray
      Respect called_scope
      Support internal magical __call/__callStatic
      opcode-fy magical __callStatic
      Opcode-fy magical __call

commit 97756d9190
Author: Xinchen Hui <laruence@gmail.com>
Date:   Thu Apr 9 19:07:59 2015 +0800

    Ready for PR

commit 74f9930846
Author: Xinchen Hui <laruence@gmail.com>
Date:   Thu Apr 9 19:03:00 2015 +0800

    Fixed static call

commit ec1d9eb592
Author: Xinchen Hui <laruence@gmail.com>
Date:   Thu Apr 9 18:23:17 2015 +0800

    Improve performance by using prealloated op_arrray

commit df7fbbf949
Author: Xinchen Hui <laruence@gmail.com>
Date:   Thu Apr 9 15:10:02 2015 +0800

    Respect called_scope

commit 769d1d59fb
Author: Xinchen Hui <laruence@gmail.com>
Date:   Thu Apr 9 12:19:23 2015 +0800

    Support internal magical __call/__callStatic

commit a980fedd5b
Author: Xinchen Hui <laruence@gmail.com>
Date:   Wed Apr 8 18:35:41 2015 +0800

    opcode-fy magical __callStatic

commit 73855f7d53
Author: Xinchen Hui <laruence@gmail.com>
Date:   Wed Apr 8 14:21:55 2015 +0800

    Opcode-fy magical __call
2015-04-10 23:01:00 +03:00
Xinchen Hui
c5903e79be Merge branch 'PHP-5.6'
Conflicts:
	Zend/zend_compile.c
2015-04-10 22:50:15 +08:00
Xinchen Hui
fa0608077b Merge branch 'PHP-5.5' into PHP-5.6 2015-04-10 22:48:36 +08:00
Xinchen Hui
429f411eb3 Fixed bug #69420 (Invalid read in zend_std_get_method) 2015-04-10 22:47:06 +08:00
Dmitry Stogov
e1d6b24da8 Addef test for bug #63734 (Garbage collector can free zvals that are still referenced) 2015-04-08 22:18:10 +03:00
Dmitry Stogov
91e84bb168 Merge branch 'PHP-5.6'
* PHP-5.6:
  Fixed bug #67314 (Segmentation fault in gc_remove_zval_from_buffer)

Conflicts:
	NEWS
	Zend/zend_execute_API.c
2015-04-08 21:26:45 +03:00
Dmitry Stogov
1f5f78d4aa Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fixed bug #67314 (Segmentation fault in gc_remove_zval_from_buffer)
  Fixed bug #67314 (Segmentation fault in gc_remove_zval_from_buffer)
2015-04-08 21:24:24 +03:00
Dmitry Stogov
174b9ee634 Fixed bug #67314 (Segmentation fault in gc_remove_zval_from_buffer) 2015-04-08 21:20:35 +03:00
Dmitry Stogov
4d9a1883aa Fixed bug #68887 (resources are not freed correctly) 2015-04-08 13:29:42 +03:00
Dmitry Stogov
55cdde3dd6 Fixed bug #69376 (Wrong ref counting). 2015-04-07 02:35:52 +03:00
Nikita Popov
f53e20e595 Merge branch 'PHP-5.6'
Conflicts:
	Zend/zend_compile.c
	Zend/zend_compile.h
	Zend/zend_language_parser.y
2015-04-06 22:09:22 +02:00
Nikita Popov
7e9a1c1e3f Merge branch 'PHP-5.5' into PHP-5.6
Conflicts:
	Zend/zend_compile.c
	Zend/zend_compile.h
2015-04-06 22:06:48 +02:00
Nikita Popov
cc70a46525 Fix bug #60022 2015-04-06 22:03:04 +02:00