Dmitry Stogov
245dbb043e
Merge branch 'PHP-5.5'
...
* PHP-5.5:
spelling
2012-12-25 16:22:22 +04:00
Dmitry Stogov
7625a3b3b4
Merge branch 'PHP-5.4' into PHP-5.5
...
* PHP-5.4:
spelling
2012-12-25 16:22:07 +04:00
Dmitry Stogov
7e2629635b
spelling
2012-12-25 16:21:25 +04:00
Dmitry Stogov
8728ca65c6
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Fixed ZTS build
2012-12-25 13:39:13 +04:00
Dmitry Stogov
016f3c8610
Merge branch 'PHP-5.4' into PHP-5.5
...
* PHP-5.4:
Fixed ZTS build
2012-12-25 13:39:02 +04:00
Dmitry Stogov
f0b459b7c4
Fixed ZTS build
2012-12-25 13:38:14 +04:00
Dmitry Stogov
f3ea497377
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Removed deprecated fields
2012-12-25 10:50:35 +04:00
Dmitry Stogov
bc0425c025
Removed deprecated fields
2012-12-25 10:47:43 +04:00
Dmitry Stogov
3b17a09017
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Traits refactoring
2012-12-25 10:34:07 +04:00
Dmitry Stogov
b8c719c068
Merge branch 'PHP-5.4' into PHP-5.5
...
* PHP-5.4:
Traits refactoring
2012-12-25 10:33:01 +04:00
Dmitry Stogov
3f8c729e69
Traits refactoring
2012-12-25 10:23:08 +04:00
Nikita Popov
fd25d48494
Merge branch 'PHP-5.5'
2012-12-24 00:30:26 +01:00
Nikita Popov
be7b0bc3ec
Implement Generator::throw() method
...
Generator::throw($exception) throws an exception into the generator. The
exception is thrown at the current point of suspension within the generator.
It basically behaves as if the current yield statement were replaced with
a throw statement and the generator subsequently resumed.
2012-12-24 00:27:55 +01:00
Nikita Popov
1f4c71b760
Merge branch 'PHP-5.5'
2012-12-21 17:34:14 +01:00
Nikita Popov
14f133036c
Fix crash when last yielded value is a closure
...
If zend_generator_close is called from within zend_generator_resume (e.g.
due to a return statement) then all the EGs will still be using the values
from the generator. That's why the stack frame has to be the last thing
that is dtored, otherwise some other dtor that is using
EG(current_execute_data) might access the already freed memory segment.
This was the case with the closure dtor.
The fix is to move the dtors for key and value to the start of the handler.
This way the stack frame is the last thing that is freed.
2012-12-21 17:28:20 +01:00
Nikita Popov
4509016309
Merge branch 'PHP-5.5'
2012-12-21 01:58:29 +01:00
Nikita Popov
ffb848b275
Fix bug #63822 : Crash when using closures with ArrayAccess
...
op_array->T was used after the closure's op_array was already freed. This just
swaps the freeing order.
2012-12-21 01:56:37 +01:00
Nikita Popov
68730388ae
Merge branch 'PHP-5.5'
2012-12-20 20:36:06 +01:00
Nikita Popov
3e78c6ad25
Do not add a ref to EX(object) on generator clone
...
If a ref has to be added it will be already added while walking the call
slots.
2012-12-20 20:33:18 +01:00
Nikita Popov
0e781e2309
Merge branch 'PHP-5.5'
2012-12-19 15:23:52 +01:00
Nikita Popov
2768315856
Add missing zend_do_free call
...
This is a followup to d53f1bf8ab
. When the yield *statement* is used its
return value still needs to be freed.
2012-12-19 15:21:34 +01:00
Nikita Popov
5f7c478d53
Merge branch 'PHP-5.5'
2012-12-18 21:41:55 +01:00
Nikita Popov
d53f1bf8ab
Fix leak when generator ignores sent value
...
When the return value of yield wasn't used it was leaked.
This is fixed by using a TMP_VAR return value instead of VAR. TMP_VARs are
automatically freed when they aren't used.
2012-12-18 21:39:02 +01:00
Xinchen Hui
210d428f99
ixed bug that exception won't be catched
...
Related failed test Zend/tests/bug35437.phpt (after he latest
execute_data improvement, run with non CALL vm kind)
2012-12-18 15:34:47 +08:00
Xinchen Hui
d3ec9ceb25
Revert "Fixed bug that exception won't be catched"
...
This reverts commit 28db07a0e3
.
Unexpected vm kind change
2012-12-18 15:27:54 +08:00
Xinchen Hui
28db07a0e3
Fixed bug that exception won't be catched
...
related failed test Zend/tests/bug35437.phpt (after he latest
execute_data improvement, run with non CALL vm kind)
2012-12-18 15:20:58 +08:00
Xinchen Hui
72f7543668
Merge branch 'PHP-5.5'
2012-12-14 17:27:21 +08:00
Xinchen Hui
a73a6be764
Fix warning of no return in non-void function
2012-12-14 17:26:42 +08:00
Xinchen Hui
3acc729707
Merge branch 'PHP-5.5'
2012-12-14 17:23:07 +08:00
Xinchen Hui
9fb5cfdeb1
Fixed warning of no return in non-void funciton
2012-12-14 17:21:43 +08:00
Xinchen Hui
359d91a807
Add test for bug #63741
2012-12-14 16:52:56 +08:00
Xinchen Hui
a4678099a1
Add test for bug #63741
2012-12-14 16:51:34 +08:00
Dmitry Stogov
ec4ff07415
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Fixed uninitialized EX(call)->called_scope
2012-12-14 12:11:23 +04:00
Dmitry Stogov
e65b966aac
Fixed uninitialized EX(call)->called_scope
2012-12-14 12:10:29 +04:00
Johannes Schlüter
f8a2407655
Merge branch 'PHP-5.5'
2012-12-13 22:50:55 +01:00
Johannes Schlüter
2098cc7e9d
Merge branch 'PHP-5.4' into PHP-5.5
2012-12-13 22:45:47 +01:00
Johannes Schlüter
ef37055c34
Merge branch 'PHP-5.3' into PHP-5.4
2012-12-13 22:40:23 +01:00
Johannes Schlüter
a11606b18f
Fix Bug #63762 Sigsegv when Exception::$trace is changed by user
2012-12-13 22:39:35 +01:00
Dmitry Stogov
432902a875
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Removed unreachable code
2012-12-13 17:51:41 +04:00
Dmitry Stogov
d5c2da5756
Removed unreachable code
2012-12-13 17:51:04 +04:00
Dmitry Stogov
7dd16bcff4
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Removed unnecessary checks
2012-12-13 17:30:39 +04:00
Dmitry Stogov
438cd86378
Removed unnecessary checks
2012-12-13 17:29:30 +04:00
Dmitry Stogov
cc118f78d7
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Removed redundand checks from release build
2012-12-13 14:47:23 +04:00
Dmitry Stogov
ff1e1d7a8e
Removed redundand checks from release build
2012-12-13 14:46:44 +04:00
Dmitry Stogov
7b84d129d7
Merge branch 'PHP-5.5'
...
* PHP-5.5:
An exception thrown in try or catch block is disacarded by return statement in finally block.
2012-12-13 02:52:23 +04:00
Dmitry Stogov
6b0b4bf8eb
An exception thrown in try or catch block is disacarded by return statement in finally block.
2012-12-13 02:48:51 +04:00
Dmitry Stogov
e7364e14da
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Restored proper generators behaviour in conjunction with "finally". (Nikita)
2012-12-12 17:50:01 +04:00
Dmitry Stogov
9c96fe52d9
Restored proper generators behaviour in conjunction with "finally". (Nikita)
2012-12-12 17:47:55 +04:00
Dmitry Stogov
2025021ed5
Merge branch 'PHP-5.5'
...
* PHP-5.5:
- generators API exported for extensions - improved RETURN sequence to avoid redundant check if op_array is a generator
2012-12-11 17:28:09 +04:00
Dmitry Stogov
a9a5f7aca6
- generators API exported for extensions
...
- improved RETURN sequence to avoid redundant check if op_array is a generator
2012-12-11 17:25:32 +04:00
Xinchen Hui
80e585027e
Merge branch 'PHP-5.5'
2012-12-10 20:31:01 +08:00
Xinchen Hui
70b65f3100
Merge branch 'PHP-5.4' into PHP-5.5
2012-12-10 20:30:39 +08:00
Xinchen Hui
3d86e6d881
Fixed bug #63726 (Memleak with static properties and internal/user classes)
...
No test scripts provided (will try to find one)
2012-12-10 20:29:51 +08:00
Xinchen Hui
ad553a7af2
Fixed bug #63726 (Memleak with static properties and internal/user classes)
2012-12-10 20:28:27 +08:00
Dmitry Stogov
3067f54b27
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Generatirs are going to be used less than regular functions
2012-12-06 13:20:49 +04:00
Dmitry Stogov
e3b2a5cf74
Generatirs are going to be used less than regular functions
2012-12-06 13:14:31 +04:00
Sebastian Bergmann
4f4262e9be
Merge branch 'PHP-5.5'
2012-12-06 09:44:20 +01:00
Sebastian Bergmann
8ca4288fd2
Leftover: Invoke re2c with --no-generation-date to prevent unintentional / unnecessary changes in generated files.
2012-12-06 09:43:27 +01:00
Sebastian Bergmann
6fc2ecaaf2
Merge branch 'PHP-5.5'
2012-12-06 09:30:47 +01:00
Sebastian Bergmann
eab14993fe
Invoke re2c with --no-generation-date to prevent unintentional / unnecessary changes in generated files.
2012-12-06 09:28:35 +01:00
Dmitry Stogov
55e1a9786a
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Fixed comments
2012-12-05 16:03:37 +04:00
Dmitry Stogov
27528b601f
Fixed comments
2012-12-05 16:02:47 +04:00
Dmitry Stogov
77a9b9ac22
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Slight performance improvement
2012-12-05 13:36:28 +04:00
Dmitry Stogov
fa30e4754b
Slight performance improvement
2012-12-05 13:23:37 +04:00
David Soria Parra
808afd6db3
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Pass zend_execute_data instead of zend_op_array
2012-12-05 00:46:30 +01:00
David Soria Parra
288f8734f6
Pass zend_execute_data instead of zend_op_array
2012-12-05 00:45:23 +01:00
David Soria Parra
e4c1aa33ab
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Overwrite execute_ex instead of execute in dtrace_execute
Enable dtrace probes on linux as they are compatible with systemtap
2012-12-04 21:02:23 +01:00
David Soria Parra
15a251a424
Overwrite execute_ex instead of execute in dtrace_execute
2012-12-04 21:01:32 +01:00
Dmitry Stogov
4d5859558a
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Increased version numbers
2012-12-04 10:48:49 +04:00
Dmitry Stogov
9e39a636da
Increased version numbers
2012-12-04 10:48:09 +04:00
Dmitry Stogov
f4263c2d0f
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Moved zend_create_execute_data_from_op_array() implementation from zend_vm_execute.skl to zend_execute.c
2012-12-04 10:43:59 +04:00
Dmitry Stogov
61dbf35cfc
Moved zend_create_execute_data_from_op_array() implementation from zend_vm_execute.skl to zend_execute.c
2012-12-04 10:42:19 +04:00
Dmitry Stogov
3f47131fc6
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Optimized access to temporary and compiled VM variables
2012-12-04 10:35:52 +04:00
Dmitry Stogov
7651d64556
Optimized access to temporary and compiled VM variables
2012-12-04 10:14:39 +04:00
Felipe Pena
80004db65d
Merge branch 'PHP-5.5'
...
* PHP-5.5:
- Fixed ZTS build
2012-11-30 09:07:47 -02:00
Felipe Pena
5db372fbdc
- Fixed ZTS build
2012-11-30 09:07:35 -02:00
Dmitry Stogov
8cbe4f7e17
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Fixed bug #63066 (Calling an undefined method in a generator results in a seg fault) (fixed with previous commit).
2012-11-30 14:16:38 +04:00
Dmitry Stogov
66b8ece02a
Fixed bug #63066 (Calling an undefined method in a generator results in a seg fault) (fixed with previous commit).
2012-11-30 14:14:36 +04:00
Dmitry Stogov
3985f06115
Merge branch 'PHP-5.5'
...
* PHP-5.5:
. The VM stacks for passing function arguments and syntaticaly nested calls were merged into a single stack. The stack size needed for op_array execution is calculated at compile time and preallocated at once. As result all the stack push operatins don't require checks for stack overflow any more. . Generators implementation was improved using the new VM stack. Now it's a bit more clear and faster.
2012-11-30 14:03:23 +04:00
Dmitry Stogov
70f83f35d0
. The VM stacks for passing function arguments and syntaticaly nested calls were merged into a single stack. The stack size needed for op_array execution is calculated at compile time and preallocated at once. As result all the stack push operatins don't require checks for stack overflow any more.
...
. Generators implementation was improved using the new VM stack. Now it's a bit more clear and faster.
2012-11-30 13:39:23 +04:00
Dmitry Stogov
8b7df4bbd8
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Fixed bug #63635 (Segfault in gc_collect_cycles)
2012-11-29 13:48:44 +04:00
Dmitry Stogov
3c1888f584
Fixed bug #63635 (Segfault in gc_collect_cycles)
2012-11-29 13:06:12 +04:00
Dmitry Stogov
f877d7fee6
Merge branch 'PHP-5.3' into PHP-5.4
...
* PHP-5.3:
Fixed bug #63635 (Segfault in gc_collect_cycles)
Conflicts:
NEWS
2012-11-29 12:38:34 +04:00
Dmitry Stogov
92e2f29381
Fixed bug #63635 (Segfault in gc_collect_cycles)
2012-11-29 12:25:20 +04:00
Nikita Popov
6e1b84a646
Merge branch 'PHP-5.5'
2012-11-24 19:24:40 +01:00
Nikita Popov
60871e51ad
Fix bug #63596 : finally in generators segfaults
...
EX(fast_ret) wasn't initialized in this case so the code ended up
dereferencing an invalid pointer after the jump.
2012-11-24 19:24:09 +01:00
Dmitry Stogov
ffc1f5b2cd
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Improved "finally" im[plementation
2012-11-22 15:39:48 +04:00
Dmitry Stogov
eb4825b50b
Improved "finally" im[plementation
2012-11-22 15:17:05 +04:00
Dmitry Stogov
51abbe5dea
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Fixed bug #63468 (wrong called method as callback with inheritance)
Add actual branch version number to UPGRADING
Put the new php.ini directives together.
Move the deprecated functions up to the Deprecated Functionality section so they're more visible.
Conflicts:
UPGRADING
2012-11-20 13:17:21 +04:00
Dmitry Stogov
8f65c76d2e
Merge branch 'PHP-5.4' into PHP-5.5
...
* PHP-5.4:
Fixed bug #63468 (wrong called method as callback with inheritance)
Conflicts:
NEWS
2012-11-20 12:58:16 +04:00
Dmitry Stogov
111aa9fd2e
Merge branch 'PHP-5.3' into PHP-5.4
...
* PHP-5.3:
Fixed bug #63468 (wrong called method as callback with inheritance)
Conflicts:
NEWS
2012-11-20 12:54:40 +04:00
Dmitry Stogov
396c1e990a
Fixed bug #63468 (wrong called method as callback with inheritance)
2012-11-20 12:51:55 +04:00
Pierrick Charron
82183b7f62
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Regenerate Zend ini scanner
2012-11-16 18:29:59 -05:00
Pierrick Charron
8c97c79d77
Merge branch 'PHP-5.4' into PHP-5.5
...
* PHP-5.4:
Regenerate Zend ini scanner
Conflicts:
Zend/zend_ini_scanner.c
Zend/zend_ini_scanner_defs.h
2012-11-16 18:28:04 -05:00
Pierrick Charron
99edb55e41
Merge branch 'PHP-5.3' into PHP-5.4
...
* PHP-5.3:
Regenerate Zend ini scanner
Conflicts:
Zend/zend_ini_scanner.c
Zend/zend_ini_scanner_defs.h
2012-11-16 18:24:42 -05:00
Pierrick Charron
c886691100
Regenerate Zend ini scanner
...
Regenerate both zend_ini_scanner.c and zend_ini_scanner_defs.h
2012-11-16 18:16:21 -05:00
Pierrick Charron
a4c52f0678
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Fixed bug #63512 parse_ini_file() with INI_SCANNER_RAW removes quotes from value
2012-11-16 18:09:51 -05:00
Pierrick Charron
30d659144a
Merge branch 'PHP-5.4' into PHP-5.5
...
* PHP-5.4:
Fixed bug #63512 parse_ini_file() with INI_SCANNER_RAW removes quotes from value
2012-11-16 18:08:19 -05:00
Pierrick Charron
15ab75be8a
Merge branch 'PHP-5.3' into PHP-5.4
...
* PHP-5.3:
Fixed bug #63512 parse_ini_file() with INI_SCANNER_RAW removes quotes from value
2012-11-16 18:07:02 -05:00
Pierrick Charron
6dff07aa8c
Fixed bug #63512 parse_ini_file() with INI_SCANNER_RAW removes quotes from value
...
Restore the old behavior but keep bug 51094 fixed
2012-11-16 18:04:14 -05:00
Sebastian Bergmann
79726be67d
Leftover: Bump version to 5.6.0
2012-11-14 16:50:33 +01:00
Dmitry Stogov
a6ab007435
Merge branch 'PHP-5.5'
...
* PHP-5.5:
Fixed compiler reenterability
Fixed compiler reenterability
2012-11-14 18:42:12 +04:00
Dmitry Stogov
ba8a06fd95
Merge branch 'PHP-5.4' into PHP-5.5
...
* PHP-5.4:
Fixed compiler reenterability
Fixed compiler reenterability
Conflicts:
Zend/zend_language_scanner.c
Zend/zend_language_scanner_defs.h
2012-11-14 18:03:38 +04:00
Dmitry Stogov
f99befadbd
Fixed compiler reenterability
2012-11-14 17:47:27 +04:00
Dmitry Stogov
65585b3aa2
Fixed compiler reenterability
2012-11-14 17:45:10 +04:00
David Soria Parra
ad4a87f798
Bump API versions
2012-11-13 20:57:34 +01:00
Xinchen Hui
7bcb8780e0
Fixed bug #63428 (The behavior of execute() changed)
2012-11-04 12:48:35 +08:00
Xinchen Hui
3c6b0db052
The /e modifier is deprecated
2012-11-04 00:53:45 +08:00
Xinchen Hui
22d4205783
Update test script
2012-10-23 17:28:52 +08:00
Xinchen Hui
ad476bde9b
Merge branch 'PHP-5.4'
2012-10-23 17:29:28 +08:00
Xinchen Hui
70e0624f6f
Merge branch 'PHP-5.4'
2012-10-23 16:36:36 +08:00
Xinchen Hui
0b8b264107
Test for #63336 , xfail now
2012-10-23 16:35:56 +08:00
Xinchen Hui
0cce2a1e76
Merge branch 'PHP-5.4'
2012-10-23 11:35:20 +08:00
Xinchen Hui
74228c5151
Fixed bug #63305 (zend_mm_heap corrupted with traits)
2012-10-23 11:34:25 +08:00
Xinchen Hui
c018d09c33
Merge branch 'PHP-5.4'
2012-10-19 11:24:56 +08:00
Xinchen Hui
bb51549915
Merge branch 'PHP-5.3' into PHP-5.4
2012-10-19 11:24:15 +08:00
Xinchen Hui
90bd54c46e
preg indenpent test script for #63055
2012-10-19 11:22:56 +08:00
Derick Rethans
c165a0b6ec
Merge branch 'PHP-5.4'
2012-10-18 17:54:03 +01:00
Derick Rethans
b58d45b67f
Merge branch 'PHP-5.3' into PHP-5.4
...
Conflicts:
Zend/acinclude.m4
2012-10-18 17:53:55 +01:00
Derick Rethans
7aed21c557
SUpport newer bisons.
2012-10-18 17:53:21 +01:00
Xinchen Hui
84efca62ff
Merge branch 'PHP-5.4'
2012-10-18 20:12:00 +08:00
Xinchen Hui
1f8fd609b0
Merge branch 'PHP-5.3' into PHP-5.4
2012-10-18 20:11:32 +08:00
Xinchen Hui
e88cdaa014
better fix for #63055
2012-10-18 20:10:35 +08:00
Xinchen Hui
4eece4c86a
Merge branch 'PHP-5.4'
2012-10-18 17:35:29 +08:00
Xinchen Hui
54cef2bb6d
Merge branch 'PHP-5.3' into PHP-5.4
2012-10-18 17:33:52 +08:00
Xinchen Hui
b77873f7d2
Merge branch 'PHP-5.4'
2012-10-18 16:33:48 +08:00
Xinchen Hui
4d509708a4
I forgot that inconsistent is only avaliable in debug mode
2012-10-18 16:33:07 +08:00
Xinchen Hui
2fee6f1ee9
Merge branch 'PHP-5.4'
2012-10-18 16:06:47 +08:00
Xinchen Hui
08b9702f8a
Add comments
2012-10-18 16:06:20 +08:00
Xinchen Hui
804ab5dc48
Merge branch 'PHP-5.4'
2012-10-18 15:53:12 +08:00
Xinchen Hui
ccc519b7a9
Fixed bug #63055 (Segfault in zend_gc with SF2 testsuite)
...
This should also fixed various segfaults which the bt looks like cored in zval_mark_grey
2012-10-18 15:49:37 +08:00
Xinchen Hui
69a4301f6c
Merge branch 'PHP-5.3' into PHP-5.4
2012-10-10 10:45:07 +08:00
Xinchen Hui
1b9e0de2cc
Remove executable permission on inc
2012-10-10 10:44:34 +08:00
Xinchen Hui
45e938ec34
Remove executable permission on phpt
2012-10-10 10:31:53 +08:00
Xinchen Hui
e081c55fb5
Merge branch 'PHP-5.3' into PHP-5.4
2012-10-10 10:31:31 +08:00
Xinchen Hui
610c7fbe7b
Remove executable permission on phpt
2012-10-10 10:27:49 +08:00
Xinchen Hui
e4a8fa6a15
Merge branch 'PHP-5.3' into PHP-5.4
2012-10-09 13:29:51 +08:00
Xinchen Hui
6284ef112e
Fixed bug #63236 (Executable permission on various source files)
2012-10-09 13:28:31 +08:00
Xinchen Hui
67611c67fa
Fixed bug #63219 (Segfault when aliasing trait method when autoloader throws excpetion)
2012-10-08 22:59:52 +08:00
Xinchen Hui
4e5e8c9da0
Merge branch 'PHP-5.4'
2012-10-10 10:45:34 +08:00
Xinchen Hui
4b152e5470
Merge branch 'PHP-5.4'
2012-10-10 10:32:38 +08:00
Xinchen Hui
75a2c0d715
Merge branch 'PHP-5.4'
2012-10-09 13:30:22 +08:00
Xinchen Hui
6cd6a74c5a
Merge branch 'PHP-5.4'
2012-10-08 23:00:57 +08:00
Stanislav Malyshev
531e2533dd
Use zend_execute_internal always to call internal functions
2012-10-05 08:14:20 +02:00
Stanislav Malyshev
bda93f5405
use zend_execute_internal
2012-10-04 22:43:13 -07:00
Nikita Popov
aaabac2473
Merge branch 'PHP-5.4'
...
Conflicts:
Zend/zend_vm_def.h
2012-09-27 18:46:27 +02:00
Nikita Popov
592b232e83
Fix bug #63173 : Crash when invoking invalid array callback
...
The code did not check whether the zend_hash_index_find calls succeded,
so PHP crashed when an array callback was called that contains two elements
which don't have the indices 0 and 1.
2012-09-27 18:40:00 +02:00
Nikita Popov
5c7dd7811e
Simplify set_error_handler/set_exception_handler code
2012-09-22 21:46:29 +02:00
Nikita Popov
f28c128b20
Return previous error handler when resetting the error handler
...
set_error_handler(null) and set_exception_handler(null) now return the
previous error/exception handler instead of just returning bool(true).
This is consistent with the behavior of these functions with non-null
values.
2012-09-22 21:46:18 +02:00
Nikita Popov
c815dd74bc
Allow resetting the error handler
...
This allows the error handler to be reset using set_error_handler(null).
As the code suggests this behavior was already previously intended, but
the callback check was done too strictly.
2012-09-22 21:46:02 +02:00
Nikita Popov
4954aba2ed
Revert error/exception handler changes
...
This reverts the following two commits:
* 6ba2e662e4
* d8f8e98d8e
Laruence already did some partial changes to set_error_handler and
set_exception_handler. I'm reverting those modifications to apply the full
set of changes. (The modifications changed the code structure in a way that
would lead to more duplication with the new behavior.)
2012-09-22 21:41:51 +02:00
Nikita Popov
a31fa55b44
Fixed bug #63132
...
EG(arg_types_stack) is now also backed up when generators are used. This
allows the use of yield in nested method calls.
This commit adds two new functions to the zend_ptr_stack API:
zend_ptr_stack_push_from_memory
zend_ptr_stack_pop_into_memory
both taking the following arguments:
zend_ptr_stack *stack, int count, void **pointers
2012-09-22 19:15:53 +02:00
Dmitry Stogov
274cbe5238
Merge branch 'PHP-5.4'
...
* PHP-5.4:
Fixed bug #63111 (is_callable() lies for abstract static method)
Fix folding
Conflicts:
NEWS
2012-09-21 15:14:29 +04:00
Dmitry Stogov
ed3a2eec9c
Merge branch 'PHP-5.3' into PHP-5.4
...
* PHP-5.3:
Fixed bug #63111 (is_callable() lies for abstract static method)
Conflicts:
NEWS
2012-09-21 14:18:37 +04:00
Dmitry Stogov
4db74b7f19
Fixed bug #63111 (is_callable() lies for abstract static method)
2012-09-21 13:07:14 +04:00
Xinchen Hui
fd0b3ea663
Fixed bug #61442 (exception threw in __autoload can not be catched)
2012-09-19 19:40:59 +08:00
Stanislav Malyshev
44e3a9be7e
Merge branch 'PHP-5.4'
...
* PHP-5.4:
update news
Support building PHP with the native client toolchain.
test should fail
2012-09-17 15:58:48 -07:00
Stuart Langley
2e24d9a2b3
Support building PHP with the native client toolchain.
...
The native client compiler defines the C macro __x86_64__, but the size
of an unsigned int is only 4 bytes. This causes the compile to fail
because the inline asm code compiled is for an 8 byte unsigned int. Add
the correct defines to fix this.
As detailed in:
http://code.google.com/p/nativeclient/issues/detail?id=2255
2012-09-17 15:52:55 -07:00
Nikita Popov
a47c11a13d
Fix two op_array -> function cast warnings
2012-09-16 22:01:07 +02:00
Nikita Popov
526db7db14
Replace code with zend_clean_and_cache_symbol_table() call
...
I replaced other instances of this code with the function call, but missed
this one.
2012-09-16 21:54:48 +02:00
Nikita Popov
fb03ce93d3
Fix invalid read / remove useless code
...
Generators follow a different cleanup path, so the extra check for freeing
the execute_data is unnecessary there. It actually caused problems because
op_array->fn_flags could be in freed memory at that time (in case op_array
came from a closure in an ArrayAccess container).
This fixes the valgrind warning in Zend/tests/bug54367.phpt.
2012-09-16 21:48:57 +02:00
Xinchen Hui
80b29dcfad
Merge branch 'PHP-5.4'
2012-09-15 11:51:48 +08:00
Xinchen Hui
ee620e9673
Merge branch 'PHP-5.3' into PHP-5.4
2012-09-15 11:51:25 +08:00
Xinchen Hui
4c6678d605
Fixed bug #63093 (Segfault while load extension failed in zts-build).
2012-09-15 11:50:16 +08:00
Dmitry Stogov
d4d82aac39
Merge branch 'PHP-5.4'
...
* PHP-5.4:
- Fixed bug #61767 (Shutdown functions not called in certain error situation) - Fixed bug #60909 (custom error handler throwing Exception + fatal error = no shutdown function)
Conflicts:
NEWS
2012-09-06 14:03:22 +04:00
Dmitry Stogov
6ba376f552
Merge branch 'PHP-5.3' into PHP-5.4
...
* PHP-5.3:
- Fixed bug #61767 (Shutdown functions not called in certain error situation) - Fixed bug #60909 (custom error handler throwing Exception + fatal error = no shutdown function)
Conflicts:
NEWS
Zend/zend_object_handlers.c
2012-09-06 12:14:29 +04:00
Dmitry Stogov
b29dc146b9
- Fixed bug #61767 (Shutdown functions not called in certain error situation)
...
- Fixed bug #60909 (custom error handler throwing Exception + fatal error = no shutdown function)
2012-09-06 11:26:40 +04:00
Pierre Joye
2b7bddd82a
Merge branch 'PHP-5.4'
...
* PHP-5.4:
- fix build, there was no tsrm context there, doing a fetch but this is horribly slow, this fix needs improvement (or simply add a TSRM context in the signature in master
2012-09-05 13:00:41 +02:00
Pierre Joye
954e7a3b3c
- fix build, there was no tsrm context there, doing a fetch but this is horribly slow, this fix needs improvement (or simply add a TSRM context in the signature in master
2012-09-05 13:00:04 +02:00
Pierre Joye
4a7d1b4ed8
- fix build, declarations must be 1st in a contextgit checkout -f master
2012-09-05 12:53:29 +02:00
Dmitry Stogov
bceec038c8
Merge branch 'PHP-5.4'
...
* PHP-5.4:
Fixed bug #62907 (Double free when use traits)
Conflicts:
NEWS
2012-09-05 10:01:04 +04:00
Dmitry Stogov
6c0508f8d5
Fixed bug #62907 (Double free when use traits)
2012-09-05 09:58:22 +04:00
Dmitry Stogov
72473962a9
Fixed bug #62991 (Segfault with generator and closure)
2012-09-05 09:50:55 +04:00
Xinchen Hui
32a97dfae6
Merge branch 'PHP-5.4'
2012-09-02 16:53:31 +08:00
Xinchen Hui
069c448623
folder
2012-09-02 16:52:53 +08:00
Nikita Popov
dffffdeb3d
Fix leak when yielding array as key
...
The code was copy-pasted and I forgot to change OP1 to OP2 in that one
place.
2012-09-01 20:31:40 +02:00
Gustavo Lopes
53351d087d
Merge branch 'generators'
...
* generators: (70 commits)
Fix typos
Fix segfault when traversing a by-ref generator twice
Make sure that exception is thrown on rewind() after closing too
Remove implementation stubs for yield delegation
Fix several issues and allow rewind only at/before first yield
Run finally if generator is closed before finishing
Finally with return now works in generators too
Add dedicated opcode for returns from a generator
Disallow serialization and unserialization
Fix zts build (typo)
Drop Generator::close() method
Forgot to add test
Support trivial finally in generators (no yield, no return)
Fix implementation of Iterator interface
Add T_YIELD in tokenizer_data.c
Throw error also for return occuring before yield
Fix throwing of exceptions within a generator
Remove reference restrictions from foreach
Require parenthesis around yield expressions
Add some more tests
...
2012-09-01 19:07:20 +02:00
Xinchen Hui
b5d2c3174f
Merge branch 'PHP-5.4'
2012-08-31 11:25:21 +08:00
Xinchen Hui
66fad45724
Merge branch 'PHP-5.3' into PHP-5.4
2012-08-31 11:24:10 +08:00
Xinchen Hui
5dc2cef370
Fixed bug #62976 (Notice: could not be converted to int when comparing some builtin classes)
2012-08-31 11:22:43 +08:00
Nikita Popov
dbc7809b17
Fix typos
2012-08-29 20:49:14 +02:00
Nikita Popov
bef79588d5
Fix segfault when traversing a by-ref generator twice
...
If you try to traverse an already closed generator an exception will now be
thrown.
Furthermore this changes the error for traversing a by-val generator by-ref
from an E_ERROR to an Exception.
2012-08-29 20:46:56 +02:00
Nikita Popov
cc07038fa9
Make sure that exception is thrown on rewind() after closing too
2012-08-29 20:31:34 +02:00
Lars Strojny
6b1073a3a7
Bug #62956 : fixing private method signature validation
...
In inheritance, if both methods are private, don not enforce the same
signature.
2012-08-28 14:10:25 +02:00
Lars Strojny
f82dd2c774
Bug #62956 : fixing private method signature validation
...
In inheritance, if both methods are private, don not enforce the same
signature.
2012-08-28 14:06:18 +02:00
Xinchen Hui
cec1786911
Fixed bug #62938 (zend_do_bind_catch() used without declaration)
2012-08-27 10:23:23 +08:00
Lars Strojny
8788cddfb3
Prefix RESULT_CODE enum with ZEND_
2012-08-26 20:06:47 +02:00
Gustavo Lopes
3d0857938d
zend_binary_strncasecmp_l used w/out declaration
2012-08-26 19:44:05 +02:00
Stuart Langley
e3ef84c59b
Strong types for the result codes SUCCESS & FAILURE. These are common
...
symbol names and using #defines can cause conflicts.
2012-08-26 17:15:27 +02:00
Nikita Popov
d60e3c6ef5
Merge remote-tracking branch 'php-src/master' into addGeneratorsSupport
...
Conflicts:
Zend/zend_language_parser.y
Zend/zend_vm_execute.skl
2012-08-26 13:03:55 +02:00
Xinchen Hui
14c88ff82c
Merge branch 'PHP-5.4'
2012-08-26 18:28:58 +08:00
Xinchen Hui
e24194d157
Add test for #62907
2012-08-26 18:28:15 +08:00
Xinchen Hui
5ebbdecfea
Fixed bug #62930 , and more tests
2012-08-26 13:05:33 +08:00
Xinchen Hui
c6a5d192c8
tabs
2012-08-26 12:27:10 +08:00
Xinchen Hui
7c60aeef85
Fixed bug #62931 & #62932
2012-08-26 11:37:05 +08:00
Nikita Popov
bd70d15588
Remove implementation stubs for yield delegation
...
I decided to leave out yield delegation for an initial proposal, so remove
the stubs for it too.
2012-08-25 19:03:23 +02:00
Nikita Popov
f53225a99e
Fix several issues and allow rewind only at/before first yield
...
* Trying to resume a generator while it is already running now throws a
fatal error.
* Trying to use yield in finally while the generator is being force-closed
(by GC) throws a fatal error.
* Rewinding after the first yield now throws an Exception
2012-08-25 17:40:08 +02:00
Xinchen Hui
35951d4be0
Support list in foreach
...
RFC: https://wiki.php.net/rfc/foreachlist
2012-08-25 22:23:57 +08:00
Xinchen Hui
e888d48d9b
Merge branch 'PHP-5.4'
2012-08-25 21:55:36 +08:00
Xinchen Hui
383eafe482
Merge branch 'PHP-5.3' into PHP-5.4
2012-08-25 21:50:08 +08:00
Xinchen Hui
d92a89fe52
Fixed bug (segfault while build with zts and GOTO vm-kind)
2012-08-25 21:47:53 +08:00
Xinchen Hui
326aa08753
Prefer no finally block for most situations
2012-08-25 21:14:51 +08:00
Nikita Popov
4d8edda341
Run finally if generator is closed before finishing
2012-08-24 19:10:09 +02:00
Nikita Popov
7cdf6367a5
Finally with return now works in generators too
2012-08-24 13:52:16 +02:00
Nikita Popov
68c1e1cfe9
Add dedicated opcode for returns from a generator
...
Generators don't have a return value, so it doesn't make sense to have
a shared implementation here.
2012-08-24 13:51:39 +02:00
Nikita Popov
6517ed0215
Merge remote-tracking branch 'php-src/master' into addGeneratorsSupport
...
Conflicts:
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
2012-08-24 13:29:40 +02:00
Xinchen Hui
3ef3b80cdd
Merge branch 'PHP-5.4'
2012-08-23 16:13:57 +08:00
Xinchen Hui
87785c7d5a
tabs
2012-08-23 16:13:34 +08:00
Xinchen Hui
9b2ca07223
Merge branch 'PHP-5.4'
2012-08-23 16:07:13 +08:00
Xinchen Hui
d39aa984ad
Refix #62358 , previous has side-affect
2012-08-23 16:06:17 +08:00
Xinchen Hui
b8800d1701
Merge branch 'PHP-5.4'
2012-08-23 15:45:06 +08:00
Xinchen Hui
6d1bebfcb0
Fixed bug #62358 (Segfault when using traits a lot)
2012-08-23 15:41:49 +08:00
Felipe Pena
596e855feb
Merge branch 'PHP-5.4'
...
* PHP-5.4:
- Fixed bug #62892 (ReflectionClass::getTraitAliases crashes on importing trait methods as private)
2012-08-22 10:51:06 -03:00
Felipe Pena
7a56ac00a0
- Fixed bug #62892 (ReflectionClass::getTraitAliases crashes on importing trait methods as private)
2012-08-22 10:50:50 -03:00
Xinchen Hui
3938e5d616
Merge branch 'finally'
2012-08-22 18:33:37 +08:00
Xinchen Hui
60a29791e4
Fixed bug that jmp in try block jmp over finally block
...
Refactor the implemention, make codes clear
2012-08-22 18:32:03 +08:00
Xinchen Hui
3d4f91da4b
Merge branch 'master' into finally
2012-08-22 18:12:11 +08:00
Anatoliy Belsky
dac25a0d50
Merge branch 'PHP-5.4'
...
* PHP-5.4:
Fixed bug #62313 Zend\tests\errmsg_021.phpt fails
2012-08-22 11:45:32 +02:00
Anatoliy Belsky
22f55d5665
Fixed bug #62313 Zend\tests\errmsg_021.phpt fails
2012-08-22 11:43:12 +02:00
Xinchen Hui
703a4e390d
stash
2012-08-22 13:51:44 +08:00
Sebastian Bergmann
0fa40bb999
Bump version.
2012-08-21 13:37:18 +02:00
Nikita Popov
f45a0f31c8
Disallow serialization and unserialization
2012-08-20 16:01:16 +02:00
Nikita Popov
1823b16fa1
Merge remote-tracking branch 'php-src/master' into addGeneratorsSupport
...
Merging master to fix Windows build
Conflicts:
Zend/zend_language_scanner.c
Zend/zend_language_scanner_defs.h
Zend/zend_vm_def.h
2012-08-20 13:37:53 +02:00
Nikita Popov
9003cd1425
Fix zts build (typo)
2012-08-20 13:28:36 +02:00
Nikita Popov
05f10480c5
Drop Generator::close() method
2012-08-20 12:53:18 +02:00
Stanislav Malyshev
3336e1e78c
Merge branch 'pull-request/31'
...
* pull-request/31:
Fix lexing of nested heredoc strings in token_get_all()
2012-08-19 21:43:04 -07:00
Felipe Pena
a025abe388
Merge branch 'PHP-5.4'
...
* PHP-5.4:
- Value stored to var is never used
2012-08-19 12:44:54 -03:00
Felipe Pena
7a72405171
Merge branch 'PHP-5.3' into PHP-5.4
...
* PHP-5.3:
- Value stored to var is never used
2012-08-19 12:44:49 -03:00
Felipe Pena
001966c754
- Value stored to var is never used
2012-08-19 12:44:44 -03:00
Felipe Pena
b2a74b5bdb
- Remove unused vars
2012-08-18 11:28:00 -03:00
Xinchen Hui
57e7c7bd49
tab
2012-08-18 11:57:53 +08:00
Xinchen Hui
72b9b8f380
Make the codes clearer, and also check continue statement
2012-08-18 11:44:09 +08:00
Xinchen Hui
f2a8912e61
Refactor examing of jumping out of finally block
2012-08-18 00:16:34 +08:00
Xinchen Hui
2449365238
Fixed context info in error message
2012-08-17 21:18:20 +08:00
Xinchen Hui
acd402d4e7
typo
2012-08-16 23:01:58 +08:00
Xinchen Hui
0312d0a262
Prevents goto
out of a finally block
2012-08-16 18:17:26 +08:00
Xinchen Hui
154fe7486d
typo
2012-08-14 14:17:27 +08:00
Xinchen Hui
f82be0550b
add test for alone try block, and update test scripts summary
2012-08-14 14:08:38 +08:00
Xinchen Hui
c64f4e736c
Add functions declarations, use tabs
2012-08-14 08:59:40 +08:00
Anatoliy Belsky
baea290b6c
fix windows build
2012-08-13 19:44:45 +02:00
Nikita Popov
7195a5b376
Forgot to add test
2012-08-13 19:24:44 +02:00
Nikita Popov
ae716939eb
Support trivial finally in generators (no yield, no return)
...
The finally clause is now properly run when an exception is thrown in the
try-block. It is not yet run on `return` and also not run when the generator
is claused within a try block.
I'll add those two things as soon as laruence refactored the finally code.
2012-08-13 17:22:21 +02:00
Nikita Popov
f4ce364628
Merge remote-tracking branch 'php-src/master' into addGeneratorsSupport
...
This is just an intial merge. It does not yet make generators and finally
work together.
Conflicts:
Zend/zend_language_scanner.c
Zend/zend_language_scanner_defs.h
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
Zend/zend_vm_execute.skl
Zend/zend_vm_opcodes.h
2012-08-13 16:54:53 +02:00
Xinchen Hui
80d5ae3cea
Implemented 'finally' keywords for php
...
RFC: https://wiki.php.net/rfc/finally
FR: https://bugs.php.net/bug.php?id=32100
and I have got some improvment ideas(performance), will implemented
later. thanks
2012-08-13 21:48:39 +08:00
Xinchen Hui
253760bb6b
Merge branch 'PHP-5.4'
2012-08-12 21:00:01 +08:00
Xinchen Hui
dda0565b53
Merge branch 'PHP-5.3' into PHP-5.4
2012-08-12 20:58:45 +08:00
Xinchen Hui
4970926e45
Fixed bug #62763 (register_shutdown_function and extending class)
2012-08-12 20:58:09 +08:00
Xinchen Hui
9787e7af44
Merge branch 'PHP-5.4'
2012-08-12 12:02:17 +08:00
Xinchen Hui
75f6c8d42c
Revert "zend_make_printable_zval choses cast_object over __toString"
...
This reverts commit a5dfd41494
.
2012-08-12 12:02:06 +08:00
Xinchen Hui
32c1c5a19f
Revert "Test for bug 62328"
...
This reverts commit 222ab9da1a
.
2012-08-12 12:02:02 +08:00
Xinchen Hui
7b307fb930
Fixed bug #62328 (implementing __toString and a cast to string fails)
...
__toString should has a high priority
2012-08-12 11:50:28 +08:00
Xinchen Hui
d11fa44d62
Merge branch 'Bug-62328' of https://github.com/leight/php-src
2012-08-12 10:40:41 +08:00
Leigh
222ab9da1a
Test for bug 62328
2012-08-10 11:43:53 +01:00
Leigh
a5dfd41494
zend_make_printable_zval choses cast_object over __toString
...
https://bugs.php.net/bug.php?id=62328
Added a check to see if the object implements a __toString magic
method. This should be called instead of the cast_object method of
built-in classes when defined.
2012-08-10 11:09:25 +01:00
Stanislav Malyshev
04ac5065e0
Merge branch 'PHP-5.4'
...
* PHP-5.4:
Added Bison 2.5.1 to bison_version_list
2012-08-05 20:48:47 -07:00
Ryusuke SEKIYAMA
81c6a060a2
Added Bison 2.5.1 to bison_version_list
2012-08-05 20:48:42 -07:00
Xinchen Hui
ac88d108e6
Merge branch 'PHP-5.4'
2012-08-04 11:29:56 +08:00
Xinchen Hui
d289efb457
Merge branch 'PHP-5.3' into PHP-5.4
...
Conflicts:
Zend/zend_API.h
2012-08-04 11:14:03 +08:00
Xinchen Hui
f4a315fce2
This becomes useless, since we have set that in the INIT macro
2012-08-04 11:03:21 +08:00
Xinchen Hui
03a1fcabf3
Fixed bug #62744 (dangling pointers made by zend_disable_class)
...
the test will be added while commit the fix for #62737
2012-08-04 10:41:26 +08:00
Nuno Lopes
aa8eabddd6
make default_exception_ce and error_exception_ce static
2012-08-02 06:53:09 -04:00
Nuno Lopes
81369bcc20
make default_exception_ce and error_exception_ce static
2012-08-02 11:44:15 +01:00
Xinchen Hui
6c7c2d0c03
Merge branch 'PHP-5.4'
2012-08-02 12:34:15 +08:00
Xinchen Hui
242658c053
Merge branch 'PHP-5.3' into PHP-5.4
2012-08-02 12:32:44 +08:00
Xinchen Hui
433089ccb4
Fixed bug #62716 (munmap() is called with the incorrect length)
2012-08-02 12:30:07 +08:00
Xinchen Hui
b412df1e67
Merge branch 'PHP-5.4'
2012-07-31 10:52:26 +08:00
Xinchen Hui
572d6437bc
expect pass for 5.4
2012-07-31 10:51:18 +08:00
Xinchen Hui
c730329bb0
Merge branch 'PHP-5.3' into PHP-5.4
2012-07-31 10:51:04 +08:00
Xinchen Hui
645f84e41b
Test for bug #62680
2012-07-31 10:49:13 +08:00
Xinchen Hui
32c05f772e
Merge branch 'PHP-5.4'
...
* PHP-5.4:
Skip test while zend_mm is disabled
2012-07-29 12:20:05 +08:00
Xinchen Hui
11e84180ef
Merge branch 'PHP-5.3' into PHP-5.4
...
* PHP-5.3:
Skip test while zend_mm is disabled
2012-07-29 12:19:28 +08:00
Xinchen Hui
015ee3b2c8
Skip test while zend_mm is disabled
2012-07-29 12:17:43 +08:00
Xinchen Hui
b477a84026
Fixed bug #60194 for eavl
...
same reason here
2012-07-28 17:00:05 +08:00
Xinchen Hui
ef7286a42f
Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK with run-test.php)
...
It's not a big deal, just because lexer will read the char after cursor before leaving
2012-07-28 00:50:45 +08:00
Gustavo André dos Santos Lopes
594397993d
Fix bug #62651 : source level BC break
...
Break for C++ extensions that don't wrap the includes of PHP libraries
in extern "C" {.
2012-07-27 01:39:06 +02:00
Gustavo André dos Santos Lopes
ccffec74d0
Fix bug #62651 : source level BC break
...
Break for C++ extensions that don't wrap the includes of PHP libraries
in extern "C" {.
2012-07-26 23:37:02 +02:00
Nikita Popov
268740d984
Fix implementation of Iterator interface
...
It looks like you have to implement the Iterator interface *before*
assigning get_iterator. Otherwise the structure for user iterators isn't
correctly zeroed out.
Additionaly I'm setting class_entry->iterator_funcs.funcs now. Not sure if
this is strictly necessary, but better safe than sorry ;)
2012-07-26 17:13:25 +02:00
Xinchen Hui
80497ea7df
Merge branch 'PHP-5.4'
2012-07-26 13:58:01 +08:00
Xinchen Hui
302ad0d648
Fix test, committed in wrong folder
2012-07-26 13:57:04 +08:00
Xinchen Hui
eae0610042
Fixed bug #62653 : (unset($array[$float]) causes a crash)
...
the reason why jpauli and I can not reproduce is (it's silly):
I typo "USE_ZEND_ALLOC *&&* valgrind" at the first time, then I always ctrl+r
and jpauli copied my command from the pastbin :)
thanks
2012-07-26 13:53:06 +08:00
Xinchen Hui
07c61c2fdb
Merge branch 'PHP-5.4'
2012-07-26 12:44:51 +08:00
Xinchen Hui
b4b3a65f55
Fixed bug #62661 (Interactive php-cli crashes if include() is used in auto_prepend_file)
2012-07-26 12:40:47 +08:00
Xinchen Hui
ba568aaebb
Fixed invalid read in CONST_STRING dereference, reported by Nikic
2012-07-26 00:29:39 +08:00
Nikita Popov
134089372b
Throw error also for return occuring before yield
...
Previously only an error was thrown when return occured after yield. Also
returns before the first yield would fail for by-ref generators.
Now the error message is handled in pass_two, so all returns are checked.
2012-07-22 20:11:09 +02:00
Nikita Popov
94b2ccae9c
Fix throwing of exceptions within a generator
...
If a generator threw an exception and was iterated using foreach (i.e. not
manually) an infinite loop was triggered. The reason was that the exception
was not properly rethrown using zend_throw_exception_internal.
2012-07-22 17:46:46 +02:00
Nikita Popov
de80e3ce4b
Remove reference restrictions from foreach
...
foreach only allowed variables to be traversed by reference. This never
really made sense because
a) Expressions like array(&$a, &$b) can be meaningfully iterated by-ref
b) Function calls can return by-ref (so they can also be meaningfully
iterated)
c) Iterators could at least in theory also be iterated by-ref (not
sure if any iterator makes use of this)
With by-ref generators the restriction makes even less sense, so I removed
it altogether.
2012-07-22 14:33:25 +02:00
Nikita Popov
80748631aa
Require parenthesis around yield expressions
...
If yield is used in an expression context parenthesis are now required.
This ensures that the code is unambiguos.
Yield statements can still be used without parenthesis (which should be
the most common case).
Also yield expressions without value can be used without parenthesis,
too (this should be the most common case for coroutines).
If the yield expression is used in a context where parenthesis are required
anyway, no additional parenthesis have to be inserted.
Examples:
// Statements don't need parenthesis
yield $foo;
yield $foo => $bar;
// Yield without value doesn't need parenthesis either
$data = yield;
// Parentheses don't have to be duplicated
foo(yield $bar);
if (yield $bar) { ... }
// But we have to use parentheses here
$foo = (yield $bar);
This commit also fixes an issue with by-ref passing of $foo[0] like
variables. They previously weren't properly fetched for write.
Additionally this fixes valgrind warnings which were caused by access to
uninitialized memory in zend_is_function_or_method_call().
2012-07-22 01:22:22 +02:00
Nikita Popov
1f70a4c5fe
Add some more tests
2012-07-20 17:40:04 +02:00
Nikita Popov
612c2490b7
Move a variable
2012-07-20 17:38:39 +02:00
Nikita Popov
c9709bfbd7
Remove asterix modifier (*) for generators
...
Generators are now automatically detected by the presence of a `yield`
expression in their body.
This removes the ZEND_SUSPEND_AND_RETURN_GENERATOR opcode. Instead
additional checks for ZEND_ACC_GENERATOR are added to the fcall_common
helper and zend_call_function.
This also adds a new function zend_generator_create_zval, which handles
the actual creation of the generator zval from an op array.
I feel like I should deglobalize the zend_create_execute_data_from_op_array
code a bit. It currently changes EG(current_execute_data) and
EG(opline_ptr) which is somewhat confusing (given the name).
2012-07-20 16:09:06 +02:00
Gustavo André dos Santos Lopes
13f1d53b68
Expose zend_parse_arg() as zend_parse_parameter()
...
Sometimes, one wants to accept several types for a given parameter. zpp
has special functionality for detecting the NULL type, since the NULL
type is frequently used to skip parameters.
However, supporting several types is otherwise very tedious. There are
many cases where this situation arises -- for instance one may want
to accept an arbitrary number of integer and expect them in an array,
but allow a bare integer too; one may want to accept something that
will be used as an array key (which can be either and int or a string);
one may want to accept integer and double numbers. A search for IS_LONG
reveals many situations where this need arises.
The usual solution is to fetch the argument with 'z'/'Z', check its
type, and then convert the argument, e.g. with convert_to_long_ex().
As explain in the last commit, this has different behavior and
generates inconsistency.
Another -- even more flawed strategy --, is to try zpp with a specific
format, forcing it quiet, and if it fails retrying with another form.
But because zpp changes the arguments directly in the stack (for
instance, using "l" converts the zval in the stack to IS_LONG), the
arguments may look different after the first zpp, leaving subtle bugs.
This commit also allows more complex scenarios, for instance where the
expected type of one parameter depends on other parameters.
2012-07-18 23:30:03 +02:00
Gustavo André dos Santos Lopes
980dc7111b
zend_parse_parameters: allow ! for non pointers
...
This commit allows getting information about whether a certain value
was a NULL value by using the ! modifier together with the l/L, d and
b.
Example:
long l;
zend_bool is_null;
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l!", &l, &is_null)
For the specifiers l/L, d and b, NULL values are reported as 0, 0., or
false. But sometimes one wants to distinguish NULL from those other
values -- for instance, to give NULL the same effect as the argument
not having been passed.
The usual way this problem is handled is by fetching the parameter
with 'z' or 'Z', check if it is NULL and if not use
convert_to_long_ex()/convert_to_double_ex(), etc. Unfortunately, this
is not equivalent. convert_to_long_ex() does a cast, while zpp() is
stricter. For instance, zpp will not accept 'foo' for a long argument,
and it will emit a notice when encountering '5foo'.
In fact, the only way to otherwise zpp semantics (without duplicating
its logic) is to fetch the raw zval from the stack and check whether
it's NULL (with zpp itself or its relatives) and then run zpp again.
That is not an elegant solution.
2012-07-18 23:30:03 +02:00
Nikita Popov
85f077cea1
Add support by yielding by-reference
2012-07-17 13:29:56 +02:00
Stanislav Malyshev
efdb7ce4b0
improve code in zend_operators
2012-07-14 21:06:40 -07:00
Stanislav Malyshev
bd340b7296
add NEWS/UPGRADING
2012-07-14 15:03:51 -07:00
Stanislav Malyshev
c164e6b5a3
add test
2012-07-14 14:50:50 -07:00
Stanislav Malyshev
582514d4c7
fix for bug#18556 - use simple tolower() function for internal things
2012-07-14 14:50:50 -07:00
Nuno Lopes
b2b018d5f7
appease MSVC (doesnt like unary minus of unsigned ints)
2012-07-08 15:28:29 -04:00
Nuno Lopes
5910d8d4f4
appease MSVC (doesnt like unary minus of unsigned ints)
2012-07-08 15:21:18 -04:00
Nuno Lopes
e6d9cd983b
appease MSVC (doesnt like unary minus of unsigned ints)
2012-07-08 15:19:41 -04:00