mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-21 07:56:37 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12b0189c18 |
No files matched your search
+5
-4
@@ -1,9 +1,10 @@
|
||||
language: php
|
||||
|
||||
branches:
|
||||
except:
|
||||
- /^PHP-5\.3.*/
|
||||
- /^PHP-5\.4.*/
|
||||
php:
|
||||
# We only specify one version so we only get one worker
|
||||
- 5.4
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
script: exit 0
|
||||
@@ -154,15 +154,7 @@ origin <branch>``".
|
||||
11. run: ``./makedist php 5.4.1``, this will export the tree, create configure
|
||||
and build two tarballs (one gz and one bz2).
|
||||
|
||||
12. Commit those two tarballs to web/php-distributions.git, then update the git
|
||||
submodule reference in web/php.git:
|
||||
git submodule init;
|
||||
git submodule update;
|
||||
cd distributions;
|
||||
git pull origin master;
|
||||
cd ..;
|
||||
git commit distributions;
|
||||
git push;
|
||||
12. Commit those two tarballs to Git (php-distributions.git)
|
||||
|
||||
13. Once the release has been tagged, contact the PHP Windows development team
|
||||
(internals-win@lists.php.net) so that Windows binaries can be created. Once
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2013 The PHP Group |
|
||||
| Copyright (c) 1997-2012 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2013 The PHP Group |
|
||||
| Copyright (c) 1997-2012 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2013 The PHP Group |
|
||||
| Copyright (c) 1997-2012 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2013 The PHP Group |
|
||||
| Copyright (c) 1997-2012 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2013 The PHP Group |
|
||||
| Copyright (c) 1997-2012 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2013 The PHP Group |
|
||||
| Copyright (c) 1997-2012 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -15,7 +15,7 @@ $f = fopen("/tmp/blah", "r");
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
fopen(/tmp/blah): failed to open stream: %s (2) in %s:%d
|
||||
fopen(/tmp/blah): failed to open stream: No such file or directory (2) in %s:%d
|
||||
|
||||
Warning: fopen(/tmp/blah): failed to open stream: %s in %s on line %d
|
||||
Warning: fopen(/tmp/blah): failed to open stream: No such file or directory in %s on line %d
|
||||
===DONE===
|
||||
@@ -4,7 +4,6 @@ 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,Line truncated
|
||||
@@ -10,7 +10,7 @@ set_error_handler(function($errno, $errstr, $errfile, $errline){
|
||||
|
||||
require 'notfound.php';
|
||||
--EXPECTF--
|
||||
error(require(notfound.php): failed to open stream: %s)
|
||||
error(require(notfound.php): failed to open stream: No such file or directory)
|
||||
Warning: Uncaught exception 'Exception' with message 'Foo' in %sbug60909_1.php:5
|
||||
Stack trace:
|
||||
#0 %sbug60909_1.php(8): {closure}(2, 'require(notfoun...', '%s', 8, Array)
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
Bug #62343 (Show class_alias In get_declared_classes())
|
||||
--FILE--
|
||||
<?php
|
||||
class a { }
|
||||
class_alias("a", "b");
|
||||
$c = get_declared_classes();
|
||||
var_dump(end($c));
|
||||
var_dump(prev($c));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(1) "b"
|
||||
string(1) "a"
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
Test script to verify that magic methods should be called only once when accessing an unset property.
|
||||
--CREDITS--
|
||||
Marco Pivetta <ocramius@gmail.com>
|
||||
--FILE--
|
||||
<?php
|
||||
class Test {
|
||||
public $publicProperty;
|
||||
protected $protectedProperty;
|
||||
private $privateProperty;
|
||||
|
||||
public function __construct() {
|
||||
unset(
|
||||
$this->publicProperty,
|
||||
$this->protectedProperty,
|
||||
$this->privateProperty
|
||||
);
|
||||
}
|
||||
|
||||
function __get($name) {
|
||||
echo '__get ' . $name . "\n";
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
function __set($name, $value) {
|
||||
echo '__set ' . $name . "\n";
|
||||
$this->$name = $value;
|
||||
}
|
||||
|
||||
function __isset($name) {
|
||||
echo '__isset ' . $name . "\n";
|
||||
return isset($this->$name);
|
||||
}
|
||||
}
|
||||
|
||||
$test = new Test();
|
||||
|
||||
$test->nonExisting;
|
||||
$test->publicProperty;
|
||||
$test->protectedProperty;
|
||||
$test->privateProperty;
|
||||
isset($test->nonExisting);
|
||||
isset($test->publicProperty);
|
||||
isset($test->protectedProperty);
|
||||
isset($test->privateProperty);
|
||||
$test->nonExisting = 'value';
|
||||
$test->publicProperty = 'value';
|
||||
$test->protectedProperty = 'value';
|
||||
$test->privateProperty = 'value';
|
||||
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
__get nonExisting
|
||||
|
||||
Notice: Undefined property: Test::$nonExisting in %s on line %d
|
||||
__get publicProperty
|
||||
|
||||
Notice: Undefined property: Test::$publicProperty in %s on line %d
|
||||
__get protectedProperty
|
||||
|
||||
Notice: Undefined property: Test::$protectedProperty in %s on line %d
|
||||
__get privateProperty
|
||||
|
||||
Notice: Undefined property: Test::$privateProperty in %s on line %d
|
||||
__isset nonExisting
|
||||
__isset publicProperty
|
||||
__isset protectedProperty
|
||||
__isset privateProperty
|
||||
__set nonExisting
|
||||
__set publicProperty
|
||||
__set protectedProperty
|
||||
__set privateProperty
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
--TEST--
|
||||
Bug #63762 - Sigsegv when Exception::$trace is changed by user
|
||||
--FILE--
|
||||
<?php
|
||||
$e = new Exception();
|
||||
|
||||
$ref = new ReflectionProperty($e, 'trace');
|
||||
$ref->setAccessible(TRUE);
|
||||
|
||||
echo "Array of NULL:\n";
|
||||
$ref->setValue($e, array(NULL));
|
||||
|
||||
var_dump($e->getTraceAsString());
|
||||
|
||||
echo "\nArray of empty array:\n";
|
||||
$ref->setValue($e, array(array()));
|
||||
var_dump($e->getTraceAsString());
|
||||
|
||||
echo "\nArray of array of NULL values:\n";
|
||||
$ref->setValue($e, array(array(
|
||||
'file' => NULL,
|
||||
'line' => NULL,
|
||||
'class' => NULL,
|
||||
'type' => NULL,
|
||||
'function' => NULL,
|
||||
'args' => NULL
|
||||
)));
|
||||
var_dump($e->getTraceAsString());
|
||||
?>
|
||||
--EXPECTF--
|
||||
Array of NULL:
|
||||
|
||||
Warning: Expected array for frame 0 in %s on line %d
|
||||
string(9) "#0 {main}"
|
||||
|
||||
Array of empty array:
|
||||
string(36) "#0 [internal function]: ()
|
||||
#1 {main}"
|
||||
|
||||
Array of array of NULL values:
|
||||
|
||||
Warning: Function name is no string in %s on line %d
|
||||
|
||||
Warning: Value for class is no string in %s on line %d
|
||||
|
||||
Warning: Value for type is no string in %s on line %d
|
||||
|
||||
Warning: Value for function is no string in %s on line %d
|
||||
|
||||
Warning: args element is no array in %s on line %d
|
||||
string(60) "#0 [unknown function][unknown][unknown][unknown]()
|
||||
#1 {main}"
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Bug #63882 (zend_std_compare_objects crash on recursion)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test { public $x = 5; }
|
||||
|
||||
$testobj1 = new Test;
|
||||
$testobj2 = new Test;
|
||||
$testobj1->x = $testobj1;
|
||||
$testobj2->x = $testobj2;
|
||||
|
||||
var_dump($testobj1 == $testobj2);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Nesting level too deep - recursive dependency? in %sbug63882.php on line 9
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Bug #63976 (Parent class incorrectly using child constant in class property)
|
||||
--FILE--
|
||||
<?php
|
||||
if (1) {
|
||||
class Foo {
|
||||
const TABLE = "foo";
|
||||
public $table = self::TABLE;
|
||||
}
|
||||
}
|
||||
if (1) {
|
||||
class Bar extends Foo {
|
||||
const TABLE = "bar";
|
||||
}
|
||||
}
|
||||
$bar = new Bar();
|
||||
var_dump($bar->table);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(3) "foo"
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Bug #63982 (isset() inconsistently produces a fatal error on protected property)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test {
|
||||
protected $protectedProperty;
|
||||
}
|
||||
|
||||
$test = new Test();
|
||||
|
||||
var_dump(isset($test->protectedProperty));
|
||||
var_dump(isset($test->protectedProperty->foo));
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -1,28 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64239 (get_class_methods() changed behavior)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
use T2 { t2method as Bmethod; }
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
}
|
||||
|
||||
trait T2 {
|
||||
public function t2method() {
|
||||
}
|
||||
}
|
||||
print_r(get_class_methods("A"));
|
||||
print_r(get_class_methods("B"));
|
||||
--EXPECT--
|
||||
Array
|
||||
(
|
||||
[0] => Bmethod
|
||||
[1] => t2method
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => Bmethod
|
||||
[1] => t2method
|
||||
)
|
||||
@@ -1,58 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64239 (debug_backtrace() changed behavior)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
use T1;
|
||||
public function test() { $this->backtrace(); }
|
||||
}
|
||||
|
||||
class B {
|
||||
use T2 { t2method as Bmethod; }
|
||||
}
|
||||
|
||||
class C extends A {
|
||||
}
|
||||
|
||||
trait T1 {
|
||||
protected function backtrace() {
|
||||
$b = new B();
|
||||
$b->Bmethod();
|
||||
}
|
||||
}
|
||||
trait T2 {
|
||||
public function t2method() {
|
||||
print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1));
|
||||
}
|
||||
}
|
||||
$a = new A();
|
||||
$a->test();
|
||||
|
||||
$c = new C();
|
||||
$c->test();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[file] => %sbug64239_2.php
|
||||
[line] => %d
|
||||
[function] => Bmethod
|
||||
[class] => B
|
||||
[type] => ->
|
||||
)
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[file] => %sbug64239_2.php
|
||||
[line] => %d
|
||||
[function] => Bmethod
|
||||
[class] => B
|
||||
[type] => ->
|
||||
)
|
||||
|
||||
)
|
||||
@@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64239 (debug_print_backtrace() changed behavior)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
use T2 { t2method as Bmethod; }
|
||||
}
|
||||
|
||||
class C extends A {
|
||||
public function Bmethod() {
|
||||
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
|
||||
}
|
||||
}
|
||||
|
||||
trait T2 {
|
||||
public function t2method() {
|
||||
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A();
|
||||
$a->Bmethod();
|
||||
$a->t2method();
|
||||
|
||||
$c = new C();
|
||||
$c->Bmethod();
|
||||
$c->t2method();
|
||||
?>
|
||||
--EXPECTF--
|
||||
#0 A->Bmethod() called at [%sbug64239_3.php:%d]
|
||||
#0 A->t2method() called at [%sbug64239_3.php:%d]
|
||||
#0 C->Bmethod() called at [%sbug64239_3.php:%d]
|
||||
#0 A->t2method() called at [%sbug64239_3.php:%d]
|
||||
@@ -1,31 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64239 (debug_print_backtrace() changed behavior)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
use T2 { t2method as Bmethod; }
|
||||
}
|
||||
|
||||
class C extends A {
|
||||
public static function Bmethod() {
|
||||
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
|
||||
}
|
||||
}
|
||||
|
||||
trait T2 {
|
||||
public static function t2method() {
|
||||
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
|
||||
}
|
||||
}
|
||||
|
||||
A::Bmethod();
|
||||
A::t2method();
|
||||
|
||||
C::Bmethod();
|
||||
C::t2method();
|
||||
?>
|
||||
--EXPECTF--
|
||||
#0 A::Bmethod() called at [%sbug64239_4.php:%d]
|
||||
#0 A::t2method() called at [%sbug64239_4.php:%d]
|
||||
#0 C::Bmethod() called at [%sbug64239_4.php:%d]
|
||||
#0 A::t2method() called at [%sbug64239_4.php:%d]
|
||||
@@ -1,24 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64354 (Unserialize array of objects whose class can't be autoloaded fail)
|
||||
--FILE--
|
||||
<?php
|
||||
class B implements Serializable {
|
||||
public function serialize() {
|
||||
throw new Exception("serialize");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public function unserialize($data) {
|
||||
}
|
||||
}
|
||||
|
||||
$data = array(new B);
|
||||
|
||||
try {
|
||||
serialize($data);
|
||||
} catch (Exception $e) {
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(9) "serialize"
|
||||
@@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64417 (BC break: ArrayAccess::&offsetGet() in a trait causes fatal error)
|
||||
--FILE--
|
||||
<?php
|
||||
trait aa {
|
||||
private $container = array();
|
||||
public function offsetSet($offset, $value) {
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
public function offsetExists($offset) {
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
public function &offsetGet($offset) {
|
||||
$result = null;
|
||||
if (isset($this->container[$offset])) {
|
||||
$result = &$this->container[$offset];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
class obj implements ArrayAccess {
|
||||
use aa;
|
||||
}
|
||||
|
||||
$o = new obj;
|
||||
$o['x'] = 1;
|
||||
++$o['x'];
|
||||
echo $o['x'], "\n";
|
||||
--EXPECT--
|
||||
2
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64515 (Memoryleak when using the same variablename 2times in function declaration)
|
||||
--FILE--
|
||||
<?php
|
||||
function foo($unused = null, $unused = null, $arg = array()) {
|
||||
return 1;
|
||||
}
|
||||
foo();
|
||||
echo "okey";
|
||||
?>
|
||||
--EXPECT--
|
||||
okey
|
||||
@@ -1,14 +0,0 @@
|
||||
--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
|
||||
@@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64660 (Segfault on memory exhaustion within function definition)
|
||||
--FILE--
|
||||
<?php
|
||||
function a() {
|
||||
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[Line truncated
|
||||
}
|
||||
echo "Done\n";
|
||||
--EXPECTF--
|
||||
|
||||
Parse error: memory exhausted in %s on line %d
|
||||
@@ -1,48 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64720 (SegFault on zend_deactivate)
|
||||
--FILE--
|
||||
<?php
|
||||
class Stat {
|
||||
private static $requests;
|
||||
public static function getInstance() {
|
||||
if (!isset(self::$requests[1])) {
|
||||
self::$requests[1] = new self();
|
||||
}
|
||||
return self::$requests[1];
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
unset(self::$requests[1]);
|
||||
}
|
||||
}
|
||||
|
||||
class Foo {
|
||||
public function __construct() {
|
||||
Stat::getInstance();
|
||||
}
|
||||
}
|
||||
|
||||
class Error {
|
||||
private $trace;
|
||||
public function __construct() {
|
||||
$this->trace = debug_backtrace(1);
|
||||
}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
public function __destruct() {
|
||||
Stat::getInstance();
|
||||
new Error();
|
||||
}
|
||||
|
||||
public function test() {
|
||||
new Error();
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new Foo();
|
||||
$bar = new Bar();
|
||||
$bar->test();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Access to undeclared static property: Stat::$requests in %sbug64720.php on line 12
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64821 Custom Exceptions crash when internal properties overridden (variation 1)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class a extends exception {
|
||||
public function __construct() {
|
||||
$this->message = NULL;
|
||||
$this->string = NULL;
|
||||
$this->code = array();
|
||||
$this->line = "hello";
|
||||
}
|
||||
}
|
||||
|
||||
throw new a;
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught exception 'a' in %s:0
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64821 Custom Exceptions crash when internal properties overridden (variation 2)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class a extends exception {
|
||||
public function __construct() {
|
||||
$this->line = array();
|
||||
}
|
||||
}
|
||||
|
||||
throw new a;
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught exception 'a' in %s:0
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64821 Custom Exceptions crash when internal properties overridden (variation 3)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class a extends exception {
|
||||
public function __construct() {
|
||||
$this->line = array();
|
||||
$this->file = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
throw new a;
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught exception 'a' in :0
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in Unknown on line %d
|
||||
@@ -16,4 +16,4 @@ class C implements IFoo {
|
||||
}
|
||||
|
||||
--EXPECTF--
|
||||
Fatal error: Declaration of TFoo::oneArgument() must be compatible with IFoo::oneArgument($a) in %s on line %d
|
||||
Fatal error: Declaration of C::oneArgument() must be compatible with IFoo::oneArgument($a) in %s on line %d
|
||||
@@ -23,4 +23,4 @@ $o = new CBroken;
|
||||
$o->foo(1);
|
||||
|
||||
--EXPECTF--
|
||||
Fatal error: Declaration of TBroken2::foo($a, $b = 0) must be compatible with TBroken1::foo($a) in %s on line %d
|
||||
Fatal error: Declaration of TBroken1::foo($a) must be compatible with TBroken2::foo($a, $b = 0) in %s on line %d
|
||||
@@ -23,4 +23,4 @@ $o = new CBroken;
|
||||
$o->foo(1);
|
||||
|
||||
--EXPECTF--
|
||||
Fatal error: Declaration of TBroken2::foo($a) must be compatible with TBroken1::foo($a, $b = 0) in %s on line %d
|
||||
Fatal error: Declaration of TBroken1::foo($a, $b = 0) must be compatible with TBroken2::foo($a) in %s on line %d
|
||||
@@ -1,36 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64070 (Inheritance with Traits failed with error)
|
||||
--FILE--
|
||||
<?php
|
||||
trait first_trait
|
||||
{
|
||||
function first_function()
|
||||
{
|
||||
echo "From First Trait\n";
|
||||
}
|
||||
}
|
||||
|
||||
trait second_trait
|
||||
{
|
||||
use first_trait {
|
||||
first_trait::first_function as second_function;
|
||||
}
|
||||
|
||||
function first_function()
|
||||
{
|
||||
echo "From Second Trait\n";
|
||||
}
|
||||
}
|
||||
|
||||
class first_class
|
||||
{
|
||||
use second_trait;
|
||||
}
|
||||
|
||||
$obj = new first_class();
|
||||
$obj->first_function();
|
||||
$obj->second_function();
|
||||
?>
|
||||
--EXPECT--
|
||||
From Second Trait
|
||||
From First Trait
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64235 (Insteadof not work for class method in 5.4.11)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class TestParentClass
|
||||
{
|
||||
public function method()
|
||||
{
|
||||
print_r('Parent method');
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
trait TestTrait
|
||||
{
|
||||
public function method()
|
||||
{
|
||||
print_r('Trait method');
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
class TestChildClass extends TestParentClass
|
||||
{
|
||||
use TestTrait
|
||||
{
|
||||
TestTrait::method as methodAlias;
|
||||
TestParentClass::method insteadof TestTrait;
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Class TestParentClass is not a trait, Only traits may be used in 'as' and 'insteadof' statements in %sbug64235.php on line %d
|
||||
@@ -1,35 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64235 (Insteadof not work for class method in 5.4.11)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class TestParentClass
|
||||
{
|
||||
public function method()
|
||||
{
|
||||
print_r('Parent method');
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
trait TestTrait
|
||||
{
|
||||
public function method()
|
||||
{
|
||||
print_r('Trait method');
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
class TestChildClass extends TestParentClass
|
||||
{
|
||||
use TestTrait
|
||||
{
|
||||
TestTrait::method as methodAlias;
|
||||
TestParentClass::method as TestParent;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Class TestParentClass is not a trait, Only traits may be used in 'as' and 'insteadof' statements in %sbug64235b.php on line %d
|
||||
@@ -22,4 +22,4 @@ class TraitsTest1 {
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Declaration of THelloA::hello($a) must be compatible with THelloB::hello() in %s on line %d
|
||||
Fatal error: Declaration of THelloB::hello() must be compatible with THelloA::hello($a) in %s on line %d
|
||||
@@ -23,4 +23,4 @@ class TraitsTest1 {
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Declaration of THelloB::hello() must be compatible with THelloA::hello($a) in %s on line %d
|
||||
Fatal error: Declaration of THelloA::hello($a) must be compatible with THelloB::hello() in %s on line %d
|
||||
@@ -10,9 +10,13 @@ trait c {
|
||||
public function test() { return 2; }
|
||||
}
|
||||
|
||||
trait b {
|
||||
public function test() { return 1; }
|
||||
}
|
||||
|
||||
class bar {
|
||||
use foo, c { c::test insteadof foo; }
|
||||
use foo, c { c::test insteadof foo; }
|
||||
use foo, c { c::test insteadof foo, b; }
|
||||
use foo, c { c::test insteadof foo, b; }
|
||||
}
|
||||
|
||||
$x = new bar;
|
||||
|
||||
@@ -35,4 +35,4 @@ $o->sayHello(array());
|
||||
--EXPECTF--
|
||||
World!
|
||||
|
||||
Fatal error: Declaration of SayWorld::sayHello(Base $d) must be compatible with Base::sayHello(array $a) in %s on line %d
|
||||
Fatal error: Declaration of MyHelloWorld::sayHello() must be compatible with Base::sayHello(array $a) in %s on line %d
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Aliasing leading to conflict should result in error message
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
trait Hello {
|
||||
public function hello() {
|
||||
echo 'Hello';
|
||||
}
|
||||
}
|
||||
|
||||
trait World {
|
||||
public function world() {
|
||||
echo ' World!';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MyClass {
|
||||
use Hello, World { world as hello; }
|
||||
}
|
||||
|
||||
$o = new MyClass();
|
||||
$o->hello();
|
||||
$o->world();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Trait method hello has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Invalid conflict resolution (unused trait as lhs of "insteadof")
|
||||
--FILE--
|
||||
<?php
|
||||
trait T1 {
|
||||
function foo() {echo "T1\n";}
|
||||
}
|
||||
trait T2 {
|
||||
function foo() {echo "T2\n";}
|
||||
}
|
||||
class C {
|
||||
use T1 {
|
||||
T2::foo insteadof T1;
|
||||
}
|
||||
}
|
||||
--EXPECTF--
|
||||
Fatal error: Required Trait T2 wasn't added to C in %slanguage015.php on line %d
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Invalid conflict resolution (unused trait as rhs of "insteadof")
|
||||
--FILE--
|
||||
<?php
|
||||
trait T1 {
|
||||
function foo() {echo "T1\n";}
|
||||
}
|
||||
trait T2 {
|
||||
function foo() {echo "T2\n";}
|
||||
}
|
||||
class C {
|
||||
use T1 {
|
||||
T1::foo insteadof T2;
|
||||
}
|
||||
}
|
||||
--EXPECTF--
|
||||
Fatal error: Required Trait T2 wasn't added to C in %slanguage016.php on line %d
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Invalid conflict resolution (unused trait as lhs of "as")
|
||||
--FILE--
|
||||
<?php
|
||||
trait T1 {
|
||||
function foo() {echo "T1\n";}
|
||||
}
|
||||
trait T2 {
|
||||
function foo() {echo "T2\n";}
|
||||
}
|
||||
class C {
|
||||
use T1 {
|
||||
T2::foo as private;
|
||||
}
|
||||
}
|
||||
--EXPECTF--
|
||||
Fatal error: Required Trait T2 wasn't added to C in %slanguage017.php on line %d
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
abstract alias
|
||||
--FILE--
|
||||
<?php
|
||||
trait T1 {
|
||||
function foo() {}
|
||||
}
|
||||
class C1 {
|
||||
use T1 {
|
||||
T1::foo as abstract;
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot use 'abstract' as method modifier in %s on line %d
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
final alias
|
||||
--FILE--
|
||||
<?php
|
||||
trait T1 {
|
||||
function foo() {}
|
||||
}
|
||||
class C1 {
|
||||
use T1 {
|
||||
T1::foo as final;
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot use 'final' as method modifier in %s on line %d
|
||||
+3
-9
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -131,7 +131,7 @@ ZEND_API zval zval_used_for_init; /* True global variable */
|
||||
/* version information */
|
||||
static char *zend_version_info;
|
||||
static uint zend_version_info_length;
|
||||
#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2013 Zend Technologies\n"
|
||||
#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2012 Zend Technologies\n"
|
||||
#define PRINT_ZVAL_INDENT 4
|
||||
|
||||
static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, zend_bool is_object TSRMLS_DC) /* {{{ */
|
||||
@@ -1238,13 +1238,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
va_end(args);
|
||||
|
||||
if (type == E_PARSE) {
|
||||
/* eval() errors do not affect exit_status */
|
||||
if (!(EG(current_execute_data) &&
|
||||
EG(current_execute_data)->opline &&
|
||||
EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL &&
|
||||
EG(current_execute_data)->opline->extended_value == ZEND_EVAL)) {
|
||||
EG(exit_status) = 255;
|
||||
}
|
||||
EG(exit_status) = 255;
|
||||
zend_init_compiler_data_structures(TSRMLS_C);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-8
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -350,10 +350,6 @@ struct _zval_struct {
|
||||
#define Z_UNSET_ISREF(z) Z_UNSET_ISREF_P(&(z))
|
||||
#define Z_SET_ISREF_TO(z, isref) Z_SET_ISREF_TO_P(&(z), isref)
|
||||
|
||||
#if ZEND_DEBUG
|
||||
#define zend_always_inline inline
|
||||
#define zend_never_inline
|
||||
#else
|
||||
#if defined(__GNUC__)
|
||||
#if __GNUC__ >= 3
|
||||
#define zend_always_inline inline __attribute__((always_inline))
|
||||
@@ -362,6 +358,7 @@ struct _zval_struct {
|
||||
#define zend_always_inline inline
|
||||
#define zend_never_inline
|
||||
#endif
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
#define zend_always_inline __forceinline
|
||||
#define zend_never_inline
|
||||
@@ -369,7 +366,6 @@ struct _zval_struct {
|
||||
#define zend_always_inline inline
|
||||
#define zend_never_inline
|
||||
#endif
|
||||
#endif /* ZEND_DEBUG */
|
||||
|
||||
#if (defined (__GNUC__) && __GNUC__ > 2 ) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX)
|
||||
# define EXPECTED(condition) __builtin_expect(condition, 1)
|
||||
@@ -441,7 +437,7 @@ struct _zend_trait_precedence {
|
||||
|
||||
zend_class_entry** exclude_from_classes;
|
||||
|
||||
union _zend_function* function; /* FIXME: kept in 5.4 for BC, not used */
|
||||
union _zend_function* function;
|
||||
};
|
||||
typedef struct _zend_trait_precedence zend_trait_precedence;
|
||||
|
||||
@@ -459,7 +455,7 @@ struct _zend_trait_alias {
|
||||
*/
|
||||
zend_uint modifiers;
|
||||
|
||||
union _zend_function* function; /* FIXME: kept in 5.4 for BC, not used */
|
||||
union _zend_function* function;
|
||||
};
|
||||
typedef struct _zend_trait_alias zend_trait_alias;
|
||||
|
||||
|
||||
+3
-96
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -1022,41 +1022,6 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int zval_update_class_constant(zval **pp, int is_static, int offset TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
if ((Z_TYPE_PP(pp) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT ||
|
||||
(Z_TYPE_PP(pp) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT_ARRAY) {
|
||||
zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry);
|
||||
|
||||
if ((*scope)->parent) {
|
||||
zend_class_entry *ce = *scope;
|
||||
HashPosition pos;
|
||||
zend_property_info *prop_info;
|
||||
|
||||
do {
|
||||
for (zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
|
||||
zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop_info, &pos) == SUCCESS;
|
||||
zend_hash_move_forward_ex(&ce->properties_info, &pos)) {
|
||||
if (is_static == ((prop_info->flags & ZEND_ACC_STATIC) != 0) &&
|
||||
offset == prop_info->offset) {
|
||||
int ret;
|
||||
zend_class_entry *old_scope = *scope;
|
||||
*scope = prop_info->ce;
|
||||
ret = zval_update_constant(pp, (void*)1 TSRMLS_CC);
|
||||
*scope = old_scope;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
ce = ce->parent;
|
||||
} while (ce);
|
||||
|
||||
}
|
||||
return zval_update_constant(pp, (void*)1 TSRMLS_CC);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
if ((class_type->ce_flags & ZEND_ACC_CONSTANTS_UPDATED) == 0 || (!CE_STATIC_MEMBERS(class_type) && class_type->default_static_members_count)) {
|
||||
@@ -1069,7 +1034,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
|
||||
|
||||
for (i = 0; i < class_type->default_properties_count; i++) {
|
||||
if (class_type->default_properties_table[i]) {
|
||||
zval_update_class_constant(&class_type->default_properties_table[i], 0, i TSRMLS_CC);
|
||||
zval_update_constant(&class_type->default_properties_table[i], (void**)1 TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1110,7 +1075,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
|
||||
}
|
||||
|
||||
for (i = 0; i < class_type->default_static_members_count; i++) {
|
||||
zval_update_class_constant(&CE_STATIC_MEMBERS(class_type)[i], 1, i TSRMLS_CC);
|
||||
zval_update_constant(&CE_STATIC_MEMBERS(class_type)[i], (void**)1 TSRMLS_CC);
|
||||
}
|
||||
|
||||
*scope = old_scope;
|
||||
@@ -3743,8 +3708,6 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *na
|
||||
(*property)->value = value->value;
|
||||
if (Z_REFCOUNT_P(value) > 0) {
|
||||
zval_copy_ctor(*property);
|
||||
} else {
|
||||
efree(value);
|
||||
}
|
||||
} else {
|
||||
zval *garbage = *property;
|
||||
@@ -3913,62 +3876,6 @@ ZEND_API void zend_restore_error_handling(zend_error_handling *saved TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name, zend_uint len) /* {{{ */
|
||||
{
|
||||
zend_trait_alias *alias, **alias_ptr;
|
||||
|
||||
alias_ptr = ce->trait_aliases;
|
||||
alias = *alias_ptr;
|
||||
while (alias) {
|
||||
if (alias->alias_len == len &&
|
||||
!strncasecmp(name, alias->alias, alias->alias_len)) {
|
||||
return alias->alias;
|
||||
}
|
||||
alias_ptr++;
|
||||
alias = *alias_ptr;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API const char* zend_resolve_method_name(zend_class_entry *ce, zend_function *f) /* {{{ */
|
||||
{
|
||||
zend_function *func;
|
||||
HashPosition iterator;
|
||||
HashTable *function_table;
|
||||
|
||||
if (f->common.type != ZEND_USER_FUNCTION ||
|
||||
*(f->op_array.refcount) < 2 ||
|
||||
!f->common.scope ||
|
||||
!f->common.scope->trait_aliases) {
|
||||
return f->common.function_name;
|
||||
}
|
||||
|
||||
function_table = &ce->function_table;
|
||||
zend_hash_internal_pointer_reset_ex(function_table, &iterator);
|
||||
while (zend_hash_get_current_data_ex(function_table, (void **)&func, &iterator) == SUCCESS) {
|
||||
if (func == f) {
|
||||
char *name;
|
||||
uint len;
|
||||
ulong idx;
|
||||
|
||||
if (zend_hash_get_current_key_ex(function_table, &name, &len, &idx, 0, &iterator) != HASH_KEY_IS_STRING) {
|
||||
return f->common.function_name;
|
||||
}
|
||||
--len;
|
||||
if (len == strlen(f->common.function_name) &&
|
||||
!strncasecmp(name, f->common.function_name, len)) {
|
||||
return f->common.function_name;
|
||||
}
|
||||
return zend_find_alias_name(f->common.scope, name, len);
|
||||
}
|
||||
zend_hash_move_forward_ex(function_table, &iterator);
|
||||
}
|
||||
return f->common.function_name;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
|
||||
+5
-8
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -60,7 +60,7 @@ typedef struct _zend_fcall_info_cache {
|
||||
zval *object_ptr;
|
||||
} zend_fcall_info_cache;
|
||||
|
||||
#define ZEND_NS_NAME(ns, name) ns "\\" name
|
||||
#define ZEND_NS_NAME(ns, name) ns"\\"name
|
||||
|
||||
#define ZEND_FN(name) zif_##name
|
||||
#define ZEND_MN(name) zim_##name
|
||||
@@ -90,7 +90,7 @@ typedef struct _zend_fcall_info_cache {
|
||||
#define ZEND_NS_RAW_FENTRY(ns, zend_name, name, arg_info, flags) ZEND_RAW_FENTRY(ZEND_NS_NAME(ns, zend_name), name, arg_info, flags)
|
||||
#define ZEND_NS_RAW_NAMED_FE(ns, zend_name, name, arg_info) ZEND_NS_RAW_FENTRY(ns, #zend_name, name, arg_info, 0)
|
||||
|
||||
#define ZEND_NS_NAMED_FE(ns, zend_name, name, arg_info) ZEND_NS_FENTRY(ns, zend_name, name, arg_info, 0)
|
||||
#define ZEND_NS_NAMED_FE(ns, zend_name, name, arg_info) ZEND_NS_FENTRY(ns, #zend_name, name, arg_info, 0)
|
||||
#define ZEND_NS_FE(ns, name, arg_info) ZEND_NS_FENTRY(ns, name, ZEND_FN(name), arg_info, 0)
|
||||
#define ZEND_NS_DEP_FE(ns, name, arg_info) ZEND_NS_FENTRY(ns, name, ZEND_FN(name), arg_info, ZEND_ACC_DEPRECATED)
|
||||
#define ZEND_NS_FALIAS(ns, name, alias, arg_info) ZEND_NS_FENTRY(ns, name, ZEND_FN(alias), arg_info, 0)
|
||||
@@ -279,9 +279,9 @@ ZEND_API void zend_class_implements(zend_class_entry *class_entry TSRMLS_DC, int
|
||||
ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_class_entry *ce TSRMLS_DC);
|
||||
|
||||
#define zend_register_class_alias(name, ce) \
|
||||
zend_register_class_alias_ex(name, sizeof(name)-1, ce TSRMLS_CC)
|
||||
zend_register_class_alias_ex(name, sizeof(name)-1, ce TSRMLS_DC)
|
||||
#define zend_register_ns_class_alias(ns, name, ce) \
|
||||
zend_register_class_alias_ex(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, ce TSRMLS_CC)
|
||||
zend_register_class_alias_ex(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, ce TSRMLS_DC)
|
||||
|
||||
ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC);
|
||||
ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC);
|
||||
@@ -517,9 +517,6 @@ ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_rebuild_symbol_table(TSRMLS_D);
|
||||
|
||||
ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name, zend_uint len);
|
||||
ZEND_API const char* zend_resolve_method_name(zend_class_entry *ce, zend_function *f);
|
||||
|
||||
#define add_method(arg, key, method) add_assoc_function((arg), (key), (method))
|
||||
|
||||
ZEND_API ZEND_FUNCTION(display_disabled_function);
|
||||
|
||||
+5
-15
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -672,7 +672,7 @@ static inline unsigned int zend_mm_high_bit(size_t _size)
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
unsigned long n;
|
||||
|
||||
__asm__("bsr %1,%0\n\t" : "=r" (n) : "rm" (_size));
|
||||
__asm__("bsrq %1,%0\n\t" : "=r" (n) : "rm" (_size));
|
||||
return (unsigned int)n;
|
||||
#elif defined(_MSC_VER) && defined(_M_IX86)
|
||||
__asm {
|
||||
@@ -698,12 +698,12 @@ static inline unsigned int zend_mm_low_bit(size_t _size)
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
unsigned long n;
|
||||
|
||||
__asm__("bsf %1,%0\n\t" : "=r" (n) : "rm" (_size));
|
||||
__asm__("bsfq %1,%0\n\t" : "=r" (n) : "rm" (_size));
|
||||
return (unsigned int)n;
|
||||
#elif defined(_MSC_VER) && defined(_M_IX86)
|
||||
__asm {
|
||||
bsf eax, _size
|
||||
}
|
||||
}
|
||||
#else
|
||||
static const int offset[16] = {4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0};
|
||||
unsigned int n;
|
||||
@@ -2481,22 +2481,12 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
|
||||
size_t res = nmemb;
|
||||
unsigned long overflow = 0;
|
||||
|
||||
#ifdef __ILP32__ /* x32 */
|
||||
# define LP_SUFF "l"
|
||||
#else /* amd64 */
|
||||
# define LP_SUFF "q"
|
||||
#endif
|
||||
|
||||
__asm__ ("mul" LP_SUFF " %3\n\t"
|
||||
"add %4,%0\n\t"
|
||||
"adc %1,%1"
|
||||
__asm__ ("mulq %3\n\taddq %4,%0\n\tadcq %1,%1"
|
||||
: "=&a"(res), "=&d" (overflow)
|
||||
: "%0"(res),
|
||||
"rm"(size),
|
||||
"rm"(offset));
|
||||
|
||||
#undef LP_SUFF
|
||||
|
||||
if (UNEXPECTED(overflow)) {
|
||||
zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
|
||||
return 0;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -1025,13 +1025,6 @@ ZEND_FUNCTION(get_object_vars)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int same_name(const char *key, const char *name, zend_uint name_len)
|
||||
{
|
||||
char *lcname = zend_str_tolower_dup(name, name_len);
|
||||
int ret = memcmp(lcname, key, name_len) == 0;
|
||||
efree(lcname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* {{{ proto array get_class_methods(mixed class)
|
||||
Returns an array of method names for class or class instance. */
|
||||
@@ -1079,26 +1072,14 @@ ZEND_FUNCTION(get_class_methods)
|
||||
uint len = strlen(mptr->common.function_name);
|
||||
|
||||
/* Do not display old-style inherited constructors */
|
||||
if (zend_hash_get_current_key_ex(&ce->function_table, &key, &key_len, &num_index, 0, &pos) != HASH_KEY_IS_STRING) {
|
||||
if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 ||
|
||||
mptr->common.scope == ce ||
|
||||
zend_hash_get_current_key_ex(&ce->function_table, &key, &key_len, &num_index, 0, &pos) != HASH_KEY_IS_STRING ||
|
||||
zend_binary_strcasecmp(key, key_len-1, mptr->common.function_name, len) == 0) {
|
||||
|
||||
MAKE_STD_ZVAL(method_name);
|
||||
ZVAL_STRINGL(method_name, mptr->common.function_name, len, 1);
|
||||
zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);
|
||||
} else if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 ||
|
||||
mptr->common.scope == ce ||
|
||||
zend_binary_strcasecmp(key, key_len-1, mptr->common.function_name, len) == 0) {
|
||||
|
||||
if (mptr->type == ZEND_USER_FUNCTION &&
|
||||
*mptr->op_array.refcount > 1 &&
|
||||
(len != key_len - 1 ||
|
||||
!same_name(key, mptr->common.function_name, len))) {
|
||||
MAKE_STD_ZVAL(method_name);
|
||||
ZVAL_STRINGL(method_name, zend_find_alias_name(mptr->common.scope, key, key_len - 1), key_len - 1, 1);
|
||||
zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);
|
||||
} else {
|
||||
MAKE_STD_ZVAL(method_name);
|
||||
ZVAL_STRINGL(method_name, mptr->common.function_name, len, 1);
|
||||
zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
zend_hash_move_forward_ex(&ce->function_table, &pos);
|
||||
@@ -1659,6 +1640,7 @@ ZEND_FUNCTION(restore_exception_handler)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
static int copy_class_or_interface_name(zend_class_entry **pce TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
|
||||
{
|
||||
zval *array = va_arg(args, zval *);
|
||||
@@ -1669,13 +1651,7 @@ static int copy_class_or_interface_name(zend_class_entry **pce TSRMLS_DC, int nu
|
||||
|
||||
if ((hash_key->nKeyLength==0 || hash_key->arKey[0]!=0)
|
||||
&& (comply_mask == (ce->ce_flags & mask))) {
|
||||
if (ce->refcount > 1 &&
|
||||
(ce->name_length != hash_key->nKeyLength - 1 ||
|
||||
!same_name(hash_key->arKey, ce->name, ce->name_length))) {
|
||||
add_next_index_stringl(array, hash_key->arKey, hash_key->nKeyLength - 1, 1);
|
||||
} else {
|
||||
add_next_index_stringl(array, ce->name, ce->name_length, 1);
|
||||
}
|
||||
add_next_index_stringl(array, ce->name, ce->name_length, 1);
|
||||
}
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
}
|
||||
@@ -2118,14 +2094,7 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
lineno = 0;
|
||||
}
|
||||
|
||||
function_name = (ptr->function_state.function->common.scope &&
|
||||
ptr->function_state.function->common.scope->trait_aliases) ?
|
||||
zend_resolve_method_name(
|
||||
ptr->object ?
|
||||
Z_OBJCE_P(ptr->object) :
|
||||
ptr->function_state.function->common.scope,
|
||||
ptr->function_state.function) :
|
||||
ptr->function_state.function->common.function_name;
|
||||
function_name = ptr->function_state.function->common.function_name;
|
||||
|
||||
if (function_name) {
|
||||
if (ptr->object) {
|
||||
@@ -2306,14 +2275,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
|
||||
filename = NULL;
|
||||
}
|
||||
|
||||
function_name = (ptr->function_state.function->common.scope &&
|
||||
ptr->function_state.function->common.scope->trait_aliases) ?
|
||||
zend_resolve_method_name(
|
||||
ptr->object ?
|
||||
Z_OBJCE_P(ptr->object) :
|
||||
ptr->function_state.function->common.scope,
|
||||
ptr->function_state.function) :
|
||||
ptr->function_state.function->common.function_name;
|
||||
function_name = ptr->function_state.function->common.function_name;
|
||||
|
||||
if (function_name) {
|
||||
add_assoc_string_ex(stack_frame, "function", sizeof("function"), (char*)function_name, 1);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+391
-224
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -1798,7 +1798,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(0 TSRMLS_CC);
|
||||
zend_release_labels(TSRMLS_C);
|
||||
|
||||
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);
|
||||
@@ -2320,14 +2320,13 @@ void zend_do_goto(const znode *label TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_release_labels(int temporary TSRMLS_DC) /* {{{ */
|
||||
void zend_release_labels(TSRMLS_D) /* {{{ */
|
||||
{
|
||||
if (CG(context).labels) {
|
||||
zend_hash_destroy(CG(context).labels);
|
||||
FREE_HASHTABLE(CG(context).labels);
|
||||
CG(context).labels = NULL;
|
||||
}
|
||||
if (!temporary && !zend_stack_is_empty(&CG(context_stack))) {
|
||||
if (!zend_stack_is_empty(&CG(context_stack))) {
|
||||
zend_compiler_context *ctx;
|
||||
|
||||
zend_stack_top(&CG(context_stack), (void**)&ctx);
|
||||
@@ -3334,7 +3333,7 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
|
||||
if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) {
|
||||
zend_error(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name, hash_key->arKey, zend_visibility_string(parent_info->flags), parent_ce->name, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
|
||||
} else if ((child_info->flags & ZEND_ACC_STATIC) == 0) {
|
||||
zval_ptr_dtor(&(ce->default_properties_table[parent_info->offset]));
|
||||
Z_DELREF_P(ce->default_properties_table[parent_info->offset]);
|
||||
ce->default_properties_table[parent_info->offset] = ce->default_properties_table[child_info->offset];
|
||||
ce->default_properties_table[child_info->offset] = NULL;
|
||||
child_info->offset = parent_info->offset;
|
||||
@@ -3528,7 +3527,8 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
|
||||
|
||||
if (ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS && ce->type == ZEND_INTERNAL_CLASS) {
|
||||
ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
|
||||
} else if (!(ce->ce_flags & (ZEND_ACC_IMPLEMENT_INTERFACES|ZEND_ACC_IMPLEMENT_TRAITS))) {
|
||||
} else if (!(ce->ce_flags & ZEND_ACC_IMPLEMENT_INTERFACES)
|
||||
&& !(ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS)) {
|
||||
/* The verification will be done in runtime by ZEND_VERIFY_ABSTRACT_CLASS */
|
||||
zend_verify_abstract_class(ce TSRMLS_CC);
|
||||
}
|
||||
@@ -3625,6 +3625,7 @@ ZEND_API void zend_do_implement_trait(zend_class_entry *ce, zend_class_entry *tr
|
||||
}
|
||||
}
|
||||
ce->traits[ce->num_traits++] = trait;
|
||||
trait->refcount++;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -3635,9 +3636,93 @@ static zend_bool zend_traits_method_compatibility_check(zend_function *fn, zend_
|
||||
zend_uint other_flags = other_fn->common.scope->ce_flags;
|
||||
|
||||
return zend_do_perform_implementation_check(fn, other_fn TSRMLS_CC)
|
||||
&& ((other_fn->common.scope->ce_flags & ZEND_ACC_INTERFACE) || zend_do_perform_implementation_check(other_fn, fn TSRMLS_CC))
|
||||
&& ((fn_flags & (ZEND_ACC_FINAL|ZEND_ACC_STATIC)) ==
|
||||
(other_flags & (ZEND_ACC_FINAL|ZEND_ACC_STATIC))); /* equal final and static qualifier */
|
||||
&& zend_do_perform_implementation_check(other_fn, fn TSRMLS_CC)
|
||||
&& ((fn_flags & ZEND_ACC_FINAL) == (other_flags & ZEND_ACC_FINAL)) /* equal final qualifier */
|
||||
&& ((fn_flags & ZEND_ACC_STATIC)== (other_flags & ZEND_ACC_STATIC)); /* equal static qualifier */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int zend_traits_merge_functions(zend_function *fn TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
|
||||
{
|
||||
size_t current;
|
||||
size_t i;
|
||||
size_t count;
|
||||
HashTable* resulting_table;
|
||||
HashTable** function_tables;
|
||||
zend_class_entry *ce;
|
||||
size_t collision = 0;
|
||||
size_t abstract_solved = 0;
|
||||
zend_function* other_trait_fn;
|
||||
|
||||
current = va_arg(args, size_t); /* index of current trait */
|
||||
count = va_arg(args, size_t);
|
||||
resulting_table = va_arg(args, HashTable*);
|
||||
function_tables = va_arg(args, HashTable**);
|
||||
ce = va_arg(args, zend_class_entry*);
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (i == current) {
|
||||
continue; /* just skip this, cause its the table this function is applied on */
|
||||
}
|
||||
|
||||
if (zend_hash_quick_find(function_tables[i], hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **)&other_trait_fn) == SUCCESS) {
|
||||
/* if it is an abstract method, there is no collision */
|
||||
if (other_trait_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
/* Make sure they are compatible */
|
||||
/* In case both are abstract, just check prototype, but need to do that in both directions */
|
||||
if (!zend_traits_method_compatibility_check(fn, other_trait_fn TSRMLS_CC)) {
|
||||
zend_error(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
|
||||
zend_get_function_declaration(fn TSRMLS_CC),
|
||||
zend_get_function_declaration(other_trait_fn TSRMLS_CC));
|
||||
}
|
||||
|
||||
/* we can savely free and remove it from other table */
|
||||
zend_function_dtor(other_trait_fn);
|
||||
zend_hash_quick_del(function_tables[i], hash_key->arKey, hash_key->nKeyLength, hash_key->h);
|
||||
} else {
|
||||
/* if it is not an abstract method, there is still no collision */
|
||||
/* if fn is an abstract method */
|
||||
if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
/* Make sure they are compatible.
|
||||
Here, we already know other_trait_fn cannot be abstract, full check ok. */
|
||||
if (!zend_traits_method_compatibility_check(fn, other_trait_fn TSRMLS_CC)) {
|
||||
zend_error(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
|
||||
zend_get_function_declaration(fn TSRMLS_CC),
|
||||
zend_get_function_declaration(other_trait_fn TSRMLS_CC));
|
||||
}
|
||||
|
||||
/* just mark as solved, will be added if its own trait is processed */
|
||||
abstract_solved = 1;
|
||||
} else {
|
||||
/* but else, we have a collision of non-abstract methods */
|
||||
collision++;
|
||||
zend_function_dtor(other_trait_fn);
|
||||
zend_hash_quick_del(function_tables[i], hash_key->arKey, hash_key->nKeyLength, hash_key->h);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (collision) {
|
||||
zend_function* class_fn;
|
||||
|
||||
/* make sure method is not already overridden in class */
|
||||
if (zend_hash_quick_find(&ce->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **)&class_fn) == FAILURE
|
||||
|| class_fn->common.scope != ce) {
|
||||
zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because there are collisions with other trait methods on %s", fn->common.function_name, ce->name);
|
||||
}
|
||||
|
||||
zend_function_dtor(fn);
|
||||
} else if (abstract_solved) {
|
||||
zend_function_dtor(fn);
|
||||
} else {
|
||||
/* Add it to result function table */
|
||||
if (zend_hash_quick_add(resulting_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, fn, sizeof(zend_function), NULL)==FAILURE) {
|
||||
zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occurred during updating resulting trait method table", fn->common.function_name);
|
||||
}
|
||||
}
|
||||
|
||||
return ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -3682,84 +3767,66 @@ static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void zend_add_trait_method(zend_class_entry *ce, const char *name, const char *arKey, uint nKeyLength, zend_function *fn, HashTable **overriden TSRMLS_DC) /* {{{ */
|
||||
static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
|
||||
{
|
||||
zend_function *existing_fn = NULL;
|
||||
ulong h = zend_hash_func(arKey, nKeyLength);
|
||||
zend_class_entry *ce = va_arg(args, zend_class_entry*);
|
||||
zend_function* existing_fn = NULL;
|
||||
zend_function fn_copy, *fn_copy_p;
|
||||
zend_function* prototype = NULL; /* is used to determine the prototype according to the inheritance chain */
|
||||
|
||||
if (zend_hash_quick_find(&ce->function_table, arKey, nKeyLength, h, (void**) &existing_fn) == SUCCESS) {
|
||||
if (existing_fn->common.scope == ce) {
|
||||
/* members from the current class override trait methods */
|
||||
/* use temporary *overriden HashTable to detect hidden conflict */
|
||||
if (*overriden) {
|
||||
if (zend_hash_quick_find(*overriden, arKey, nKeyLength, h, (void**) &existing_fn) == SUCCESS) {
|
||||
if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
/* Make sure the trait method is compatible with previosly declared abstract method */
|
||||
if (!zend_traits_method_compatibility_check(fn, existing_fn TSRMLS_CC)) {
|
||||
zend_error(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
|
||||
zend_get_function_declaration(fn TSRMLS_CC),
|
||||
zend_get_function_declaration(existing_fn TSRMLS_CC));
|
||||
}
|
||||
} else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
/* Make sure the abstract declaration is compatible with previous declaration */
|
||||
if (!zend_traits_method_compatibility_check(existing_fn, fn TSRMLS_CC)) {
|
||||
zend_error(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
|
||||
zend_get_function_declaration(fn TSRMLS_CC),
|
||||
zend_get_function_declaration(existing_fn TSRMLS_CC));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ALLOC_HASHTABLE(*overriden);
|
||||
zend_hash_init_ex(*overriden, 2, NULL, NULL, 0, 0);
|
||||
if (zend_hash_quick_find(&ce->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void**) &existing_fn) == FAILURE ||
|
||||
existing_fn->common.scope != ce) {
|
||||
/* not found or inherited from other class or interface */
|
||||
zend_function* parent_function;
|
||||
|
||||
if (ce->parent && zend_hash_quick_find(&ce->parent->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void**) &parent_function) != FAILURE) {
|
||||
prototype = parent_function; /* ->common.fn_flags |= ZEND_ACC_ABSTRACT; */
|
||||
|
||||
/* we got that method in the parent class, and are going to override it,
|
||||
except, if the trait is just asking to have an abstract method implemented. */
|
||||
if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
/* then we clean up an skip this method */
|
||||
zend_function_dtor(fn);
|
||||
return ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
zend_hash_quick_update(*overriden, arKey, nKeyLength, h, fn, sizeof(zend_function), (void**)&fn);
|
||||
return;
|
||||
} else if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
/* Make sure the trait method is compatible with previosly declared abstract method */
|
||||
if (!zend_traits_method_compatibility_check(fn, existing_fn TSRMLS_CC)) {
|
||||
zend_error(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
|
||||
zend_get_function_declaration(fn TSRMLS_CC),
|
||||
zend_get_function_declaration(existing_fn TSRMLS_CC));
|
||||
}
|
||||
} else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
/* Make sure the abstract declaration is compatible with previous declaration */
|
||||
if (!zend_traits_method_compatibility_check(existing_fn, fn TSRMLS_CC)) {
|
||||
zend_error(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
|
||||
zend_get_function_declaration(fn TSRMLS_CC),
|
||||
zend_get_function_declaration(existing_fn TSRMLS_CC));
|
||||
}
|
||||
return;
|
||||
} else if ((existing_fn->common.scope->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
|
||||
/* two trais can't define the same non-abstract method */
|
||||
#if 1
|
||||
zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because there are collisions with other trait methods on %s",
|
||||
name, ce->name);
|
||||
#else /* TODO: better errot message */
|
||||
zend_error(E_COMPILE_ERROR, "Trait method %s::%s has not been applied as %s::%s, because of collision with %s::%s",
|
||||
fn->common.scope->name, fn->common.function_name,
|
||||
ce->name, name,
|
||||
existing_fn->common.scope->name, existing_fn->common.function_name);
|
||||
#endif
|
||||
} else {
|
||||
/* inherited members are overridden by members inserted by traits */
|
||||
/* check whether the trait method fullfills the inheritance requirements */
|
||||
do_inheritance_check_on_method(fn, existing_fn TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
function_add_ref(fn);
|
||||
zend_hash_quick_update(&ce->function_table, arKey, nKeyLength, h, fn, sizeof(zend_function), (void**)&fn);
|
||||
zend_add_magic_methods(ce, arKey, nKeyLength, fn TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int zend_fixup_trait_method(zend_function *fn, zend_class_entry *ce TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
if ((fn->common.scope->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
|
||||
|
||||
fn->common.scope = ce;
|
||||
fn->common.prototype = prototype;
|
||||
|
||||
if (prototype
|
||||
&& (prototype->common.fn_flags & ZEND_ACC_IMPLEMENTED_ABSTRACT
|
||||
|| prototype->common.fn_flags & ZEND_ACC_ABSTRACT)) {
|
||||
fn->common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT;
|
||||
} else if (fn->common.fn_flags & ZEND_ACC_IMPLEMENTED_ABSTRACT) {
|
||||
/* remove ZEND_ACC_IMPLEMENTED_ABSTRACT flag, think it shouldn't be copied to class */
|
||||
fn->common.fn_flags = fn->common.fn_flags - ZEND_ACC_IMPLEMENTED_ABSTRACT;
|
||||
}
|
||||
|
||||
/* check whether the trait method fullfills the inheritance requirements */
|
||||
if (prototype) {
|
||||
do_inheritance_check_on_method(fn, prototype TSRMLS_CC);
|
||||
}
|
||||
|
||||
/* one more thing: make sure we properly implement an abstract method */
|
||||
if (existing_fn && existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
prototype = fn->common.prototype;
|
||||
do_inheritance_check_on_method(fn, existing_fn TSRMLS_CC);
|
||||
fn->common.prototype = prototype;
|
||||
}
|
||||
|
||||
/* delete inherited fn if the function to be added is not abstract */
|
||||
if (existing_fn
|
||||
&& existing_fn->common.scope != ce
|
||||
&& (fn->common.fn_flags & ZEND_ACC_ABSTRACT) == 0) {
|
||||
/* it is just a reference which was added to the subclass while doing
|
||||
the inheritance, so we can deleted now, and will add the overriding
|
||||
method afterwards.
|
||||
Except, if we try to add an abstract function, then we should not
|
||||
delete the inherited one */
|
||||
zend_hash_quick_del(&ce->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h);
|
||||
}
|
||||
|
||||
|
||||
if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
ce->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
|
||||
@@ -3767,109 +3834,130 @@ static int zend_fixup_trait_method(zend_function *fn, zend_class_entry *ce TSRML
|
||||
if (fn->op_array.static_variables) {
|
||||
ce->ce_flags |= ZEND_HAS_STATIC_IN_METHODS;
|
||||
}
|
||||
fn_copy = *fn;
|
||||
function_add_ref(&fn_copy);
|
||||
|
||||
if (zend_hash_quick_update(&ce->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, &fn_copy, sizeof(zend_function), (void**)&fn_copy_p)==FAILURE) {
|
||||
zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occurred during updating class method table", hash_key->arKey);
|
||||
}
|
||||
|
||||
zend_add_magic_methods(ce, hash_key->arKey, hash_key->nKeyLength, fn_copy_p TSRMLS_CC);
|
||||
|
||||
zend_function_dtor(fn);
|
||||
} else {
|
||||
zend_function_dtor(fn);
|
||||
}
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
|
||||
return ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
|
||||
{
|
||||
zend_class_entry *ce;
|
||||
HashTable **overriden;
|
||||
zend_trait_alias *alias, **alias_ptr;
|
||||
HashTable *exclude_table;
|
||||
char *lcname;
|
||||
unsigned int fnname_len;
|
||||
zend_function fn_copy;
|
||||
void *dummy;
|
||||
HashTable* target;
|
||||
zend_trait_alias** aliases;
|
||||
HashTable* exclude_table;
|
||||
char* lcname;
|
||||
unsigned int fnname_len;
|
||||
zend_function fn_copy;
|
||||
void* dummy;
|
||||
size_t i = 0;
|
||||
|
||||
ce = va_arg(args, zend_class_entry*);
|
||||
overriden = va_arg(args, HashTable**);
|
||||
target = va_arg(args, HashTable*);
|
||||
aliases = va_arg(args, zend_trait_alias**);
|
||||
exclude_table = va_arg(args, HashTable*);
|
||||
|
||||
fnname_len = hash_key->nKeyLength - 1;
|
||||
|
||||
fnname_len = strlen(fn->common.function_name);
|
||||
|
||||
/* apply aliases which are qualified with a class name, there should not be any ambiguity */
|
||||
if (ce->trait_aliases) {
|
||||
alias_ptr = ce->trait_aliases;
|
||||
alias = *alias_ptr;
|
||||
while (alias) {
|
||||
if (aliases) {
|
||||
while (aliases[i]) {
|
||||
/* Scope unset or equal to the function we compare to, and the alias applies to fn */
|
||||
if (alias->alias != NULL
|
||||
&& (!alias->trait_method->ce || fn->common.scope == alias->trait_method->ce)
|
||||
&& alias->trait_method->mname_len == fnname_len
|
||||
&& (zend_binary_strcasecmp(alias->trait_method->method_name, alias->trait_method->mname_len, hash_key->arKey, fnname_len) == 0)) {
|
||||
if (aliases[i]->alias != NULL
|
||||
&& (!aliases[i]->trait_method->ce || fn->common.scope == aliases[i]->trait_method->ce)
|
||||
&& aliases[i]->trait_method->mname_len == fnname_len
|
||||
&& (zend_binary_strcasecmp(aliases[i]->trait_method->method_name, aliases[i]->trait_method->mname_len, fn->common.function_name, fnname_len) == 0)) {
|
||||
fn_copy = *fn;
|
||||
function_add_ref(&fn_copy);
|
||||
/* this function_name is never destroyed, because ZEND_ACC_ALIAS
|
||||
flag is set */
|
||||
fn_copy.common.function_name = aliases[i]->alias;
|
||||
fn_copy.common.fn_flags |= ZEND_ACC_ALIAS;
|
||||
|
||||
/* if it is 0, no modifieres has been changed */
|
||||
if (alias->modifiers) {
|
||||
fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK));
|
||||
if (aliases[i]->modifiers) {
|
||||
fn_copy.common.fn_flags = aliases[i]->modifiers | ZEND_ACC_ALIAS;
|
||||
if (!(aliases[i]->modifiers & ZEND_ACC_PPP_MASK)) {
|
||||
fn_copy.common.fn_flags |= ZEND_ACC_PUBLIC;
|
||||
}
|
||||
fn_copy.common.fn_flags |= fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK);
|
||||
}
|
||||
|
||||
lcname = zend_str_tolower_dup(alias->alias, alias->alias_len);
|
||||
zend_add_trait_method(ce, alias->alias, lcname, alias->alias_len+1, &fn_copy, overriden TSRMLS_CC);
|
||||
lcname = zend_str_tolower_dup(aliases[i]->alias, aliases[i]->alias_len);
|
||||
|
||||
if (zend_hash_add(target, lcname, aliases[i]->alias_len+1, &fn_copy, sizeof(zend_function), NULL)==FAILURE) {
|
||||
zend_error(E_COMPILE_ERROR, "Failed to add aliased trait method (%s) to the trait table. There is probably already a trait method with the same name", fn_copy.common.function_name);
|
||||
}
|
||||
efree(lcname);
|
||||
|
||||
/* Record the trait from which this alias was resolved. */
|
||||
if (!alias->trait_method->ce) {
|
||||
alias->trait_method->ce = fn->common.scope;
|
||||
/** Record the trait from which this alias was resolved. */
|
||||
if (!aliases[i]->trait_method->ce) {
|
||||
aliases[i]->trait_method->ce = fn->common.scope;
|
||||
}
|
||||
}
|
||||
alias_ptr++;
|
||||
alias = *alias_ptr;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
lcname = hash_key->arKey;
|
||||
lcname = zend_str_tolower_dup(fn->common.function_name, fnname_len);
|
||||
|
||||
if (exclude_table == NULL || zend_hash_find(exclude_table, lcname, fnname_len, &dummy) == FAILURE) {
|
||||
/* is not in hashtable, thus, function is not to be excluded */
|
||||
fn_copy = *fn;
|
||||
function_add_ref(&fn_copy);
|
||||
fn_copy.common.fn_flags |= ZEND_ACC_ALIAS;
|
||||
|
||||
/* apply aliases which have not alias name, just setting visibility */
|
||||
if (ce->trait_aliases) {
|
||||
alias_ptr = ce->trait_aliases;
|
||||
alias = *alias_ptr;
|
||||
while (alias) {
|
||||
/* apply aliases which are not qualified by a class name, or which have not
|
||||
* alias name, just setting visibility */
|
||||
if (aliases) {
|
||||
i = 0;
|
||||
while (aliases[i]) {
|
||||
/* Scope unset or equal to the function we compare to, and the alias applies to fn */
|
||||
if (alias->alias == NULL && alias->modifiers != 0
|
||||
&& (!alias->trait_method->ce || fn->common.scope == alias->trait_method->ce)
|
||||
&& (alias->trait_method->mname_len == fnname_len)
|
||||
&& (zend_binary_strcasecmp(alias->trait_method->method_name, alias->trait_method->mname_len, lcname, fnname_len) == 0)) {
|
||||
if (aliases[i]->alias == NULL && aliases[i]->modifiers != 0
|
||||
&& (!aliases[i]->trait_method->ce || fn->common.scope == aliases[i]->trait_method->ce)
|
||||
&& (aliases[i]->trait_method->mname_len == fnname_len)
|
||||
&& (zend_binary_strcasecmp(aliases[i]->trait_method->method_name, aliases[i]->trait_method->mname_len, fn->common.function_name, fnname_len) == 0)) {
|
||||
fn_copy.common.fn_flags = aliases[i]->modifiers | ZEND_ACC_ALIAS;
|
||||
|
||||
fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK));
|
||||
if (!(aliases[i]->modifiers & ZEND_ACC_PPP_MASK)) {
|
||||
fn_copy.common.fn_flags |= ZEND_ACC_PUBLIC;
|
||||
}
|
||||
fn_copy.common.fn_flags |= fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK);
|
||||
|
||||
/** Record the trait from which this alias was resolved. */
|
||||
if (!alias->trait_method->ce) {
|
||||
alias->trait_method->ce = fn->common.scope;
|
||||
if (!aliases[i]->trait_method->ce) {
|
||||
aliases[i]->trait_method->ce = fn->common.scope;
|
||||
}
|
||||
}
|
||||
alias_ptr++;
|
||||
alias = *alias_ptr;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
zend_add_trait_method(ce, fn->common.function_name, lcname, fnname_len+1, &fn_copy, overriden TSRMLS_CC);
|
||||
if (zend_hash_add(target, lcname, fnname_len+1, &fn_copy, sizeof(zend_function), NULL)==FAILURE) {
|
||||
zend_error(E_COMPILE_ERROR, "Failed to add trait method (%s) to the trait table. There is probably already a trait method with the same name", fn_copy.common.function_name);
|
||||
}
|
||||
}
|
||||
|
||||
efree(lcname);
|
||||
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void zend_check_trait_usage(zend_class_entry *ce, zend_class_entry *trait TSRMLS_DC) /* {{{ */
|
||||
/* Copies function table entries to target function table with applied aliasing */
|
||||
static void zend_traits_copy_trait_function_table(HashTable *target, HashTable *source, zend_trait_alias** aliases, HashTable* exclude_table TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_uint i;
|
||||
|
||||
if ((trait->ce_flags & ZEND_ACC_TRAIT) != ZEND_ACC_TRAIT) {
|
||||
zend_error(E_COMPILE_ERROR, "Class %s is not a trait, Only traits may be used in 'as' and 'insteadof' statements", trait->name);
|
||||
}
|
||||
|
||||
for (i = 0; i < ce->num_traits; i++) {
|
||||
if (ce->traits[i] == trait) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
zend_error(E_COMPILE_ERROR, "Required Trait %s wasn't added to %s", trait->name, ce->name);
|
||||
zend_hash_apply_with_arguments(source TSRMLS_CC, (apply_func_args_t)zend_traits_copy_functions, 3, target, aliases, exclude_table);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -3892,7 +3980,6 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
|
||||
ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
|
||||
zend_error(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name);
|
||||
}
|
||||
zend_check_trait_usage(ce, cur_precedence->trait_method->ce TSRMLS_CC);
|
||||
|
||||
/** Ensure that the prefered method is actually available. */
|
||||
lcname = zend_str_tolower_dup(cur_method_ref->method_name,
|
||||
@@ -3921,9 +4008,8 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
|
||||
|
||||
if (!(cur_precedence->exclude_from_classes[j] = zend_fetch_class(class_name, name_length, ZEND_FETCH_CLASS_TRAIT |ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
|
||||
zend_error(E_COMPILE_ERROR, "Could not find trait %s", class_name);
|
||||
}
|
||||
zend_check_trait_usage(ce, cur_precedence->exclude_from_classes[j] TSRMLS_CC);
|
||||
|
||||
}
|
||||
|
||||
/* make sure that the trait method is not from a class mentioned in
|
||||
exclude_from_classes, for consistency */
|
||||
if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[i]) {
|
||||
@@ -3952,7 +4038,6 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
|
||||
if (!(cur_method_ref->ce = zend_fetch_class(cur_method_ref->class_name, cur_method_ref->cname_len, ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
|
||||
zend_error(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name);
|
||||
}
|
||||
zend_check_trait_usage(ce, cur_method_ref->ce TSRMLS_CC);
|
||||
|
||||
/** And, ensure that the referenced method is resolvable, too. */
|
||||
lcname = zend_str_tolower_dup(cur_method_ref->method_name,
|
||||
@@ -4002,45 +4087,70 @@ static void zend_traits_compile_exclude_table(HashTable* exclude_table, zend_tra
|
||||
|
||||
static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_uint i;
|
||||
HashTable *overriden = NULL;
|
||||
HashTable** function_tables;
|
||||
HashTable* resulting_table;
|
||||
HashTable exclude_table;
|
||||
size_t i;
|
||||
|
||||
/* prepare copies of trait function tables for combination */
|
||||
function_tables = emalloc(sizeof(HashTable*) * ce->num_traits);
|
||||
resulting_table = (HashTable *)emalloc(sizeof(HashTable));
|
||||
|
||||
/* TODO: revisit this start size, may be its not optimal */
|
||||
zend_hash_init_ex(resulting_table, 10, NULL, NULL, 0, 0);
|
||||
|
||||
for (i = 0; i < ce->num_traits; i++) {
|
||||
if (ce->trait_precedences) {
|
||||
HashTable exclude_table;
|
||||
function_tables[i] = (HashTable *)emalloc(sizeof(HashTable));
|
||||
zend_hash_init_ex(function_tables[i], ce->traits[i]->function_table.nNumOfElements, NULL, NULL, 1, 0);
|
||||
|
||||
if (ce->trait_precedences) {
|
||||
/* TODO: revisit this start size, may be its not optimal */
|
||||
zend_hash_init_ex(&exclude_table, 2, NULL, NULL, 0, 0);
|
||||
|
||||
zend_traits_compile_exclude_table(&exclude_table, ce->trait_precedences, ce->traits[i]);
|
||||
|
||||
/* copies functions, applies defined aliasing, and excludes unused trait methods */
|
||||
zend_hash_apply_with_arguments(&ce->traits[i]->function_table TSRMLS_CC, (apply_func_args_t)zend_traits_copy_functions, 3, ce, &overriden, &exclude_table);
|
||||
|
||||
zend_traits_copy_trait_function_table(function_tables[i], &ce->traits[i]->function_table, ce->trait_aliases, &exclude_table TSRMLS_CC);
|
||||
zend_hash_destroy(&exclude_table);
|
||||
} else {
|
||||
zend_hash_apply_with_arguments(&ce->traits[i]->function_table TSRMLS_CC, (apply_func_args_t)zend_traits_copy_functions, 3, ce, &overriden, NULL);
|
||||
zend_traits_copy_trait_function_table(function_tables[i], &ce->traits[i]->function_table, ce->trait_aliases, NULL TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
zend_hash_apply_with_argument(&ce->function_table, (apply_func_arg_t)zend_fixup_trait_method, ce TSRMLS_CC);
|
||||
|
||||
if (overriden) {
|
||||
zend_hash_destroy(overriden);
|
||||
FREE_HASHTABLE(overriden);
|
||||
/* now merge trait methods */
|
||||
for (i = 0; i < ce->num_traits; i++) {
|
||||
zend_hash_apply_with_arguments(function_tables[i] TSRMLS_CC, (apply_func_args_t)zend_traits_merge_functions, 5, i, ce->num_traits, resulting_table, function_tables, ce);
|
||||
}
|
||||
|
||||
/* Now the resulting_table contains all trait methods we would have to
|
||||
* add to the class in the following step the methods are inserted into the method table
|
||||
* if there is already a method with the same name it is replaced iff ce != fn.scope
|
||||
* --> all inherited methods are overridden, methods defined in the class are left untouched
|
||||
*/
|
||||
zend_hash_apply_with_arguments(resulting_table TSRMLS_CC, (apply_func_args_t)zend_traits_merge_functions_to_class, 1, ce);
|
||||
|
||||
/* free temporary function tables */
|
||||
for (i = 0; i < ce->num_traits; i++) {
|
||||
/* zend_hash_destroy(function_tables[i]); */
|
||||
zend_hash_graceful_destroy(function_tables[i]);
|
||||
efree(function_tables[i]);
|
||||
}
|
||||
efree(function_tables);
|
||||
|
||||
/* free temporary resulting table */
|
||||
/* zend_hash_destroy(resulting_table); */
|
||||
zend_hash_graceful_destroy(resulting_table);
|
||||
efree(resulting_table);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t current_trait, const char* prop_name, int prop_name_length, ulong prop_hash, zend_class_entry *coliding_ce) /* {{{ */
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (coliding_ce == ce) {
|
||||
for (i = 0; i < current_trait; i++) {
|
||||
if (zend_hash_quick_exists(&ce->traits[i]->properties_info, prop_name, prop_name_length+1, prop_hash)) {
|
||||
return ce->traits[i];
|
||||
}
|
||||
zend_property_info *coliding_prop;
|
||||
for (i = 0; (i < current_trait) && (i < ce->num_traits); i++) {
|
||||
if (zend_hash_quick_find(&ce->traits[i]->properties_info, prop_name, prop_name_length+1, prop_hash, (void **) &coliding_prop) == SUCCESS) {
|
||||
return ce->traits[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4048,6 +4158,54 @@ static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t curr
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void zend_traits_register_private_property(zend_class_entry *ce, const char *name, int name_len, zend_property_info *old_info, zval *property TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
char *priv_name;
|
||||
int priv_name_length;
|
||||
const char *interned_name;
|
||||
zend_property_info property_info;
|
||||
ulong h = zend_get_hash_value(name, name_len+1);
|
||||
property_info = *old_info;
|
||||
|
||||
if (old_info->flags & ZEND_ACC_STATIC) {
|
||||
property_info.offset = ce->default_static_members_count++;
|
||||
ce->default_static_members_table = perealloc(ce->default_static_members_table, sizeof(zval*) * ce->default_static_members_count, ce->type == ZEND_INTERNAL_CLASS);
|
||||
ce->default_static_members_table[property_info.offset] = property;
|
||||
if (ce->type == ZEND_USER_CLASS) {
|
||||
ce->static_members_table = ce->default_static_members_table;
|
||||
}
|
||||
} else {
|
||||
property_info.offset = ce->default_properties_count++;
|
||||
ce->default_properties_table = perealloc(ce->default_properties_table, sizeof(zval*) * ce->default_properties_count, ce->type == ZEND_INTERNAL_CLASS);
|
||||
ce->default_properties_table[property_info.offset] = property;
|
||||
}
|
||||
|
||||
zend_mangle_property_name(&priv_name, &priv_name_length, ce->name, ce->name_length, name, name_len, ce->type & ZEND_INTERNAL_CLASS);
|
||||
property_info.name = priv_name;
|
||||
property_info.name_length = priv_name_length;
|
||||
|
||||
interned_name = zend_new_interned_string(property_info.name, property_info.name_length+1, 0 TSRMLS_CC);
|
||||
if (interned_name != property_info.name) {
|
||||
if (ce->type == ZEND_USER_CLASS) {
|
||||
efree((char*)property_info.name);
|
||||
} else {
|
||||
free((char*)property_info.name);
|
||||
}
|
||||
property_info.name = interned_name;
|
||||
}
|
||||
|
||||
property_info.h = zend_get_hash_value(property_info.name, property_info.name_length+1);
|
||||
|
||||
property_info.ce = ce;
|
||||
|
||||
if (property_info.doc_comment) {
|
||||
property_info.doc_comment = estrndup(property_info.doc_comment, property_info.doc_comment_len);
|
||||
}
|
||||
|
||||
zend_hash_quick_update(&ce->properties_info, name, name_len+1, h, &property_info, sizeof(zend_property_info), NULL);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
size_t i;
|
||||
@@ -4061,8 +4219,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
|
||||
zend_bool not_compatible;
|
||||
zval* prop_value;
|
||||
char* doc_comment;
|
||||
zend_uint flags;
|
||||
|
||||
|
||||
/* In the following steps the properties are inserted into the property table
|
||||
* for that, a very strict approach is applied:
|
||||
* - check for compatibility, if not compatible with any property in class -> fatal
|
||||
@@ -4075,8 +4232,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
|
||||
/* first get the unmangeld name if necessary,
|
||||
* then check whether the property is already there
|
||||
*/
|
||||
flags = property_info->flags;
|
||||
if ((flags & ZEND_ACC_PPP_MASK) == ZEND_ACC_PUBLIC) {
|
||||
if ((property_info->flags & ZEND_ACC_PPP_MASK) == ZEND_ACC_PUBLIC) {
|
||||
prop_hash = property_info->h;
|
||||
prop_name = property_info->name;
|
||||
prop_name_length = property_info->name_length;
|
||||
@@ -4090,50 +4246,61 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
|
||||
|
||||
/* next: check for conflicts with current class */
|
||||
if (zend_hash_quick_find(&ce->properties_info, prop_name, prop_name_length+1, prop_hash, (void **) &coliding_prop) == SUCCESS) {
|
||||
if (coliding_prop->flags & ZEND_ACC_SHADOW) {
|
||||
zend_hash_quick_del(&ce->properties_info, prop_name, prop_name_length+1, prop_hash);
|
||||
flags |= ZEND_ACC_CHANGED;
|
||||
} else {
|
||||
if ((coliding_prop->flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))
|
||||
== (flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))) {
|
||||
/* flags are identical, now the value needs to be checked */
|
||||
if (flags & ZEND_ACC_STATIC) {
|
||||
not_compatible = (FAILURE == compare_function(&compare_result,
|
||||
ce->default_static_members_table[coliding_prop->offset],
|
||||
ce->traits[i]->default_static_members_table[property_info->offset] TSRMLS_CC))
|
||||
|| (Z_LVAL(compare_result) != 0);
|
||||
if (coliding_prop->flags & ZEND_ACC_SHADOW) {
|
||||
/* this one is inherited, lets look it up in its own class */
|
||||
zend_hash_quick_find(&coliding_prop->ce->properties_info, prop_name, prop_name_length+1, prop_hash, (void **) &coliding_prop);
|
||||
if (coliding_prop->flags & ZEND_ACC_PRIVATE) {
|
||||
/* private property, make the property_info.offset indenpended */
|
||||
if (property_info->flags & ZEND_ACC_STATIC) {
|
||||
prop_value = ce->traits[i]->default_static_members_table[property_info->offset];
|
||||
} else {
|
||||
not_compatible = (FAILURE == compare_function(&compare_result,
|
||||
ce->default_properties_table[coliding_prop->offset],
|
||||
ce->traits[i]->default_properties_table[property_info->offset] TSRMLS_CC))
|
||||
|| (Z_LVAL(compare_result) != 0);
|
||||
prop_value = ce->traits[i]->default_properties_table[property_info->offset];
|
||||
}
|
||||
} else {
|
||||
/* the flags are not identical, thus, we assume properties are not compatible */
|
||||
not_compatible = 1;
|
||||
}
|
||||
Z_ADDREF_P(prop_value);
|
||||
|
||||
if (not_compatible) {
|
||||
zend_error(E_COMPILE_ERROR,
|
||||
zend_traits_register_private_property(ce, prop_name, prop_name_length, property_info, prop_value TSRMLS_CC);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ((coliding_prop->flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))
|
||||
== (property_info->flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))) {
|
||||
/* flags are identical, now the value needs to be checked */
|
||||
if (property_info->flags & ZEND_ACC_STATIC) {
|
||||
not_compatible = (FAILURE == compare_function(&compare_result,
|
||||
ce->default_static_members_table[coliding_prop->offset],
|
||||
ce->traits[i]->default_static_members_table[property_info->offset] TSRMLS_CC))
|
||||
|| (Z_LVAL(compare_result) != 0);
|
||||
} else {
|
||||
not_compatible = (FAILURE == compare_function(&compare_result,
|
||||
ce->default_properties_table[coliding_prop->offset],
|
||||
ce->traits[i]->default_properties_table[property_info->offset] TSRMLS_CC))
|
||||
|| (Z_LVAL(compare_result) != 0);
|
||||
}
|
||||
} else {
|
||||
/* the flags are not identical, thus, we assume properties are not compatible */
|
||||
not_compatible = 1;
|
||||
}
|
||||
|
||||
if (not_compatible) {
|
||||
zend_error(E_COMPILE_ERROR,
|
||||
"%s and %s define the same property ($%s) in the composition of %s. However, the definition differs and is considered incompatible. Class was composed",
|
||||
find_first_definition(ce, i, prop_name, prop_name_length, prop_hash, coliding_prop->ce)->name,
|
||||
property_info->ce->name,
|
||||
prop_name,
|
||||
ce->name);
|
||||
} else {
|
||||
zend_error(E_STRICT,
|
||||
} else {
|
||||
zend_error(E_STRICT,
|
||||
"%s and %s define the same property ($%s) in the composition of %s. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed",
|
||||
find_first_definition(ce, i, prop_name, prop_name_length, prop_hash, coliding_prop->ce)->name,
|
||||
property_info->ce->name,
|
||||
prop_name,
|
||||
ce->name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* property not found, so lets add it */
|
||||
if (flags & ZEND_ACC_STATIC) {
|
||||
if (property_info->flags & ZEND_ACC_STATIC) {
|
||||
prop_value = ce->traits[i]->default_static_members_table[property_info->offset];
|
||||
} else {
|
||||
prop_value = ce->traits[i]->default_properties_table[property_info->offset];
|
||||
@@ -4142,7 +4309,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
|
||||
|
||||
doc_comment = property_info->doc_comment ? estrndup(property_info->doc_comment, property_info->doc_comment_len) : NULL;
|
||||
zend_declare_property_ex(ce, prop_name, prop_name_length,
|
||||
prop_value, flags,
|
||||
prop_value, property_info->flags,
|
||||
doc_comment, property_info->doc_comment_len TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
@@ -4266,6 +4433,20 @@ ZEND_API int do_bind_function(const zend_op_array *op_array, zend_op *opline, Ha
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_add_trait_precedence(znode *precedence_znode TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_class_entry *ce = CG(active_class_entry);
|
||||
zend_add_to_list(&ce->trait_precedences, precedence_znode->u.op.ptr TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_add_trait_alias(znode *alias_znode TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_class_entry *ce = CG(active_class_entry);
|
||||
zend_add_to_list(&ce->trait_aliases, alias_znode->u.op.ptr TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_prepare_reference(znode *result, znode *class_name, znode *method_name TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_trait_method_reference *method_ref = emalloc(sizeof(zend_trait_method_reference));
|
||||
@@ -4290,25 +4471,18 @@ void zend_prepare_reference(znode *result, znode *class_name, znode *method_name
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_add_trait_alias(znode *method_reference, znode *modifiers, znode *alias TSRMLS_DC) /* {{{ */
|
||||
void zend_prepare_trait_alias(znode *result, znode *method_reference, znode *modifiers, znode *alias TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_class_entry *ce = CG(active_class_entry);
|
||||
zend_trait_alias *trait_alias;
|
||||
zend_trait_alias *trait_alias = emalloc(sizeof(zend_trait_alias));
|
||||
|
||||
trait_alias->trait_method = (zend_trait_method_reference*)method_reference->u.op.ptr;
|
||||
trait_alias->modifiers = Z_LVAL(modifiers->u.constant);
|
||||
|
||||
if (Z_LVAL(modifiers->u.constant) == ZEND_ACC_STATIC) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use 'static' as method modifier");
|
||||
return;
|
||||
} else if (Z_LVAL(modifiers->u.constant) == ZEND_ACC_ABSTRACT) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use 'abstract' as method modifier");
|
||||
return;
|
||||
} else if (Z_LVAL(modifiers->u.constant) == ZEND_ACC_FINAL) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use 'final' as method modifier");
|
||||
return;
|
||||
}
|
||||
|
||||
trait_alias = emalloc(sizeof(zend_trait_alias));
|
||||
trait_alias->trait_method = (zend_trait_method_reference*)method_reference->u.op.ptr;
|
||||
trait_alias->modifiers = Z_LVAL(modifiers->u.constant);
|
||||
if (alias) {
|
||||
trait_alias->alias = Z_STRVAL(alias->u.constant);
|
||||
trait_alias->alias_len = Z_STRLEN(alias->u.constant);
|
||||
@@ -4317,13 +4491,12 @@ void zend_add_trait_alias(znode *method_reference, znode *modifiers, znode *alia
|
||||
}
|
||||
trait_alias->function = NULL;
|
||||
|
||||
zend_add_to_list(&ce->trait_aliases, trait_alias TSRMLS_CC);
|
||||
result->u.op.ptr = trait_alias;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_add_trait_precedence(znode *method_reference, znode *trait_list TSRMLS_DC) /* {{{ */
|
||||
void zend_prepare_trait_precedence(znode *result, znode *method_reference, znode *trait_list TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_class_entry *ce = CG(active_class_entry);
|
||||
zend_trait_precedence *trait_precedence = emalloc(sizeof(zend_trait_precedence));
|
||||
|
||||
trait_precedence->trait_method = (zend_trait_method_reference*)method_reference->u.op.ptr;
|
||||
@@ -4331,7 +4504,7 @@ void zend_add_trait_precedence(znode *method_reference, znode *trait_list TSRMLS
|
||||
|
||||
trait_precedence->function = NULL;
|
||||
|
||||
zend_add_to_list(&ce->trait_precedences, trait_precedence TSRMLS_CC);
|
||||
result->u.op.ptr = trait_precedence;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -4366,7 +4539,7 @@ ZEND_API zend_class_entry *do_bind_class(const zend_op_array* op_array, const ze
|
||||
}
|
||||
return NULL;
|
||||
} else {
|
||||
if (!(ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLEMENT_INTERFACES|ZEND_ACC_IMPLEMENT_TRAITS))) {
|
||||
if (!(ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLEMENT_INTERFACES))) {
|
||||
zend_verify_abstract_class(ce TSRMLS_CC);
|
||||
}
|
||||
return ce;
|
||||
@@ -4798,11 +4971,10 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name
|
||||
/* Prefix class name with name of current namespace */
|
||||
znode tmp;
|
||||
|
||||
tmp.op_type = IS_CONST;
|
||||
tmp.u.constant = *CG(current_namespace);
|
||||
zval_copy_ctor(&tmp.u.constant);
|
||||
zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC);
|
||||
*class_name = tmp;
|
||||
class_name = &tmp;
|
||||
efree(lcname);
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant));
|
||||
}
|
||||
@@ -4935,9 +5107,9 @@ void zend_do_end_class_declaration(const znode *class_token, const znode *parent
|
||||
}
|
||||
|
||||
if (!(ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))
|
||||
&& (parent_token || (ce->num_interfaces > 0))) {
|
||||
&& ((parent_token->op_type != IS_UNUSED) || (ce->num_interfaces > 0))) {
|
||||
zend_verify_abstract_class(ce TSRMLS_CC);
|
||||
if (ce->num_interfaces && !(ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS)) {
|
||||
if (ce->num_interfaces) {
|
||||
do_verify_abstract_class(TSRMLS_C);
|
||||
}
|
||||
}
|
||||
@@ -4987,10 +5159,9 @@ void zend_do_implements_interface(znode *interface_name TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_do_use_trait(znode *trait_name TSRMLS_DC) /* {{{ */
|
||||
void zend_do_implements_trait(znode *trait_name TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_op *opline;
|
||||
|
||||
if ((CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) {
|
||||
zend_error(E_COMPILE_ERROR,
|
||||
"Cannot use traits inside of interfaces. %s is used in %s",
|
||||
@@ -5720,11 +5891,7 @@ void zend_add_to_list(void *result, void *item TSRMLS_DC) /* {{{ */
|
||||
void** list = *(void**)result;
|
||||
size_t n = 0;
|
||||
|
||||
if (list) {
|
||||
while (list[n]) {
|
||||
n++;
|
||||
}
|
||||
}
|
||||
while (list && list[n]) { n++; }
|
||||
|
||||
list = erealloc(list, sizeof(void*) * (n+2));
|
||||
|
||||
|
||||
+11
-6
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -207,6 +207,8 @@ typedef struct _zend_try_catch_element {
|
||||
#define ZEND_ACC_RETURN_REFERENCE 0x4000000
|
||||
#define ZEND_ACC_DONE_PASS_TWO 0x8000000
|
||||
|
||||
#define ZEND_ACC_ALIAS 0x10000000
|
||||
|
||||
char *zend_visibility_string(zend_uint fn_flags);
|
||||
|
||||
|
||||
@@ -507,13 +509,16 @@ ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry
|
||||
void zend_do_implements_interface(znode *interface_znode TSRMLS_DC);
|
||||
|
||||
/* Trait related functions */
|
||||
void zend_do_use_trait(znode *trait_znode TSRMLS_DC);
|
||||
void zend_prepare_reference(znode *result, znode *class_name, znode *method_name TSRMLS_DC);
|
||||
void zend_add_trait_precedence(znode *method_reference, znode *trait_list TSRMLS_DC);
|
||||
void zend_add_trait_alias(znode *method_reference, znode *modifiers, znode *alias TSRMLS_DC);
|
||||
void zend_add_trait_precedence(znode *precedence_znode TSRMLS_DC);
|
||||
void zend_add_trait_alias(znode *alias_znode TSRMLS_DC);
|
||||
|
||||
|
||||
void zend_do_implements_trait(znode *interface_znode /*, znode* aliases */ TSRMLS_DC);
|
||||
ZEND_API void zend_do_implement_trait(zend_class_entry *ce, zend_class_entry *trait TSRMLS_DC);
|
||||
ZEND_API void zend_do_bind_traits(zend_class_entry *ce TSRMLS_DC);
|
||||
void zend_prepare_trait_precedence(znode *result, znode *method_reference, znode *trait_list TSRMLS_DC);
|
||||
void zend_prepare_reference(znode *result, znode *class_name, znode *method_name TSRMLS_DC);
|
||||
void zend_prepare_trait_alias(znode *result, znode *method_reference, znode *modifiers, znode *alias TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce TSRMLS_DC);
|
||||
void zend_do_early_binding(TSRMLS_D);
|
||||
@@ -616,7 +621,7 @@ void zend_do_end_compilation(TSRMLS_D);
|
||||
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(int temporary TSRMLS_DC);
|
||||
void zend_release_labels(TSRMLS_D);
|
||||
|
||||
ZEND_API void function_add_ref(zend_function *function);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+17
-49
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -350,14 +350,9 @@ ZEND_METHOD(error_exception, getSeverity)
|
||||
#define TRACE_APPEND_STR(val) \
|
||||
TRACE_APPEND_STRL(val, sizeof(val)-1)
|
||||
|
||||
#define TRACE_APPEND_KEY(key) \
|
||||
if (zend_hash_find(ht, key, sizeof(key), (void**)&tmp) == SUCCESS) { \
|
||||
if (Z_TYPE_PP(tmp) != IS_STRING) { \
|
||||
zend_error(E_WARNING, "Value for %s is no string", key); \
|
||||
TRACE_APPEND_STR("[unknown]"); \
|
||||
} else { \
|
||||
TRACE_APPEND_STRL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); \
|
||||
} \
|
||||
#define TRACE_APPEND_KEY(key) \
|
||||
if (zend_hash_find(ht, key, sizeof(key), (void**)&tmp) == SUCCESS) { \
|
||||
TRACE_APPEND_STRL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); \
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -466,11 +461,6 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg
|
||||
HashTable *ht = Z_ARRVAL_PP(frame);
|
||||
zval **file, **tmp;
|
||||
|
||||
if (Z_TYPE_PP(frame) != IS_ARRAY) {
|
||||
zend_error(E_WARNING, "Expected array for frame %lu", hash_key->h);
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
}
|
||||
|
||||
str = va_arg(args, char**);
|
||||
len = va_arg(args, int*);
|
||||
num = va_arg(args, int*);
|
||||
@@ -480,25 +470,15 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg
|
||||
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
|
||||
efree(s_tmp);
|
||||
if (zend_hash_find(ht, "file", sizeof("file"), (void**)&file) == SUCCESS) {
|
||||
if (Z_TYPE_PP(file) != IS_STRING) {
|
||||
zend_error(E_WARNING, "Function name is no string");
|
||||
TRACE_APPEND_STR("[unknown function]");
|
||||
} else{
|
||||
if (zend_hash_find(ht, "line", sizeof("line"), (void**)&tmp) == SUCCESS) {
|
||||
if (Z_TYPE_PP(tmp) == IS_LONG) {
|
||||
line = Z_LVAL_PP(tmp);
|
||||
} else {
|
||||
zend_error(E_WARNING, "Line is no long");
|
||||
line = 0;
|
||||
}
|
||||
} else {
|
||||
line = 0;
|
||||
}
|
||||
s_tmp = emalloc(Z_STRLEN_PP(file) + MAX_LENGTH_OF_LONG + 4 + 1);
|
||||
sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_PP(file), line);
|
||||
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
|
||||
efree(s_tmp);
|
||||
if (zend_hash_find(ht, "line", sizeof("line"), (void**)&tmp) == SUCCESS) {
|
||||
line = Z_LVAL_PP(tmp);
|
||||
} else {
|
||||
line = 0;
|
||||
}
|
||||
s_tmp = emalloc(Z_STRLEN_PP(file) + MAX_LENGTH_OF_LONG + 4 + 1);
|
||||
sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_PP(file), line);
|
||||
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
|
||||
efree(s_tmp);
|
||||
} else {
|
||||
TRACE_APPEND_STR("[internal function]: ");
|
||||
}
|
||||
@@ -507,14 +487,10 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg
|
||||
TRACE_APPEND_KEY("function");
|
||||
TRACE_APPEND_CHR('(');
|
||||
if (zend_hash_find(ht, "args", sizeof("args"), (void**)&tmp) == SUCCESS) {
|
||||
if (Z_TYPE_PP(tmp) == IS_ARRAY) {
|
||||
int last_len = *len;
|
||||
zend_hash_apply_with_arguments(Z_ARRVAL_PP(tmp) TSRMLS_CC, (apply_func_args_t)_build_trace_args, 2, str, len);
|
||||
if (last_len != *len) {
|
||||
*len -= 2; /* remove last ', ' */
|
||||
}
|
||||
} else {
|
||||
zend_error(E_WARNING, "args element is no array");
|
||||
int last_len = *len;
|
||||
zend_hash_apply_with_arguments(Z_ARRVAL_PP(tmp) TSRMLS_CC, (apply_func_args_t)_build_trace_args, 2, str, len);
|
||||
if (last_len != *len) {
|
||||
*len -= 2; /* remove last ', ' */
|
||||
}
|
||||
}
|
||||
TRACE_APPEND_STR(")\n");
|
||||
@@ -817,10 +793,6 @@ ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {
|
||||
if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
|
||||
file = zend_read_property(default_exception_ce, EG(exception), "file", sizeof("file")-1, 1 TSRMLS_CC);
|
||||
line = zend_read_property(default_exception_ce, EG(exception), "line", sizeof("line")-1, 1 TSRMLS_CC);
|
||||
|
||||
convert_to_string(file);
|
||||
file = (Z_STRLEN_P(file) > 0) ? file : NULL;
|
||||
line = (Z_TYPE_P(line) == IS_LONG) ? line : NULL;
|
||||
} else {
|
||||
file = NULL;
|
||||
line = NULL;
|
||||
@@ -832,11 +804,7 @@ ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {
|
||||
file = zend_read_property(default_exception_ce, exception, "file", sizeof("file")-1, 1 TSRMLS_CC);
|
||||
line = zend_read_property(default_exception_ce, exception, "line", sizeof("line")-1, 1 TSRMLS_CC);
|
||||
|
||||
convert_to_string(str);
|
||||
convert_to_string(file);
|
||||
convert_to_long(line);
|
||||
|
||||
zend_error_va(severity, (Z_STRLEN_P(file) > 0) ? Z_STRVAL_P(file) : NULL, Z_LVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str));
|
||||
zend_error_va(severity, Z_STRVAL_P(file), Z_LVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str));
|
||||
} else {
|
||||
zend_error(severity, "Uncaught exception '%s'", ce_exception->name);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+4
-5
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -1145,10 +1145,6 @@ 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)) {
|
||||
@@ -1177,6 +1173,9 @@ 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);
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -1313,7 +1313,7 @@ void execute_new_code(TSRMLS_D) /* {{{ */
|
||||
opline++;
|
||||
}
|
||||
|
||||
zend_release_labels(1 TSRMLS_CC);
|
||||
zend_release_labels(TSRMLS_C);
|
||||
|
||||
EG(return_value_ptr_ptr) = NULL;
|
||||
EG(active_op_array) = CG(active_op_array);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -28,7 +28,7 @@
|
||||
#define ZEND_INI_ALL (ZEND_INI_USER|ZEND_INI_PERDIR|ZEND_INI_SYSTEM)
|
||||
|
||||
#ifndef XtOffsetOf
|
||||
# if defined(CRAY) || (defined(__ARMCC_VERSION) && !defined(LINUX))
|
||||
# if defined(CRAY) || (defined(__arm) && !defined(LINUX))
|
||||
# ifdef __STDC__
|
||||
# define XtOffset(p_type, field) _Offsetof(p_type, field)
|
||||
# else
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -452,7 +452,7 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint
|
||||
zval_ptr_dtor(&retval);
|
||||
}
|
||||
|
||||
if (result == FAILURE && !EG(exception)) {
|
||||
if (result == FAILURE) {
|
||||
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "%s::serialize() must return a string or NULL", ce->name);
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+10
-10
@@ -3,7 +3,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -375,13 +375,13 @@ unticked_class_declaration_statement:
|
||||
implements_list
|
||||
'{'
|
||||
class_statement_list
|
||||
'}' { zend_do_end_class_declaration(&$1, &$3 TSRMLS_CC); }
|
||||
'}' { zend_do_end_class_declaration(&$1, &$2 TSRMLS_CC); }
|
||||
| interface_entry T_STRING
|
||||
{ zend_do_begin_class_declaration(&$1, &$2, NULL TSRMLS_CC); }
|
||||
interface_extends_list
|
||||
'{'
|
||||
class_statement_list
|
||||
'}' { zend_do_end_class_declaration(&$1, NULL TSRMLS_CC); }
|
||||
'}' { zend_do_end_class_declaration(&$1, &$2 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
@@ -585,8 +585,8 @@ trait_use_statement:
|
||||
;
|
||||
|
||||
trait_list:
|
||||
fully_qualified_class_name { zend_do_use_trait(&$1 TSRMLS_CC); }
|
||||
| trait_list ',' fully_qualified_class_name { zend_do_use_trait(&$3 TSRMLS_CC); }
|
||||
fully_qualified_class_name { zend_do_implements_trait(&$1 TSRMLS_CC); }
|
||||
| trait_list ',' fully_qualified_class_name { zend_do_implements_trait(&$3 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
trait_adaptations:
|
||||
@@ -605,12 +605,12 @@ non_empty_trait_adaptation_list:
|
||||
;
|
||||
|
||||
trait_adaptation_statement:
|
||||
trait_precedence ';'
|
||||
| trait_alias ';'
|
||||
trait_precedence ';' { zend_add_trait_precedence(&$1 TSRMLS_CC); }
|
||||
| trait_alias ';' { zend_add_trait_alias(&$1 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
trait_precedence:
|
||||
trait_method_reference_fully_qualified T_INSTEADOF trait_reference_list { zend_add_trait_precedence(&$1, &$3 TSRMLS_CC); }
|
||||
trait_method_reference_fully_qualified T_INSTEADOF trait_reference_list { zend_prepare_trait_precedence(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
trait_reference_list:
|
||||
@@ -628,8 +628,8 @@ trait_method_reference_fully_qualified:
|
||||
;
|
||||
|
||||
trait_alias:
|
||||
trait_method_reference T_AS trait_modifiers T_STRING { zend_add_trait_alias(&$1, &$3, &$4 TSRMLS_CC); }
|
||||
| trait_method_reference T_AS member_modifier { zend_add_trait_alias(&$1, &$3, NULL TSRMLS_CC); }
|
||||
trait_method_reference T_AS trait_modifiers T_STRING { zend_prepare_trait_alias(&$$, &$1, &$3, &$4 TSRMLS_CC); }
|
||||
| trait_method_reference T_AS member_modifier { zend_prepare_trait_alias(&$$, &$1, &$3, NULL TSRMLS_CC); }
|
||||
;
|
||||
|
||||
trait_modifiers:
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* Generated by re2c 0.13.5 on Mon May 20 00:45:38 2013 */
|
||||
/* Generated by re2c 0.13.5 on Wed Nov 14 17:46:56 2012 */
|
||||
#line 1 "Zend/zend_language_scanner.l"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -585,7 +585,7 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR
|
||||
compiler_result = zendparse(TSRMLS_C);
|
||||
zend_do_return(&retval_znode, 0 TSRMLS_CC);
|
||||
CG(in_compilation) = original_in_compilation;
|
||||
if (compiler_result != 0) { /* parser error */
|
||||
if (compiler_result==1) { /* parser error */
|
||||
zend_bailout();
|
||||
}
|
||||
compilation_successful=1;
|
||||
@@ -595,7 +595,7 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR
|
||||
CG(active_op_array) = original_active_op_array;
|
||||
if (compilation_successful) {
|
||||
pass_two(op_array TSRMLS_CC);
|
||||
zend_release_labels(0 TSRMLS_CC);
|
||||
zend_release_labels(TSRMLS_C);
|
||||
} else {
|
||||
efree(op_array);
|
||||
retval = NULL;
|
||||
@@ -760,7 +760,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
|
||||
SCNG(script_filtered) = NULL;
|
||||
}
|
||||
|
||||
if (compiler_result != 0) {
|
||||
if (compiler_result==1) {
|
||||
CG(active_op_array) = original_active_op_array;
|
||||
CG(unclean_shutdown)=1;
|
||||
destroy_op_array(op_array TSRMLS_CC);
|
||||
@@ -770,7 +770,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
|
||||
zend_do_return(NULL, 0 TSRMLS_CC);
|
||||
CG(active_op_array) = original_active_op_array;
|
||||
pass_two(op_array TSRMLS_CC);
|
||||
zend_release_labels(0 TSRMLS_CC);
|
||||
zend_release_labels(TSRMLS_C);
|
||||
retval = op_array;
|
||||
}
|
||||
}
|
||||
|
||||
Loaded 100 of 1042 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user