Commit 5a7c0b1f authored by Ondrej Sury's avatar Ondrej Sury

Imported Upstream version 5.5.0~beta3

parent cf099ba2
......@@ -14,7 +14,7 @@ php_lcov.info: lcov-test
@rm -rf lcov_data/
@$(mkinstalldirs) lcov_data/
@echo
-@files=`find . -name \*.gcda -o -name \*.gcno -o -name \*.da -o -name \*.h | sed -e 's/^\.\///' | sed -e 's/\.gcda//g' -e 's/\.gcno//g' -e 's/\.da//g' | $(EGREP) $(LCOV_INCLUDE) | uniq` ;\
-@files=`find . -name \*.gcda -o -name \*.gcno -o -name \*.da -o -name \*.c -o -name \*.h | sed -e 's/^\.\///' | sed -e 's/\.gcda//g' -e 's/\.gcno//g' -e 's/\.da//g' | $(EGREP) $(LCOV_INCLUDE) | uniq` ;\
for x in $$files; do \
echo -n . ;\
y=`echo $$x | sed -e 's!\.libs/!!'`; \
......
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
11 Apr 2013, PHP 5.5.0 Beta 3
- Core:
. Fixed bug #64578 (debug_backtrace in set_error_handler corrupts zend heap:
segfault). (Laruence)
. Fixed bug #64565 (copy doesn't report failure on partial copy). (Remi)
. Fixed bug #64555 (foreach no longer copies keys if they are interned).
(Nikita Popov)
. Fixed bugs #47675 and #64577 (fd leak on Solaris)
- CURL:
. Added CURL_WRAPPERS_ENABLED constant. (Laruence)
- DateTime
. Fixed bug #54567 (DateTimeZone serialize/unserialize) (Lonny
Kapelushnik, Derick)
. Fixed bug #60774 (DateInterval::format("%a") is always zero when an
interval is created using the createFromDateString method) (Lonny
Kapelushnik, Derick)
- General improvements:
. Drop support for bison < 2.4 when building PHP from GIT source.
(Laruence)
- Fileinfo:
. Upgraded libmagic to 5.14. (Anatol)
28 Mar 2013, PHP 5.5.0 Beta 2
- Core:
. Fixed bug #64544 (Valgrind warnings after using putenv). (Laruence)
. Fixed bug #64515 (Memoryleak when using the same variablename 2times in
function declaration). (Laruence)
. Fixed bug #64503 (Compilation fails with error: conflicting types for
'zendparse'). (Laruence)
. Fixed bug #64239 (Debug backtrace changed behavior since 5.4.10 or 5.4.11).
(Dmitry, Laruence)
. Fixed bug #64523, allow XOR in php.ini. (Dejan Marjanovic, Lars)
- Opcache:
. Fixed bug # 64490 (struct flock undefined on FreeBSD). (Joe Watkins)
......
......@@ -295,6 +295,7 @@ PHP 5.5 UPGRADE NOTES
- cURL:
- Added CURLOPT_SAFE_UPLOAD to be used with curl_setopt().
- Added CURL_WRAPPERS_ENABLED to reflect --with-curlwrappers.
- GD
- Added constants for imageflip:
......
......@@ -4,7 +4,7 @@ dnl This file contains local autoconf functions.
AC_DEFUN([LIBZEND_BISON_CHECK],[
# we only support certain bison versions
bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.6 2.6.1 2.6.2"
bison_version_list="2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7"
# for standalone build of Zend Engine
test -z "$SED" && SED=sed
......
......@@ -2,6 +2,8 @@
Bug #43450 (Memory leak on some functions with implicit object __toString() call)
--SKIPIF--
<?php if (!function_exists('memory_get_usage')) die('memory_get_usage() not installed'); ?>
--INI--
opcache.enable_cli=0
--FILE--
<?php
error_reporting(E_ALL|E_STRICT);
......
......@@ -4,6 +4,7 @@ test of larger than 8kb text file being parsed by require statement
<?php
file_put_contents('test.php',str_repeat('passed, ',1024));
require('test.php');
unlink('test.php');
?>
--EXPECT--
passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed,
--TEST--
Bug #64555: Array key within interned string gets wrong hash value
--FILE--
<?php
class Foo {
protected $unsetme = 1;
protected $keepme = 2;
public function test() {
$a = get_object_vars($this);
foreach ($a as $k => $v) {
if ($k == 'unsetme') {
echo "Unsetting: $k\n";
unset($a[$k]);
} else if ($k == 'keepme') {
echo "Changing: $k\n";
$a[$k] = 42;
$a['keepme'] = 43;
}
}
var_dump($a, array_keys($a));
}
}
$f = new Foo;
$f->test();
?>
--EXPECT--
Unsetting: unsetme
Changing: keepme
array(1) {
["keepme"]=>
int(43)
}
array(1) {
[0]=>
string(6) "keepme"
}
--TEST--
Bug #64578 (debug_backtrace in set_error_handler corrupts zend heap: segfault)
--FILE--
<?php
set_error_handler(function($no, $err) { var_dump($err); });
function x($s) { $s['a'] = 1; };
$y = '1';
x($y);
print_r($y);
--EXPECTF--
string(25) "Illegal string offset 'a'"
1
--TEST--
Generators can be cloned
Generators cannot be cloned
--FILE--
<?php
function firstN($end) {
for ($i = 0; $i < $end; ++$i) {
yield $i;
}
function gen() {
yield;
}
$g1 = firstN(5);
var_dump($g1->current());
$g1->next();
$g2 = clone $g1;
var_dump($g2->current());
$g2->next();
var_dump($g2->current());
var_dump($g1->current());
$g1->next();
var_dump($g1->current());
$gen = gen();
clone $gen;
?>
--EXPECT--
int(0)
int(1)
int(2)
int(1)
int(2)
--EXPECTF--
Fatal error: Trying to clone an uncloneable object of class Generator in %s on line %d
--TEST--
Cloning a generator after an object method was called
--FILE--
<?php
class A { public function b() { } }
function gen() {
$a = new A;
$a->b();
yield;
}
$g1 = gen();
$g1->rewind();
$g2 = clone $g1;
echo "Done";
--EXPECT--
Done
--TEST--
Cloning a generator with a foreach loop properly adds a ref for the loop var
--FILE--
<?php
function gen() {
foreach ([1, 2, 3] as $i) {
yield $i;
}
}
$g1 = gen();
var_dump($g1->current());
$g2 = clone $g1;
var_dump($g2->current());
$g1->next();
$g2->next();
var_dump($g1->current());
var_dump($g2->current());
unset($g1);
$g2->next();
var_dump($g2->current());
?>
--EXPECT--
int(1)
int(1)
int(2)
int(2)
int(3)
--TEST--
Tests cloning a generator with properties
--FILE--
<?php
function gen() { yield; }
$g1 = gen();
$g1->prop = 'val';
$g2 = clone $g1;
unset($g1);
var_dump($g2->prop);
?>
--EXPECT--
string(3) "val"
--TEST--
A generator with an active stack can be cloned
--FILE--
<?php
function gen() {
var_dump(str_repeat("x", yield));
}
$g1 = gen();
$g1->rewind();
$g2 = clone $g1;
unset($g1);
$g2->send(10);
?>
--EXPECT--
string(10) "xxxxxxxxxx"
--TEST--
A generator using a symbol table can be cloned
--FILE--
<?php
function gen() {
// force compiled variable for $foo
$foo = 'foo';
// force symbol table
extract(['foo' => 'bar']);
// interrupt
yield;
var_dump($foo);
}
$g1 = gen();
$g1->rewind();
$g2 = clone $g1;
unset($g1);
$g2->next();
?>
--EXPECT--
string(3) "bar"
--TEST--
Cloning a generator method (with $this)
--FILE--
<?php
class Test {
protected $foo;
public function gen() {
$this->foo = 'bar';
yield; // interrupt
var_dump($this->foo);
}
}
$g1 = (new Test)->gen();
$g1->rewind(); // goto yield
$g2 = clone $g1;
unset($g1);
$g2->next();
?>
--EXPECT--
string(3) "bar"
......@@ -26,10 +26,7 @@ $g2 = gen(new B);
$g2->current();
$g1->next();
$g3 = clone $g2;
unset($g2);
$g3->next();
$g2->next();
?>
--EXPECT--
......
......@@ -22,14 +22,6 @@ $gen = gen();
$gen->rewind();
unset($gen);
// test cloning
$g1 = gen();
$g1->rewind();
$g2 = clone $g1;
unset($g1);
$g2->send('bar');
?>
--EXPECT--
foo
bar
......@@ -1809,7 +1809,7 @@ void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC) /*
zend_do_return(NULL, 0 TSRMLS_CC);
pass_two(CG(active_op_array) TSRMLS_CC);
zend_release_labels(TSRMLS_C);
zend_release_labels(0 TSRMLS_CC);
if (CG(active_class_entry)) {
zend_check_magic_method_implementation(CG(active_class_entry), (zend_function*)CG(active_op_array), E_COMPILE_ERROR TSRMLS_CC);
......@@ -2391,13 +2391,14 @@ void zend_do_goto(const znode *label TSRMLS_DC) /* {{{ */
}
/* }}} */
void zend_release_labels(TSRMLS_D) /* {{{ */
void zend_release_labels(int temporary TSRMLS_DC) /* {{{ */
{
if (CG(context).labels) {
zend_hash_destroy(CG(context).labels);
FREE_HASHTABLE(CG(context).labels);
CG(context).labels = NULL;
}
if (!zend_stack_is_empty(&CG(context_stack))) {
if (!temporary && !zend_stack_is_empty(&CG(context_stack))) {
zend_compiler_context *ctx;
zend_stack_top(&CG(context_stack), (void**)&ctx);
......
......@@ -643,7 +643,7 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static
void zend_do_label(znode *label TSRMLS_DC);
void zend_do_goto(const znode *label TSRMLS_DC);
void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 TSRMLS_DC);
void zend_release_labels(TSRMLS_D);
void zend_release_labels(int temporary TSRMLS_DC);
ZEND_API void function_add_ref(zend_function *function);
......
......@@ -898,13 +898,10 @@ static inline zval* zend_assign_to_variable(zval **variable_ptr_ptr, zval *value
} else if (EXPECTED(!PZVAL_IS_REF(value))) {
Z_ADDREF_P(value);
*variable_ptr_ptr = value;
if (EXPECTED(variable_ptr != &EG(uninitialized_zval))) {
GC_REMOVE_ZVAL_FROM_BUFFER(variable_ptr);
zval_dtor(variable_ptr);
efree(variable_ptr);
} else {
Z_DELREF_P(variable_ptr);
}
ZEND_ASSERT(variable_ptr != &EG(uninitialized_zval));
GC_REMOVE_ZVAL_FROM_BUFFER(variable_ptr);
zval_dtor(variable_ptr);
efree(variable_ptr);
return value;
} else {
goto copy_value;
......@@ -1147,6 +1144,10 @@ convert_to_array:
zend_error_noreturn(E_ERROR, "[] operator not supported for strings");
}
if (type != BP_VAR_UNSET) {
SEPARATE_ZVAL_IF_NOT_REF(container_ptr);
}
if (Z_TYPE_P(dim) != IS_LONG) {
switch(Z_TYPE_P(dim)) {
......@@ -1175,9 +1176,6 @@ convert_to_array:
convert_to_long(&tmp);
dim = &tmp;
}
if (type != BP_VAR_UNSET) {
SEPARATE_ZVAL_IF_NOT_REF(container_ptr);
}
container = *container_ptr;
result->str_offset.str = container;
PZVAL_LOCK(container);
......
......@@ -1295,7 +1295,7 @@ void execute_new_code(TSRMLS_D) /* {{{ */
opline++;
}
zend_release_labels(TSRMLS_C);
zend_release_labels(1 TSRMLS_CC);
EG(return_value_ptr_ptr) = NULL;
EG(active_op_array) = CG(active_op_array);
......
......@@ -196,175 +196,6 @@ static void zend_generator_free_storage(zend_generator *generator TSRMLS_DC) /*
}
/* }}} */
static zend_object_value zend_generator_clone(zval *object TSRMLS_DC) /* {{{ */
{
zend_generator *orig = zend_object_store_get_object(object TSRMLS_CC);
zend_object_value clone_val = zend_generator_create(Z_OBJCE_P(object) TSRMLS_CC);
zend_generator *clone = zend_object_store_get_object_by_handle(clone_val.handle TSRMLS_CC);
zend_objects_clone_members(
&clone->std, clone_val, &orig->std, Z_OBJ_HANDLE_P(object) TSRMLS_CC
);
clone->execute_data = orig->execute_data;
clone->largest_used_integer_key = orig->largest_used_integer_key;
clone->flags = orig->flags;
if (orig->execute_data) {
/* Create a few shorter aliases to the old execution data */
zend_execute_data *execute_data = orig->execute_data;
zend_op_array *op_array = execute_data->op_array;
HashTable *symbol_table = execute_data->symbol_table;
zend_execute_data *current_execute_data;
zend_op **opline_ptr;
HashTable *current_symbol_table;
zend_vm_stack current_stack;
zval *current_this;
void **stack_frame, **orig_stack_frame;
/* Create new execution context. We have to back up and restore
* EG(current_execute_data), EG(opline_ptr), EG(active_symbol_table)
* and EG(This) here because the function modifies or uses them */
current_execute_data = EG(current_execute_data);
EG(current_execute_data) = execute_data->prev_execute_data;
opline_ptr = EG(opline_ptr);
current_symbol_table = EG(active_symbol_table);
EG(active_symbol_table) = execute_data->symbol_table;
current_this = EG(This);
EG(This) = NULL;
current_stack = EG(argument_stack);
clone->execute_data = zend_create_execute_data_from_op_array(op_array, 0 TSRMLS_CC);
clone->stack = EG(argument_stack);
EG(argument_stack) = current_stack;
EG(This) = current_this;
EG(active_symbol_table) = current_symbol_table;
EG(current_execute_data) = current_execute_data;
EG(opline_ptr) = opline_ptr;
/* copy */
clone->execute_data->opline = execute_data->opline;
clone->execute_data->function_state = execute_data->function_state;
clone->execute_data->object = execute_data->object;
clone->execute_data->current_scope = execute_data->current_scope;
clone->execute_data->current_called_scope = execute_data->current_called_scope;
clone->execute_data->fast_ret = execute_data->fast_ret;
if (!symbol_table) {
int i;
/* Copy compiled variables */
for (i = 0; i < op_array->last_var; i++) {
if (*EX_CV_NUM(execute_data, i)) {
*EX_CV_NUM(clone->execute_data, i) = (zval **) EX_CV_NUM(clone->execute_data, op_array->last_var + i);
**EX_CV_NUM(clone->execute_data, i) = *(zval **) EX_CV_NUM(execute_data, op_array->last_var + i);
Z_ADDREF_PP(*EX_CV_NUM(clone->execute_data, i));
}
}
} else {
/* Copy symbol table */
ALLOC_HASHTABLE(clone->execute_data->symbol_table);
zend_hash_init(clone->execute_data->symbol_table, zend_hash_num_elements(symbol_table), NULL, ZVAL_PTR_DTOR, 0);
zend_hash_copy(clone->execute_data->symbol_table, symbol_table, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
/* Update zval** pointers for compiled variables */
{
int i;
for (i = 0; i < op_array->last_var; i++) {
if (zend_hash_quick_find(clone->execute_data->symbol_table, op_array->vars[i].name, op_array->vars[i].name_len + 1, op_array->vars[i].hash_value, (void **) EX_CV_NUM(clone->execute_data, i)) == FAILURE) {
*EX_CV_NUM(clone->execute_data, i) = NULL;
}
}
}
}
/* Copy nested-calls stack */
if (execute_data->call) {
clone->execute_data->call = clone->execute_data->call_slots +
(execute_data->call - execute_data->call_slots);
} else {
clone->execute_data->call = NULL;
}
memcpy(clone->execute_data->call_slots, execute_data->call_slots, ZEND_MM_ALIGNED_SIZE(sizeof(call_slot)) * op_array->nested_calls);
if (clone->execute_data->call >= clone->execute_data->call_slots) {
call_slot *call = clone->execute_data->call;
while (call >= clone->execute_data->call_slots) {
if (call->object) {
Z_ADDREF_P(call->object);
}
call--;
}
}
/* Copy the temporary variables */
memcpy(EX_TMP_VAR_NUM(clone->execute_data, op_array->T-1), EX_TMP_VAR_NUM(execute_data, op_array->T-1), ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T);
/* Copy arguments passed on stack */
stack_frame = zend_vm_stack_frame_base(clone->execute_data);
orig_stack_frame = zend_vm_stack_frame_base(execute_data);
clone->stack->top = stack_frame + (orig->stack->top - orig_stack_frame);
if (clone->stack->top != stack_frame) {
memcpy(stack_frame, orig_stack_frame, ZEND_MM_ALIGNED_SIZE(sizeof(zval*)) * (orig->stack->top - orig_stack_frame));
while (clone->stack->top != stack_frame) {
Z_ADDREF_PP((zval**)stack_frame);
stack_frame++;
}
}
/* Add references to loop variables */
{
zend_uint op_num = execute_data->opline - op_array->opcodes;
int i;
for (i = 0; i < op_array->last_brk_cont; ++i) {
zend_brk_cont_element *brk_cont = op_array->brk_cont_array + i;
if (brk_cont->start < 0) {
continue;
} else if (brk_cont->start > op_num) {
break;
} else if (brk_cont->brk > op_num) {
zend_op *brk_opline = op_array->opcodes + brk_cont->brk;
if (brk_opline->opcode == ZEND_SWITCH_FREE) {
temp_variable *var = EX_TMP_VAR(execute_data, brk_opline->op1.var);
Z_ADDREF_P(var->var.ptr);
}
}
}
}
/* Update the send_target to use the temporary variable with the same
* offset as the original generator, but in our temporary variable
* memory segment. */
if (orig->send_target) {
size_t offset = (char *) orig->send_target - (char *)execute_data;
clone->send_target = EX_TMP_VAR(clone->execute_data, offset);
zval_copy_ctor(&clone->send_target->tmp_var);
}
if (execute_data->current_this) {
clone->execute_data->current_this = execute_data->current_this;
Z_ADDREF_P(execute_data->current_this);
}
}
/* The value and key are known not to be references, so simply add refs */
if (orig->value) {
clone->value = orig->value;
Z_ADDREF_P(orig->value);
}
if (orig->key) {
clone->key = orig->key;
Z_ADDREF_P(orig->key);
}
return clone_val;
}
/* }}} */
static zend_object_value zend_generator_create(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
zend_generator *generator;
......@@ -867,7 +698,7 @@ void zend_register_generator_ce(TSRMLS_D) /* {{{ */
memcpy(&zend_generator_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
zend_generator_handlers.get_constructor = zend_generator_get_constructor;
zend_generator_handlers.clone_obj = zend_generator_clone;
zend_generator_handlers.clone_obj = NULL;
}
/* }}} */
......
......@@ -1182,7 +1182,7 @@ ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key,
Z_TYPE_P(key) = IS_NULL;
} else if (p->nKeyLength) {
Z_TYPE_P(key) = IS_STRING;
Z_STRVAL_P(key) = IS_INTERNED(p->arKey) ? (char *) p->arKey : estrndup(p->arKey, p->nKeyLength - 1);
Z_STRVAL_P(key) = estrndup(p->arKey, p->nKeyLength - 1);
Z_STRLEN_P(key) = p->nKeyLength - 1;
} else {
Z_TYPE_P(key) = IS_LONG;
......
This diff is collapsed.
This diff is collapsed.
......@@ -67,6 +67,9 @@ static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
case '&':
i_result = i_op1 & i_op2;
break;
case '^':
i_result = i_op1 ^ i_op2;
break;
case '~':
i_result = ~i_op1;
break;
......@@ -264,7 +267,7 @@ ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int s
%token BOOL_FALSE
%token END_OF_LINE
%token '=' ':' ',' '.' '"' '\'' '^' '+' '-' '/' '*' '%' '$' '~' '<' '>' '?' '@' '{' '}'
%left '|' '&'
%left '|' '&' '^'
%right '~' '!'
%%
......@@ -348,6 +351,7 @@ expr:
var_string_list { $$ = $1; }
| expr '|' expr { zend_ini_do_op('|', &$$, &$1, &$3); }
| expr '&' expr { zend_ini_do_op('&', &$$, &$1, &$3); }
| expr '^' expr { zend_ini_do_op('^', &$$, &$1, &$3); }
| '~' expr { zend_ini_do_op('~', &$$, &$2, NULL); }
| '!' expr { zend_ini_do_op('!', &$$, &$2, NULL); }
| '(' expr ')' { $$ = $2; }
......
This diff is collapsed.
......@@ -340,9 +340,9 @@ NEWLINE ("\r"|"\n"|"\r\n")
TABS_AND_SPACES [ \t]
WHITESPACE [ \t]+
CONSTANT [a-zA-Z_][a-zA-Z0-9_]*
LABEL [^=\n\r\t;|&$~(){}!"\[]+
TOKENS [:,.\[\]"'()|^&+-/*=%$!~<>?@{}]
OPERATORS [&|~()!]
LABEL [^=\n\r\t;&|^$~(){}!"\[]+
TOKENS [:,.\[\]"'()&|^+-/*=%$!~<>?@{}]
OPERATORS [&|^~()!]