Skip to content

Commit

Permalink
Merge branch 'PHP-5.6'
Browse files Browse the repository at this point in the history
Conflicts:
	NEWS
	UPGRADING
  • Loading branch information
faizshukri committed Dec 4, 2013
2 parents dd7c33d + 97909ef commit 406d5a5
Show file tree
Hide file tree
Showing 92 changed files with 2,781 additions and 1,670 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<<<<<<< HEAD
?? ??? 20??, PHP 5.7.0

<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>
2 changes: 1 addition & 1 deletion Zend/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ libZend_la_SOURCES=\
zend_default_classes.c \
zend_iterators.c zend_interfaces.c zend_exceptions.c \
zend_strtod.c zend_closures.c zend_float.c zend_string.c zend_signal.c \
zend_generators.c zend_virtual_cwd.c
zend_generators.c zend_virtual_cwd.c zend_ast.c

libZend_la_LDFLAGS =
libZend_la_LIBADD = @ZEND_EXTRA_LIBS@
Expand Down
4 changes: 4 additions & 0 deletions Zend/Zend.dsp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Zend/ZendTS.dsp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Zend/tests/bug65969.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--TEST--
Bug #65969 (Chain assignment with T_LIST failure)
--FILE--
<?php
$obj = new stdClass;
list($a,$b) = $obj->prop = [1,2];
var_dump($a,$b);
--EXPECT--
int(1)
int(2)
13 changes: 13 additions & 0 deletions Zend/tests/class_properties_dynamic.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
Class Property Expressions
--FILE--
<?php
class Foo {
const BAR = 1 << 0;
const BAZ = 1 << 1;
public $bar = self::BAR | self::BAZ;
}
echo (new Foo)->bar;
?>
--EXPECTF--
3
20 changes: 20 additions & 0 deletions Zend/tests/class_properties_static.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
Static Class Property Expressions
--FILE--
<?php
class Foo {
public $b1 = 1 + 1;
public $b2 = 1 << 2;
public $b3 = "foo " . " bar " . " baz";
}
$f = new Foo;
var_dump(
$f->b1,
$f->b2,
$f->b3
);
?>
--EXPECT--
int(2)
int(4)
string(13) "foo bar baz"
5 changes: 4 additions & 1 deletion Zend/tests/closure_018.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ var_dump($x = $test->test($y));
var_dump($y, $x);

?>
--EXPECT--
--EXPECTF--
Notice: Only variable references should be returned by reference in %sclosure_018.php on line 7
int(4)

Notice: Only variable references should be returned by reference in %sclosure_018.php on line 7
int(16)
int(16)
int(16)
3 changes: 3 additions & 0 deletions Zend/tests/closure_019.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ test();

?>
--EXPECTF--
Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
int(9)

Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
int(81)

Fatal error: Cannot pass parameter 1 by reference in %s on line %d
91 changes: 91 additions & 0 deletions Zend/tests/constant_expressions.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
--TEST--
Constant Expressions
--FILE--
<?php
const T_1 = 1 << 1;
const T_2 = 1 / 2;
const T_3 = 1.5 + 1.5;
const T_4 = "foo" . "bar";
const T_5 = (1.5 + 1.5) * 2;
const T_6 = "foo" . 2 . 3 . 4.0;
const T_7 = __LINE__;
const T_8 = <<<ENDOFSTRING
This is a test string
ENDOFSTRING;
const T_9 = ~-1;
const T_10 = (-1?:1) + (0?2:3);
const T_11 = 1 && 0;
const T_12 = 1 and 1;
const T_13 = 0 || 0;
const T_14 = 1 or 0;
const T_15 = 1 xor 1;
const T_16 = 1 xor 0;
const T_17 = 1 < 0;
const T_18 = 0 <= 0;
const T_19 = 1 > 0;
const T_20 = 1 >= 0;
const T_21 = 1 === 1;
const T_22 = 1 !== 1;
const T_23 = 0 != "0";
const T_24 = 1 == "1";

// Test order of operations
const T_25 = 1 + 2 * 3;

// Test for memory leaks
const T_26 = "1" + 2 + "3";

var_dump(T_1);
var_dump(T_2);
var_dump(T_3);
var_dump(T_4);
var_dump(T_5);
var_dump(T_6);
var_dump(T_7);
var_dump(T_8);
var_dump(T_9);
var_dump(T_10);
var_dump(T_11);
var_dump(T_12);
var_dump(T_13);
var_dump(T_14);
var_dump(T_15);
var_dump(T_16);
var_dump(T_17);
var_dump(T_18);
var_dump(T_19);
var_dump(T_20);
var_dump(T_21);
var_dump(T_22);
var_dump(T_23);
var_dump(T_24);
var_dump(T_25);
var_dump(T_26);
?>
--EXPECT--
int(2)
float(0.5)
float(3)
string(6) "foobar"
float(6)
string(6) "foo234"
int(8)
string(21) "This is a test string"
int(0)
int(2)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(true)
bool(true)
bool(true)
bool(false)
bool(false)
bool(true)
int(7)
int(6)
11 changes: 11 additions & 0 deletions Zend/tests/constant_expressions_dynamic.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--TEST--
Dynamic Constant Expressions
--FILE--
<?php
const FOO = 1;
const BAR = FOO | 2;

echo BAR;
?>
--EXPECTF--
3
17 changes: 17 additions & 0 deletions Zend/tests/function_arguments_003.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
Function Argument Parsing #003
--FILE--
<?php
const a = 10;

function t1($a = 1 + 1, $b = 1 << 2, $c = "foo" . "bar", $d = a * 10) {
var_dump($a, $b, $c, $d);
}

t1();
?>
--EXPECT--
int(2)
int(4)
string(6) "foobar"
int(100)
17 changes: 17 additions & 0 deletions Zend/tests/generators/bug66041.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
Bug #66041: list() fails to unpack yielded ArrayAccess object
--FILE--
<?php
function dumpElement() {
list($value) = yield;
var_dump($value);
};

$fixedArray = new SplFixedArray(1);
$fixedArray[0] = 'the element';

$generator = dumpElement();
$generator->send($fixedArray);
?>
--EXPECT--
string(11) "the element"
2 changes: 2 additions & 0 deletions Zend/tests/generators/throw_caught.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Generator::throw() where the exception is caught in the generator
<?php

function gen() {
echo "before yield\n";
try {
yield;
} catch (RuntimeException $e) {
Expand All @@ -18,6 +19,7 @@ var_dump($gen->throw(new RuntimeException('Test')));

?>
--EXPECTF--
before yield
exception 'RuntimeException' with message 'Test' in %s:%d
Stack trace:
#0 {main}
Expand Down
2 changes: 2 additions & 0 deletions Zend/tests/generators/throw_rethrow.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Generator::throw() where the generator throws a different exception
<?php

function gen() {
echo "before yield\n";
try {
yield;
} catch (RuntimeException $e) {
Expand All @@ -18,6 +19,7 @@ var_dump($gen->throw(new RuntimeException('throw')));

?>
--EXPECTF--
before yield
Caught: exception 'RuntimeException' with message 'throw' in %s:%d
Stack trace:
#0 {main}
Expand Down
29 changes: 29 additions & 0 deletions Zend/tests/static_variable.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--TEST--
Static Variable Expressions
--FILE--
<?php
const bar = 2, baz = bar + 1;

function foo() {
static $a = 1 + 1;
static $b = [bar => 1 + 1, baz * 2 => 1 << 2];
static $c = [1 => bar, 3 => baz];
var_dump($a, $b, $c);
}

foo();
?>
--EXPECT--
int(2)
array(2) {
[2]=>
int(2)
[6]=>
int(4)
}
array(2) {
[1]=>
int(2)
[3]=>
int(3)
}
9 changes: 7 additions & 2 deletions Zend/zend.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ typedef struct _zend_object {
} zend_object;

#include "zend_object_handlers.h"
#include "zend_ast.h"

typedef union _zvalue_value {
long lval; /* long value */
Expand All @@ -327,6 +328,7 @@ typedef union _zvalue_value {
} str;
HashTable *ht; /* hash table value */
zend_object_value obj;
zend_ast *ast;
} zvalue_value;

struct _zval_struct {
Expand Down Expand Up @@ -587,7 +589,8 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length);
#define IS_RESOURCE 7
#define IS_CONSTANT 8
#define IS_CONSTANT_ARRAY 9
#define IS_CALLABLE 10
#define IS_CONSTANT_AST 10
#define IS_CALLABLE 11

/* Ugly hack to support constants as static array indices */
#define IS_CONSTANT_TYPE_MASK 0x00f
Expand All @@ -597,6 +600,8 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length);
#define IS_LEXICAL_REF 0x040
#define IS_CONSTANT_IN_NAMESPACE 0x100

#define IS_CONSTANT_TYPE(type) (((type) & IS_CONSTANT_TYPE_MASK) >= IS_CONSTANT && ((type) & IS_CONSTANT_TYPE_MASK) <= IS_CONSTANT_AST)

/* overloaded elements data types */
#define OE_IS_ARRAY (1<<0)
#define OE_IS_OBJECT (1<<1)
Expand Down Expand Up @@ -685,7 +690,7 @@ END_EXTERN_C()
#define ZEND_WRITE_EX(str, str_len) write_func((str), (str_len))
#define ZEND_PUTS(str) zend_write((str), strlen((str)))
#define ZEND_PUTS_EX(str) write_func((str), strlen((str)))
#define ZEND_PUTC(c) zend_write(&(c), 1), (c)
#define ZEND_PUTC(c) zend_write(&(c), 1)

BEGIN_EXTERN_C()
extern ZEND_API int (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
Expand Down
Loading

0 comments on commit 406d5a5

Please sign in to comment.