diff options
Diffstat (limited to 'Zend')
131 files changed, 1741 insertions, 390 deletions
diff --git a/Zend/acconfig.h b/Zend/acconfig.h index c136e59b0..13f284110 100644 --- a/Zend/acconfig.h +++ b/Zend/acconfig.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: acconfig.h,v 1.40.2.1.2.2 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: acconfig.h,v 1.40.2.1.2.3 2008/12/31 11:17:32 sebastian Exp $ */ #define ZEND_API #define ZEND_DLEXPORT diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 index 5fb4f4689..51a8aef55 100644 --- a/Zend/acinclude.m4 +++ b/Zend/acinclude.m4 @@ -1,10 +1,10 @@ -dnl $Id: acinclude.m4,v 1.15.2.2.2.2 2006/08/04 06:48:20 derick Exp $ +dnl $Id: acinclude.m4,v 1.15.2.2.2.4 2009/02/14 21:04:07 rasmus Exp $ dnl dnl This file contains local autoconf functions. AC_DEFUN([LIBZEND_BISON_CHECK],[ # we only support certain bison versions - bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3" + bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1" # for standalone build of Zend Engine test -z "$SED" && SED=sed diff --git a/Zend/tests/008.phpt b/Zend/tests/008.phpt index 5b229a070..4f58e80b0 100644 --- a/Zend/tests/008.phpt +++ b/Zend/tests/008.phpt @@ -23,18 +23,18 @@ var_dump(constant("test const")); echo "Done\n"; ?> --EXPECTF-- -Warning: Wrong parameter count for define() in %s on line %d +Warning: define() expects at least 2 parameters, 0 given in %s on line %d NULL -Warning: Wrong parameter count for define() in %s on line %d +Warning: define() expects at least 2 parameters, 1 given in %s on line %d NULL bool(true) -Notice: Constant true already defined in %s on line %d -bool(false) +Warning: define() expects parameter 3 to be boolean, array given in %s on line %d +NULL -Notice: Array to string conversion in %s on line %d -bool(true) +Warning: define() expects parameter 1 to be string, array given in %s on line %d +NULL bool(true) bool(true) bool(true) diff --git a/Zend/tests/access_modifiers_011.phpt b/Zend/tests/access_modifiers_011.phpt new file mode 100644 index 000000000..4ed154f6f --- /dev/null +++ b/Zend/tests/access_modifiers_011.phpt @@ -0,0 +1,39 @@ +--TEST-- +__call() for private/protected methods +--FILE-- +<?php + +class A { + private $var1 = 'var1 value'; + protected $var2 = 'var2 value'; + + private function func1() + { + return "in func1"; + } + protected function func2() + { + return "in func2"; + } + public function __get($var) + { + return $this->$var; + } + public function __call($func, array $args = array()) + { + return call_user_func_array(array($this, $func), $args); + } +} + +$a = new A(); +echo $a->var1,"\n"; +echo $a->var2,"\n"; +echo $a->func1(),"\n"; +echo $a->func2(),"\n"; + +?> +--EXPECTF-- +var1 value +var2 value +in func1 +in func2 diff --git a/Zend/tests/access_modifiers_012.phpt b/Zend/tests/access_modifiers_012.phpt new file mode 100644 index 000000000..ac4d72ce1 --- /dev/null +++ b/Zend/tests/access_modifiers_012.phpt @@ -0,0 +1,21 @@ +--TEST-- +Trigger __call() in lieu of non visible methods when called via a callback. +--FILE-- +<?php +class C { + protected function prot() { } + private function priv() { } + public function __call($name, $args) { + echo "In __call() for method $name()\n"; + } +} + +$c = new C; +call_user_func(array($c, 'none')); +call_user_func(array($c, 'prot')); +call_user_func(array($c, 'priv')); +?> +--EXPECTF-- +In __call() for method none() +In __call() for method prot() +In __call() for method priv() diff --git a/Zend/tests/bug38469.phpt b/Zend/tests/bug38469.phpt index 8c3031ae0..1200335d5 100644 --- a/Zend/tests/bug38469.phpt +++ b/Zend/tests/bug38469.phpt @@ -1,5 +1,5 @@ --TEST--
-Bug #38469 Unexpected creation of cycle
+Bug #38469 (Unexpected creation of cycle)
--FILE--
<?php
$a = array();
@@ -8,6 +8,16 @@ var_dump($a); $b = array(array());
$b[0][0] = $b;
var_dump($b);
+
+function f() {
+ $a = array();
+ $a[0] = $a;
+ var_dump($a);
+ $b = array(array());
+ $b[0][0] = $b;
+ var_dump($b);
+}
+f();
?>
--EXPECT--
array(1) {
@@ -26,3 +36,19 @@ array(1) { }
}
}
+array(1) {
+ [0]=>
+ array(0) {
+ }
+}
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(0) {
+ }
+ }
+ }
+}
diff --git a/Zend/tests/bug40236.phpt b/Zend/tests/bug40236.phpt index dfaa51f8d..c19caefb6 100755 --- a/Zend/tests/bug40236.phpt +++ b/Zend/tests/bug40236.phpt @@ -8,7 +8,7 @@ if (extension_loaded("readline")) die("skip Test doesn't support readline"); --FILE--
<?php
$php = getenv('TEST_PHP_EXECUTABLE');
-$cmd = "$php -d memory_limit=4M -a ".dirname(__FILE__)."/bug40236.inc";
+$cmd = "\"$php\" -n -d memory_limit=4M -a \"".dirname(__FILE__)."\"/bug40236.inc";
echo `$cmd`;
?>
--EXPECTF--
diff --git a/Zend/tests/bug41372.phpt b/Zend/tests/bug41372.phpt index 090efcd31..3446150f5 100755 --- a/Zend/tests/bug41372.phpt +++ b/Zend/tests/bug41372.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #41372 Internal pointer of source array resets during array copying +Bug #41372 (Internal pointer of source array resets during array copying) --FILE-- <?php $Foo = array('val1', 'val2', 'val3'); diff --git a/Zend/tests/bug41919.phpt b/Zend/tests/bug41919.phpt index 3ba9ae0ec..0ac3276b0 100644 --- a/Zend/tests/bug41919.phpt +++ b/Zend/tests/bug41919.phpt @@ -8,4 +8,4 @@ $foo[3]->bar[1] = "bang"; echo "ok\n"; ?> --EXPECTF-- -Fatal error: Cannot use string offset as an object in %s/bug41919.php on line %d +Fatal error: Cannot use string offset as an object in %sbug41919.php on line %d diff --git a/Zend/tests/bug43053.phpt b/Zend/tests/bug43053.phpt new file mode 100644 index 000000000..646aa97d0 --- /dev/null +++ b/Zend/tests/bug43053.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #43053 (Regression: some numbers shown in scientific notation) +--FILE-- +<?php +echo 1200000.00."\n"; +echo 1300000.00."\n"; +echo 1400000.00."\n"; +echo 1500000.00."\n"; +?> +--EXPECT-- +1200000 +1300000 +1400000 +1500000 diff --git a/Zend/tests/bug43128.phpt b/Zend/tests/bug43128.phpt index 4ee676a0a..2832acaeb 100755 --- a/Zend/tests/bug43128.phpt +++ b/Zend/tests/bug43128.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #43128 Very long class name causes segfault +Bug #43128 (Very long class name causes segfault) --FILE-- <?php diff --git a/Zend/tests/bug44830.phpt b/Zend/tests/bug44830.phpt new file mode 100644 index 000000000..21a35ff0c --- /dev/null +++ b/Zend/tests/bug44830.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #44830 (Very minor issue with backslash in heredoc) +--FILE-- +<?php + +$backslash = <<<EOT +\ +EOT; + +var_dump($backslash); + +?> +--EXPECT-- +string(1) "\" diff --git a/Zend/tests/bug45178.phpt b/Zend/tests/bug45178.phpt new file mode 100755 index 000000000..156a5a703 --- /dev/null +++ b/Zend/tests/bug45178.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #45178 memory corruption on assignment result of "new" by reference +--FILE-- +<?php +class Foo { + function __construct() { + $this->error = array($this,$this); + } +} +$a =& new Foo(); + +class Bar { + function __construct() { + $this->_rme2 = $this; + } +} + +$b =& new Bar(); +$b->_rme2 = 0; +var_dump($b); +?> +--EXPECTF-- +Strict Standards: Assigning the return value of new by reference is deprecated in %sbug45178.php on line 7 + +Strict Standards: Assigning the return value of new by reference is deprecated in %sbug45178.php on line 15 +object(Bar)#%d (1) { + ["_rme2"]=> + int(0) +} diff --git a/Zend/tests/bug45805.phpt b/Zend/tests/bug45805.phpt new file mode 100755 index 000000000..662acfbd8 --- /dev/null +++ b/Zend/tests/bug45805.phpt @@ -0,0 +1,48 @@ +--TEST-- +Bug #45805 (Crash on throwing exception from error handler) +--SKIPIF-- +<?php if (!extension_loaded('reflection') || !extension_loaded('spl')) print "skip"; ?> +--FILE-- +<?php +class PHPUnit_Util_ErrorHandler +{ + public static function handleError($errno, $errstr, $errfile, $errline) + { + throw new RuntimeException; + } +} + +class A { + public function getX() { + return NULL; + } +} + +class B { + public function foo() { + $obj = new A; + $source = &$obj->getX(); + } + + public function bar() { + $m = new ReflectionMethod('B', 'foo'); + $m->invoke($this); + } +} + +set_error_handler( + array('PHPUnit_Util_ErrorHandler', 'handleError'), E_ALL | E_STRICT +); + +$o = new B; +$o->bar(); +?> +--EXPECTF-- +Fatal error: Uncaught exception 'RuntimeException' in %sbug45805.php:%d +Stack trace: +#0 %sbug45805.php(%d): PHPUnit_Util_ErrorHandler::handleError(2048, 'Only variables ...', '%s', %d, Array) +#1 [internal function]: B->foo() +#2 %sbug45805.php(%d): ReflectionMethod->invoke(Object(B)) +#3 %sbug45805.php(%d): B->bar() +#4 {main} + thrown in %sbug45805.php on line %d diff --git a/Zend/tests/bug45862.phpt b/Zend/tests/bug45862.phpt new file mode 100644 index 000000000..f70c14234 --- /dev/null +++ b/Zend/tests/bug45862.phpt @@ -0,0 +1,43 @@ +--TEST-- +Bug #45862 (get_class_vars is inconsistent with 'protected' and 'private' variables) +--FILE-- +<?php + +class Ancestor { + function test() { + var_dump(get_class_vars("Tester")); + var_dump(Tester::$prot); + } +} + +class Tester extends Ancestor { + static protected $prot = "protected var"; + static private $priv = "private var"; +} + +class Child extends Tester { + function test() { var_dump(get_class_vars("Tester")); } +} + +echo "\n From parent scope\n"; +$parent = new Ancestor(); +$parent->test(); +echo "\n From child scope\n"; +$child = new Child(); +$child->test(); + +?> +--EXPECT-- + + From parent scope +array(1) { + ["prot"]=> + string(13) "protected var" +} +string(13) "protected var" + + From child scope +array(1) { + ["prot"]=> + string(13) "protected var" +} diff --git a/Zend/tests/bug46246.phpt b/Zend/tests/bug46246.phpt new file mode 100644 index 000000000..a57222bf2 --- /dev/null +++ b/Zend/tests/bug46246.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #46246 (difference between call_user_func(array($this, $method)) and $this->$method()) +--FILE-- +<?php +class A +{ + private function Test() + { + echo 'Hello from '.get_class($this)."\n"; + } + + public function call($method, $args = array()) + { + $this->Test(); + $this->$method(); + call_user_func(array($this, $method)); + } +} + +class B extends A +{ + protected function Test() + { + echo 'Overridden hello from '.get_class($this)."\n"; + } +} + +$a = new A; +$b = new B; + +$a->call('Test'); +$b->call('Test'); +?> +--EXPECT-- +Hello from A +Hello from A +Hello from A +Hello from B +Hello from B +Hello from B diff --git a/Zend/tests/bug46308.phpt b/Zend/tests/bug46308.phpt new file mode 100644 index 000000000..37227385c --- /dev/null +++ b/Zend/tests/bug46308.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #46308 (Invalid write when changing property from inside getter) +--FILE-- +<?php +class main +{ + public static $dummy = NULL ; + public static $dataAccessor = NULL ; +} + +class dataAccessor +{ +} + +class relay +{ + public function __get( $name ) + { + main::$dataAccessor = new dataAccessor; + } +} + +class dummy +{ +} + +main::$dummy = new dummy(); +main::$dataAccessor = new relay(); +main::$dataAccessor->bar; +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/Zend/tests/bug46381.phpt b/Zend/tests/bug46381.phpt new file mode 100644 index 000000000..4d58e9fdf --- /dev/null +++ b/Zend/tests/bug46381.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #46381 (wrong $this passed to internal methods causes segfault) +--SKIPIF-- +<?php if (!extension_loaded("spl")) die("skip SPL is no available"); ?> +--FILE-- +<?php + +class test { + public function test() { + return ArrayIterator::current(); + } +} +$test = new test(); +$test->test(); + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Non-static method ArrayIterator::current() cannot be called statically, assuming $this from incompatible context in %s on line %d diff --git a/Zend/tests/bug46701.phpt b/Zend/tests/bug46701.phpt new file mode 100644 index 000000000..69222a3a1 --- /dev/null +++ b/Zend/tests/bug46701.phpt @@ -0,0 +1,38 @@ +--TEST-- +Bug #46701 (Creating associative array with long values in the key fails on 32bit linux) +--SKIPIF-- +<?php if (PHP_INT_SIZE != 4) die('skip this test is for 32bit platforms only'); ?> +--FILE-- +<?php + +$test_array = array( + 0xcc5c4600 => 1, + 0xce331a00 => 2 +); +$test_array[0xce359000] = 3; + +var_dump($test_array); +var_dump($test_array[0xce331a00]); + +class foo { + public $x; + + public function __construct() { + $this->x[0xce359000] = 3; + var_dump($this->x); + } +} + +new foo; + +?> +--EXPECT-- +array(1) { + [-2147483648]=> + int(3) +} +int(3) +array(1) { + [-2147483648]=> + int(3) +} diff --git a/Zend/tests/bug47109.phpt b/Zend/tests/bug47109.phpt new file mode 100644 index 000000000..b374202be --- /dev/null +++ b/Zend/tests/bug47109.phpt @@ -0,0 +1,11 @@ +--TEST--
+Bug #47109 (Memory leak on $a->{"a"."b"} when $a is not an object)
+--FILE--
+<?php
+$a->{"a"."b"};
+?>
+--EXPECTF--
+Notice: Undefined variable: a in %sbug47109.php on line 2
+
+Notice: Trying to get property of non-object in %sbug47109.php on line 2
+
diff --git a/Zend/tests/bug47165.phpt b/Zend/tests/bug47165.phpt new file mode 100644 index 000000000..2cf648d85 --- /dev/null +++ b/Zend/tests/bug47165.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #47165 (Possible memory corruption when passing return value by reference) +--FILE-- +<?php +class Foo { + var $bar = array(); + + static function bar() { + static $instance = null; + $instance = new Foo(); + return $instance->bar; + } +} +extract(Foo::bar()); +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/Zend/tests/bug47353.phpt b/Zend/tests/bug47353.phpt new file mode 100644 index 000000000..4196fc77f --- /dev/null +++ b/Zend/tests/bug47353.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #47353 (crash when creating a lot of objects in object destructor) +--FILE-- +<?php + +class A +{ + function __destruct() + { + $myArray = array(); + + for($i = 1; $i <= 3000; $i++) { + if(!isset($myArray[$i])) + $myArray[$i] = array(); + $ref = & $myArray[$i]; + $ref[] = new stdClass(); + } + } +} + +$a = new A(); + +echo "Done\n"; +?> +--EXPECTF-- +Done diff --git a/Zend/tests/declare_001.phpt b/Zend/tests/declare_001.phpt new file mode 100644 index 000000000..8f6f73347 --- /dev/null +++ b/Zend/tests/declare_001.phpt @@ -0,0 +1,16 @@ +--TEST-- +Testing declare statement with several type values +--FILE-- +<?php + +declare(encoding = 1); +declare(encoding = 1123131232131312321); +declare(encoding = NULL); +declare(encoding = M_PI); +declare(encoding = 'utf-8'); + +print 'DONE'; + +?> +--EXPECT-- +DONE diff --git a/Zend/tests/exception_009.phpt b/Zend/tests/exception_009.phpt new file mode 100644 index 000000000..b22b3aa66 --- /dev/null +++ b/Zend/tests/exception_009.phpt @@ -0,0 +1,28 @@ +--TEST-- +Testing exception properties +--FILE-- +<?php + +class my_file +{ + public function __toString() + { + return "somebuildfilename" ; + } +} + +class my_exception extends exception +{ + public function __construct() + { + $this->message = new stdclass ; + $this->file = new my_file ; + $this->line = "12" ; + } +} + +throw new my_exception; + +?> +--EXPECT-- +Catchable fatal error: Object of class stdClass could not be converted to string in Unknown on line 0 diff --git a/Zend/tests/get_class_methods_001.phpt b/Zend/tests/get_class_methods_001.phpt new file mode 100644 index 000000000..277ea2cf5 --- /dev/null +++ b/Zend/tests/get_class_methods_001.phpt @@ -0,0 +1,55 @@ +--TEST-- +get_class_methods(): Testing scope +--FILE-- +<?php + +abstract class A { + public function a() { } + private function b() { } + protected function c() { } +} + +class B extends A { + private function bb() { } + + static public function test() { + var_dump(get_class_methods('A')); + var_dump(get_class_methods('B')); + } +} + + +var_dump(get_class_methods('A')); +var_dump(get_class_methods('B')); + + +B::test(); + +?> +--EXPECT-- +array(1) { + [0]=> + string(1) "a" +} +array(2) { + [0]=> + string(4) "test" + [1]=> + string(1) "a" +} +array(2) { + [0]=> + string(1) "a" + [1]=> + string(1) "c" +} +array(4) { + [0]=> + string(2) "bb" + [1]=> + string(4) "test" + [2]=> + string(1) "a" + [3]=> + string(1) "c" +} diff --git a/Zend/tests/get_class_methods_002.phpt b/Zend/tests/get_class_methods_002.phpt new file mode 100644 index 000000000..27da6e8d9 --- /dev/null +++ b/Zend/tests/get_class_methods_002.phpt @@ -0,0 +1,43 @@ +--TEST-- +get_class_methods(): Testing with interface +--FILE-- +<?php + +interface A { + function a(); + function b(); +} + +class B implements A { + public function a() { } + public function b() { } + + public function __construct() { + var_dump(get_class_methods('A')); + var_dump(get_class_methods('B')); + } + + public function __destruct() { } +} + +new B; + +?> +--EXPECTF-- +Strict Standards: Redefining already defined constructor for class B in %s on line %d +array(2) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" +} +array(4) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(11) "__construct" + [3]=> + string(10) "__destruct" +} diff --git a/Zend/tests/get_class_methods_003.phpt b/Zend/tests/get_class_methods_003.phpt new file mode 100644 index 000000000..bbb758625 --- /dev/null +++ b/Zend/tests/get_class_methods_003.phpt @@ -0,0 +1,78 @@ +--TEST-- +get_class_methods(): Testing scope +--FILE-- +<?php + +interface A { + function aa(); + function bb(); + static function cc(); +} + +class C { + public function a() { } + protected function b() { } + private function c() { } + + static public function static_a() { } + static protected function static_b() { } + static private function static_c() { } +} + +class B extends C implements A { + public function aa() { } + public function bb() { } + + static function cc() { } + + public function __construct() { + var_dump(get_class_methods('A')); + var_dump(get_class_methods('B')); + var_dump(get_class_methods('C')); + } + + public function __destruct() { } +} + +new B; + +?> +--EXPECT-- +array(3) { + [0]=> + string(2) "aa" + [1]=> + string(2) "bb" + [2]=> + string(2) "cc" +} +array(9) { + [0]=> + string(2) "aa" + [1]=> + string(2) "bb" + [2]=> + string(2) "cc" + [3]=> + string(11) "__construct" + [4]=> + string(10) "__destruct" + [5]=> + string(1) "a" + [6]=> + string(1) "b" + [7]=> + string(8) "static_a" + [8]=> + string(8) "static_b" +} +array(4) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(8) "static_a" + [3]=> + string(8) "static_b" +} diff --git a/Zend/tests/get_class_vars_001.phpt b/Zend/tests/get_class_vars_001.phpt new file mode 100644 index 000000000..ada0be6da --- /dev/null +++ b/Zend/tests/get_class_vars_001.phpt @@ -0,0 +1,33 @@ +--TEST-- +get_class_vars(): Simple test +--FILE-- +<?php + +class A { + public $a = 1; + private $b = 2; + private $c = 3; +} + +class B extends A { + static public $aa = 4; + static private $bb = 5; + static protected $cc = 6; +} + + +var_dump(get_class_vars('A')); +var_dump(get_class_vars('B')); + +?> +--EXPECT-- +array(1) { + ["a"]=> + int(1) +} +array(2) { + ["a"]=> + int(1) + ["aa"]=> + int(4) +} diff --git a/Zend/tests/get_class_vars_002.phpt b/Zend/tests/get_class_vars_002.phpt new file mode 100644 index 000000000..721ebe692 --- /dev/null +++ b/Zend/tests/get_class_vars_002.phpt @@ -0,0 +1,49 @@ +--TEST-- +get_class_vars(): Testing the scope +--FILE-- +<?php + +class A { + public $a = 1; + private $b = 2; + private $c = 3; +} + +class B extends A { + static public $aa = 4; + static private $bb = 5; + static protected $cc = 6; +} + +class C extends B { + public function __construct() { + var_dump(get_class_vars('A')); + var_dump(get_class_vars('B')); + + var_dump($this->a, $this->b, $this->c); + } +} + +new C; + +?> +--EXPECTF-- +array(1) { + ["a"]=> + int(1) +} +array(3) { + ["a"]=> + int(1) + ["aa"]=> + int(4) + ["cc"]=> + int(6) +} + +Notice: Undefined property: C::$b in %s on line %d + +Notice: Undefined property: C::$c in %s on line %d +int(1) +NULL +NULL diff --git a/Zend/tests/get_class_vars_003.phpt b/Zend/tests/get_class_vars_003.phpt new file mode 100644 index 000000000..f9dab77c2 --- /dev/null +++ b/Zend/tests/get_class_vars_003.phpt @@ -0,0 +1,47 @@ +--TEST-- +get_class_vars(): Testing the scope +--FILE-- +<?php + +class A { + public $a = 1; + private $b = 2; + private $c = 3; +} + +class B extends A { + static public $aa = 4; + static private $bb = 5; + static protected $cc = 6; + + protected function __construct() { + var_dump(get_class_vars('C')); + } +} + +class C extends B { + public $aaa = 7; + private $bbb = 8; + protected $ccc = 9; + + public function __construct() { + parent::__construct(); + } +} + +new C; + +?> +--EXPECT-- +array(5) { + ["aaa"]=> + int(7) + ["ccc"]=> + int(9) + ["a"]=> + int(1) + ["aa"]=> + int(4) + ["cc"]=> + int(6) +} diff --git a/Zend/tests/get_class_vars_004.phpt b/Zend/tests/get_class_vars_004.phpt new file mode 100644 index 000000000..26cd461ba --- /dev/null +++ b/Zend/tests/get_class_vars_004.phpt @@ -0,0 +1,67 @@ +--TEST-- +get_class_vars(): Testing the scope +--FILE-- +<?php + +class A { + public $a = 1; + static public $A = 2; + + private $b = 3; + static private $B = 4; + + protected $c = 5; + static protected $C = 6; + + public function __construct() { + var_dump(get_class_vars('A')); + } + + static public function test() { + var_dump(get_class_vars('A')); + } +} + +var_dump(get_class_vars('A')); + +new A; + +var_dump(A::test()); + +?> +--EXPECT-- +array(2) { + ["a"]=> + int(1) + ["A"]=> + int(2) +} +array(6) { + ["a"]=> + int(1) + ["b"]=> + int(3) + ["c"]=> + int(5) + ["A"]=> + int(2) + ["B"]=> + int(4) + ["C"]=> + int(6) +} +array(6) { + ["a"]=> + int(1) + ["b"]=> + int(3) + ["c"]=> + int(5) + ["A"]=> + int(2) + ["B"]=> + int(4) + ["C"]=> + int(6) +} +NULL diff --git a/Zend/tests/get_class_vars_005.phpt b/Zend/tests/get_class_vars_005.phpt new file mode 100644 index 000000000..51f54900a --- /dev/null +++ b/Zend/tests/get_class_vars_005.phpt @@ -0,0 +1,39 @@ +--TEST-- +get_class_vars(): Testing visibility +--FILE-- +<?php + +class A { + protected $a = 1; + private $b = 2; +} + +class B extends A { + private $c = 3; + public function __construct() { + var_dump(get_class_vars('A')); + var_dump(get_class_vars('B')); + } +} + +var_dump(get_class_vars('A')); +var_dump(get_class_vars('B')); + +new B; + +?> +--EXPECT-- +array(0) { +} +array(0) { +} +array(1) { + ["a"]=> + int(1) +} +array(2) { + ["c"]=> + int(3) + ["a"]=> + int(1) +} diff --git a/Zend/tests/get_class_vars_006.phpt b/Zend/tests/get_class_vars_006.phpt new file mode 100644 index 000000000..73de66ba9 --- /dev/null +++ b/Zend/tests/get_class_vars_006.phpt @@ -0,0 +1,48 @@ +--TEST-- +get_class_vars(): Testing visibility +--FILE-- +<?php + +class A { + protected $a = 1; +} + +class B extends A { } + +class C extends B { } + +var_dump(get_class_vars('A')); +var_dump(get_class_vars('B')); +var_dump(get_class_vars('C')); + +print "---\n"; + +class D extends B { + public function __construct() { + var_dump(get_class_vars('A')); + var_dump(get_class_vars('B')); + var_dump(get_class_vars('C')); + } +} + +new D; + +?> +--EXPECT-- +array(0) { +} +array(0) { +} +array(0) { +} +--- +array(1) { + ["a"]=> + int(1) +} +array(1) { + ["a"]=> + int(1) +} +array(0) { +} diff --git a/Zend/tests/get_class_vars_007.phpt b/Zend/tests/get_class_vars_007.phpt new file mode 100644 index 000000000..6aea0e248 --- /dev/null +++ b/Zend/tests/get_class_vars_007.phpt @@ -0,0 +1,41 @@ +--TEST-- +get_class_vars(): Testing with static properties +--FILE-- +<?php + +class A { + static public $a, $aa; + static private $b, $bb; + static protected $c, $cc; + + static public function test() { + var_dump(get_class_vars(__CLASS__)); + } +} + +var_dump(get_class_vars('A')); +var_dump(A::test()); + +?> +--EXPECT-- +array(2) { + ["a"]=> + NULL + ["aa"]=> + NULL +} +array(6) { + ["a"]=> + NULL + ["aa"]=> + NULL + ["b"]=> + NULL + ["bb"]=> + NULL + ["c"]=> + NULL + ["cc"]=> + NULL +} +NULL diff --git a/Zend/tests/hex_overflow_32bit.phpt b/Zend/tests/hex_overflow_32bit.phpt index 36e9a7e9d..0f192f349 100644 --- a/Zend/tests/hex_overflow_32bit.phpt +++ b/Zend/tests/hex_overflow_32bit.phpt @@ -22,7 +22,7 @@ foreach ($doubles as $d) { echo "Done\n"; ?> --EXPECTF-- -float(4083360297110%d) +float(4.0833602971%dE+14) float(4.7223664828%dE+21) float(1.3521606402%dE+31) float(1.9807040628%dE+27) diff --git a/Zend/tests/isset_001.phpt b/Zend/tests/isset_001.phpt new file mode 100644 index 000000000..340b23701 --- /dev/null +++ b/Zend/tests/isset_001.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing isset and unset with variable variables +--FILE-- +<?php + +print "- isset ---\n"; + +$var_name = 'unexisting'; + +if (isset($$var_name)) { + print "error\n"; +} + +$test = 'var_name'; + +if (isset($$$test)) { + print "error\n"; +} + +print "- unset ---\n"; + +unset($$var_name); + +unset($$$test); + +print "done\n"; + +?> +--EXPECT-- +- isset --- +- unset --- +done diff --git a/Zend/tests/isset_002.phpt b/Zend/tests/isset_002.phpt new file mode 100644 index 000000000..8dd3acc73 --- /dev/null +++ b/Zend/tests/isset_002.phpt @@ -0,0 +1,10 @@ +--TEST-- +Testing isset with several undefined variables as argument +--FILE-- +<?php + +var_dump(isset($a, ${$b}, $$c, $$$$d, $e[$f->g]->d)); + +?> +--EXPECT-- +bool(false) diff --git a/Zend/tests/isset_003.phpt b/Zend/tests/isset_003.phpt new file mode 100644 index 000000000..68c26f80f --- /dev/null +++ b/Zend/tests/isset_003.phpt @@ -0,0 +1,40 @@ +--TEST-- +Testing isset accessing undefined array itens and properties +--FILE-- +<?php + +$a = 'foo'; +$b =& $a; + +var_dump(isset($b)); + +var_dump(isset($a[0], $b[1])); + +var_dump(isset($a[0]->a)); + +var_dump(isset($c[0][1][2]->a->b->c->d)); + +var_dump(isset(${$a}->{$b->$c[$d]})); + +var_dump(isset($GLOBALS)); + +var_dump(isset($GLOBALS[1])); + +var_dump(isset($GLOBALS[1]->$GLOBALS)); + +?> +--EXPECTF-- +bool(true) +bool(true) +bool(false) +bool(false) + +Notice: Undefined variable: d in %s on line %d + +Notice: Undefined variable: c in %s on line %d + +Notice: Trying to get property of non-object in %s on line %d +bool(false) +bool(true) +bool(false) +bool(false) diff --git a/Zend/tests/method_exists_002.phpt b/Zend/tests/method_exists_002.phpt new file mode 100644 index 000000000..cd49bdfc9 --- /dev/null +++ b/Zend/tests/method_exists_002.phpt @@ -0,0 +1,74 @@ +--TEST-- +Testing method_exists() +--FILE-- +<?php + +class bar { + static public function stat_a2() { + } + static private function stat_b2() { + } + static protected function stat_c2() { + } + + private function method_a() { + } + protected function method_b() { + } + public function method_c() { + } +} + + + +class baz extends bar { + static public function stat_a() { + } + static private function stat_b() { + } + static protected function stat_c() { + } + + private function method_a() { + } + protected function method_b() { + } + public function method_c() { + } +} + +var_dump(method_exists('baz', 'stat_a')); +var_dump(method_exists('baz', 'stat_b')); +var_dump(method_exists('baz', 'stat_c')); +print "----\n"; +var_dump(method_exists('baz', 'stat_a2')); +var_dump(method_exists('baz', 'stat_b2')); +var_dump(method_exists('baz', 'stat_c2')); +print "----\n"; + +$baz = new baz; +var_dump(method_exists($baz, 'method_a')); +var_dump(method_exists($baz, 'method_b')); +var_dump(method_exists($baz, 'method_c')); +print "----\n"; +var_dump(method_exists($baz, 'stat_a')); +var_dump(method_exists($baz, 'stat_b')); +var_dump(method_exists($baz, 'stat_c')); + +?> +--EXPECT-- +bool(true) +bool(true) +bool(true) +---- +bool(true) +bool(true) +bool(true) +---- +bool(true) +bool(true) +bool(true) +---- +bool(true) +bool(true) +bool(true) diff --git a/Zend/tests/unset.inc b/Zend/tests/unset.inc index ecdde1581..ef809b393 100644 --- a/Zend/tests/unset.inc +++ b/Zend/tests/unset.inc @@ -1,3 +1,5 @@ -<?php
-unset($x)
-?>
+<?php + +unset($x) + +?> diff --git a/Zend/tests/zend_strtod.phpt b/Zend/tests/zend_strtod.phpt index 1b11be038..7f4bca596 100644 --- a/Zend/tests/zend_strtod.phpt +++ b/Zend/tests/zend_strtod.phpt @@ -15,5 +15,5 @@ echo "Done\n"; float(-100) float(808792757210) float(-4.5646456464565E+27) -float(-11276204760067000) +float(-1.1276204760067E+16) Done diff --git a/Zend/zend.c b/Zend/zend.c index 7546dcc21..6a171ba97 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.c,v 1.308.2.12.2.36 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend.c,v 1.308.2.12.2.37 2008/12/31 11:17:32 sebastian Exp $ */ #include "zend.h" #include "zend_extensions.h" @@ -101,7 +101,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-2008 Zend Technologies\n" +#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2009 Zend Technologies\n" #define PRINT_ZVAL_INDENT 4 diff --git a/Zend/zend.h b/Zend/zend.h index d498a56bd..45bb90cb9 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.h,v 1.293.2.11.2.11 2008/02/15 07:44:45 dmitry Exp $ */ +/* $Id: zend.h,v 1.293.2.11.2.12 2008/12/31 11:17:32 sebastian Exp $ */ #ifndef ZEND_H #define ZEND_H diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 1f1e8c839..49568a295 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.296.2.27.2.38 2008/03/06 17:28:47 tony2001 Exp $ */ +/* $Id: zend_API.c,v 1.296.2.27.2.41 2009/01/08 21:39:06 andrei Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -1779,9 +1779,13 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr efree(lc_class_name); } while (ptr->fname) { - if (zend_hash_exists(target_function_table, ptr->fname, strlen(ptr->fname)+1)) { + fname_len = strlen(ptr->fname); + lowercase_name = zend_str_tolower_dup(ptr->fname, fname_len); + if (zend_hash_exists(target_function_table, lowercase_name, fname_len+1)) { + efree(lowercase_name); zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? scope->name : "", scope ? "::" : "", ptr->fname); } + efree(lowercase_name); ptr++; } zend_unregister_functions(functions, count, target_function_table TSRMLS_CC); @@ -2212,6 +2216,10 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze retval = 0; } } + if (!retval && *zobj_ptr_ptr && *ce_ptr && (*ce_ptr)->__call != 0) { + retval = (*ce_ptr)->__call != NULL; + *fptr_ptr = (*ce_ptr)->__call; + } } } } diff --git a/Zend/zend_API.h b/Zend/zend_API.h index e214ff48e..19cfd43b6 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.h,v 1.207.2.8.2.9 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_API.h,v 1.207.2.8.2.10 2008/12/31 11:17:32 sebastian Exp $ */ #ifndef ZEND_API_H #define ZEND_API_H diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 2b5a0716d..942b0d173 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_alloc.c,v 1.144.2.3.2.47 2008/02/14 14:46:48 dmitry Exp $ */ +/* $Id: zend_alloc.c,v 1.144.2.3.2.54 2009/01/25 14:04:09 dsp Exp $ */ #include "zend.h" #include "zend_alloc.h" @@ -164,7 +164,7 @@ static zend_mm_segment* zend_mm_mem_mmap_realloc(zend_mm_storage *storage, zend_ static void zend_mm_mem_mmap_free(zend_mm_storage *storage, zend_mm_segment* segment) { - munmap(segment, segment->size); + munmap((void*)segment, segment->size); } #endif @@ -399,9 +399,9 @@ struct _zend_mm_heap { size_t compact_size; zend_mm_segment *segments_list; zend_mm_storage *storage; - size_t real_size; + size_t real_size; size_t real_peak; - size_t limit; + size_t limit; size_t size; size_t peak; size_t reserve_size; @@ -432,8 +432,8 @@ struct _zend_mm_heap { #define ZEND_MM_REST_BUCKET(heap) \ (zend_mm_free_block*)((char*)&heap->rest_buckets[0] + \ - sizeof(zend_mm_free_block*) * 2 - \ - sizeof(zend_mm_small_free_block)) + sizeof(zend_mm_free_block*) * 2 - \ + sizeof(zend_mm_small_free_block)) #if ZEND_MM_COOKIES @@ -1061,16 +1061,26 @@ ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_mem_handlers *handlers, } if (internal) { int i; - zend_mm_free_block *p; + zend_mm_free_block *p, *q, *orig; zend_mm_heap *mm_heap = _zend_mm_alloc_int(heap, sizeof(zend_mm_heap) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC); *mm_heap = *heap; p = ZEND_MM_SMALL_FREE_BUCKET(mm_heap, 0); + orig = ZEND_MM_SMALL_FREE_BUCKET(heap, 0); for (i = 0; i < ZEND_MM_NUM_BUCKETS; i++) { - p->prev_free_block->next_free_block = p; - p->next_free_block->prev_free_block = p; + q = p; + while (q->prev_free_block != orig) { + q = q->prev_free_block; + } + q->prev_free_block = p; + q = p; + while (q->next_free_block != orig) { + q = q->next_free_block; + } + q->next_free_block = p; p = (zend_mm_free_block*)((char*)p + sizeof(zend_mm_free_block*) * 2); + orig = (zend_mm_free_block*)((char*)orig + sizeof(zend_mm_free_block*) * 2); if (mm_heap->large_free_buckets[i]) { mm_heap->large_free_buckets[i]->parent = &mm_heap->large_free_buckets[i]; } @@ -1115,7 +1125,10 @@ ZEND_API zend_mm_heap *zend_mm_startup(void) if (tmp) { seg_size = zend_atoi(tmp, 0); if (zend_mm_low_bit(seg_size) != zend_mm_high_bit(seg_size)) { - fprintf(stderr, "ZEND_MM_SEG_SIZE must be a power ow two.\n"); + fprintf(stderr, "ZEND_MM_SEG_SIZE must be a power of two\n"); + exit(255); + } else if (seg_size < ZEND_MM_ALIGNED_SEGMENT_SIZE + ZEND_MM_ALIGNED_HEADER_SIZE) { + fprintf(stderr, "ZEND_MM_SEG_SIZE is too small\n"); exit(255); } } else { @@ -1791,7 +1804,7 @@ static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D heap->cache_stat[ZEND_MM_NUM_BUCKETS].miss++; #endif - best_fit = zend_mm_search_large_block(heap, true_size); + best_fit = zend_mm_search_large_block(heap, true_size); if (!best_fit && heap->real_size >= heap->limit - heap->block_size) { zend_mm_free_block *p = heap->rest_buckets[0]; diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index a13eba959..75c0c3f64 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_alloc.h,v 1.63.2.2.2.13 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_alloc.h,v 1.63.2.2.2.17 2009/01/25 13:42:39 dsp Exp $ */ #ifndef ZEND_ALLOC_H #define ZEND_ALLOC_H @@ -78,29 +78,29 @@ ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_ inline static void * __zend_malloc(size_t len) { - void *tmp = malloc(len); - if (tmp) { - return tmp; - } - fprintf(stderr, "Out of memory\n"); - exit(1); + void *tmp = malloc(len); + if (tmp) { + return tmp; + } + fprintf(stderr, "Out of memory\n"); + exit(1); } inline static void * __zend_calloc(size_t nmemb, size_t len) { - void *tmp = _safe_malloc(nmemb, len, 0); - memset(tmp, 0, len); - return tmp; + void *tmp = _safe_malloc(nmemb, len, 0); + memset(tmp, 0, len); + return tmp; } inline static void * __zend_realloc(void *p, size_t len) { - p = realloc(p, len); - if (p) { - return p; - } - fprintf(stderr, "Out of memory\n"); - exit(1); + p = realloc(p, len); + if (p) { + return p; + } + fprintf(stderr, "Out of memory\n"); + exit(1); } @@ -113,6 +113,7 @@ inline static void * __zend_realloc(void *p, size_t len) #define safe_perealloc(ptr, nmemb, size, offset, persistent) ((persistent)?_safe_realloc((ptr), (nmemb), (size), (offset)):safe_erealloc((ptr), (nmemb), (size), (offset))) #define perealloc_recoverable(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc_recoverable((ptr), (size))) #define pestrdup(s, persistent) ((persistent)?strdup(s):estrdup(s)) +#define pestrndup(s, length, persistent) ((persistent)?zend_strndup((s),(length)):estrndup((s),(length))) #define pemalloc_rel(size, persistent) ((persistent)?__zend_malloc(size):emalloc_rel(size)) #define pefree_rel(ptr, persistent) ((persistent)?free(ptr):efree_rel(ptr)) @@ -199,12 +200,12 @@ ZEND_API size_t _zend_mm_block_size(zend_mm_heap *heap, void *p ZEND_FILE_LINE_D #define zend_mm_alloc(heap, size) _zend_mm_alloc((heap), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) #define zend_mm_free(heap, p) _zend_mm_free((heap), (p) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) #define zend_mm_realloc(heap, p, size) _zend_mm_realloc((heap), (p), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define zend_mm_block_size(heap, p) _zend_mm_block_size((heap), (p), ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) +#define zend_mm_block_size(heap, p) _zend_mm_block_size((heap), (p) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) #define zend_mm_alloc_rel(heap, size) _zend_mm_alloc((heap), (size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) #define zend_mm_free_rel(heap, p) _zend_mm_free((heap), (p) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) #define zend_mm_realloc_rel(heap, p, size) _zend_mm_realloc((heap), (p), (size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) -#define zend_mm_block_size_rel(heap, p) _zend_mm_block_size((heap), (p), ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) +#define zend_mm_block_size_rel(heap, p) _zend_mm_block_size((heap), (p) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) /* Heaps with user defined storage */ typedef struct _zend_mm_storage zend_mm_storage; diff --git a/Zend/zend_arg_defs.c b/Zend/zend_arg_defs.c index 0993348da..78e18b723 100644 --- a/Zend/zend_arg_defs.c +++ b/Zend/zend_arg_defs.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_arg_defs.c,v 1.2.2.2.2.3 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_arg_defs.c,v 1.2.2.2.2.4 2008/12/31 11:17:33 sebastian Exp $ */ ZEND_BEGIN_ARG_INFO(first_arg_force_ref, 0) ZEND_ARG_PASS_INFO(1) diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 17c7efb1d..c5525ea85 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.29 2008/02/21 15:14:12 dmitry Exp $ */ +/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.33 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" #include "zend_API.h" @@ -454,35 +454,24 @@ ZEND_FUNCTION(error_reporting) Define a new constant */ ZEND_FUNCTION(define) { - zval **var, **val, **non_cs, *val_free = NULL; - int case_sensitive; + char *name; + int name_len; + zval *val; + zval *val_free = NULL; + zend_bool non_cs = 0; + int case_sensitive = CONST_CS; zend_constant c; - switch (ZEND_NUM_ARGS()) { - case 2: - if (zend_get_parameters_ex(2, &var, &val)==FAILURE) { - RETURN_FALSE; - } - case_sensitive = CONST_CS; - break; - case 3: - if (zend_get_parameters_ex(3, &var, &val, &non_cs)==FAILURE) { - RETURN_FALSE; - } - convert_to_long_ex(non_cs); - if (Z_LVAL_PP(non_cs)) { - case_sensitive = 0; - } else { - case_sensitive = CONST_CS; - } - break; - default: - ZEND_WRONG_PARAM_COUNT(); - break; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|b", &name, &name_len, &val, &non_cs) == FAILURE) { + return; + } + + if(non_cs) { + case_sensitive = 0; } repeat: - switch (Z_TYPE_PP(val)) { + switch (Z_TYPE_P(val)) { case IS_LONG: case IS_DOUBLE: case IS_STRING: @@ -492,13 +481,13 @@ repeat: break; case IS_OBJECT: if (!val_free) { - if (Z_OBJ_HT_PP(val)->get) { - val_free = *val = Z_OBJ_HT_PP(val)->get(*val TSRMLS_CC); + if (Z_OBJ_HT_P(val)->get) { + val_free = val = Z_OBJ_HT_P(val)->get(val TSRMLS_CC); goto repeat; - } else if (Z_OBJ_HT_PP(val)->cast_object) { + } else if (Z_OBJ_HT_P(val)->cast_object) { ALLOC_INIT_ZVAL(val_free); - if (Z_OBJ_HT_PP(val)->cast_object(*val, val_free, IS_STRING TSRMLS_CC) == SUCCESS) { - val = &val_free; + if (Z_OBJ_HT_P(val)->cast_object(val, val_free, IS_STRING TSRMLS_CC) == SUCCESS) { + val = val_free; break; } } @@ -511,16 +500,15 @@ repeat: } RETURN_FALSE; } - convert_to_string_ex(var); - c.value = **val; + c.value = *val; zval_copy_ctor(&c.value); if (val_free) { zval_ptr_dtor(&val_free); } c.flags = case_sensitive; /* non persistent */ - c.name = zend_strndup(Z_STRVAL_PP(var), Z_STRLEN_PP(var)); - c.name_len = Z_STRLEN_PP(var)+1; + c.name = zend_strndup(name, name_len); + c.name_len = name_len+1; c.module_number = PHP_USER_CONSTANT; if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) { RETURN_TRUE; @@ -710,8 +698,6 @@ ZEND_FUNCTION(is_a) /* {{{ add_class_vars */ static void add_class_vars(zend_class_entry *ce, HashTable *properties, zval *return_value TSRMLS_DC) { - int instanceof = EG(scope) && instanceof_function(EG(scope), ce TSRMLS_CC); - if (zend_hash_num_elements(properties) > 0) { HashPosition pos; zval **prop; @@ -720,20 +706,28 @@ static void add_class_vars(zend_class_entry *ce, HashTable *properties, zval *re while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) { char *key, *class_name, *prop_name; uint key_len; - ulong num_index; + ulong num_index, h; + int prop_name_len = 0; zval *prop_copy; + zend_property_info *property_info; zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos); zend_hash_move_forward_ex(properties, &pos); + zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name); - if (class_name) { - if (class_name[0] != '*' && strcmp(class_name, ce->name)) { - /* filter privates from base classes */ - continue; - } else if (!instanceof) { - /* filter protected if not inside class */ - continue; - } + prop_name_len = strlen(prop_name); + + h = zend_get_hash_value(prop_name, prop_name_len+1); + if (zend_hash_quick_find(&ce->properties_info, prop_name, prop_name_len+1, h, (void **) &property_info) == FAILURE) { + continue; + } + + if (property_info->flags & ZEND_ACC_SHADOW) { + continue; + } else if ((property_info->flags & ZEND_ACC_PRIVATE) && EG(scope) != ce) { + continue; + } else if ((property_info->flags & ZEND_ACC_PROTECTED) && zend_check_protected(ce, EG(scope)) == 0) { + continue; } /* copy: enforce read only access */ diff --git a/Zend/zend_builtin_functions.h b/Zend/zend_builtin_functions.h index 6e1d836ea..b8b087e2f 100644 --- a/Zend/zend_builtin_functions.h +++ b/Zend/zend_builtin_functions.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_builtin_functions.h,v 1.17.2.2.2.2 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_builtin_functions.h,v 1.17.2.2.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_BUILTIN_FUNCTIONS_H #define ZEND_BUILTIN_FUNCTIONS_H diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 137d79a76..5c88d09ba 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.647.2.27.2.48 2008/02/20 12:04:49 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27.2.54 2009/01/26 21:27:41 dsp Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -565,6 +565,7 @@ void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC) CG(active_op_array)->vars[value->u.var].name, CG(active_op_array)->vars[value->u.var].name_len, 1); SET_UNUSED(opline->op2); + opline->op2.u.EA.type = ZEND_FETCH_LOCAL; value = &opline->result; } } @@ -655,6 +656,8 @@ void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC) opline->opcode = ZEND_ASSIGN_REF; if (zend_is_function_or_method_call(rvar)) { opline->extended_value = ZEND_RETURNS_FUNCTION; + } else if (rvar->u.EA.type & ZEND_PARSED_NEW) { + opline->extended_value = ZEND_RETURNS_NEW; } else { opline->extended_value = 0; } @@ -1587,20 +1590,34 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) zend_stack_top(&CG(function_call_stack), (void **) &function_ptr_ptr); function_ptr = *function_ptr_ptr; - if (original_op==ZEND_SEND_REF - && !CG(allow_call_time_pass_reference)) { - zend_error(E_COMPILE_WARNING, - "Call-time pass-by-reference has been deprecated; " - "If you would like to pass it by reference, modify the declaration of %s(). " - "If you would like to enable call-time pass-by-reference, you can set " - "allow_call_time_pass_reference to true in your INI file", - (function_ptr ? function_ptr->common.function_name : "[runtime function name]")); + if (original_op == ZEND_SEND_REF && !CG(allow_call_time_pass_reference)) { + if (function_ptr && + function_ptr->common.function_name && + function_ptr->common.type == ZEND_USER_FUNCTION && + !ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) { + zend_error(E_COMPILE_WARNING, + "Call-time pass-by-reference has been deprecated; " + "If you would like to pass it by reference, modify the declaration of %s(). " + "If you would like to enable call-time pass-by-reference, you can set " + "allow_call_time_pass_reference to true in your INI file", function_ptr->common.function_name); + } else { + zend_error(E_COMPILE_WARNING, "Call-time pass-by-reference has been deprecated"); + } } if (function_ptr) { if (ARG_MAY_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) { - op = (param->op_type & (IS_VAR|IS_CV))?ZEND_SEND_REF:ZEND_SEND_VAL; - send_by_reference = 0; + if (param->op_type & (IS_VAR|IS_CV)) { + send_by_reference = 1; + if (op == ZEND_SEND_VAR && zend_is_function_or_method_call(param)) { + /* Method call */ + op = ZEND_SEND_VAR_NO_REF; + send_function = ZEND_ARG_SEND_FUNCTION | ZEND_ARG_SEND_SILENT; + } + } else { + op = ZEND_SEND_VAL; + send_by_reference = 0; + } } else { send_by_reference = ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset) ? ZEND_ARG_SEND_BY_REF : 0; } @@ -2522,7 +2539,7 @@ void zend_do_early_binding(TSRMLS_D) /* clear unnecessary ZEND_FETCH_CLASS opcode */ if (opline > CG(active_op_array)->opcodes && (opline-1)->opcode == ZEND_FETCH_CLASS) { - zend_op *fetch_class_opline = opline-1; + zend_op *fetch_class_opline = opline-1; zval_dtor(&fetch_class_opline->op2.u.constant); fetch_class_opline->opcode = ZEND_NOP; diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 2d567f8ae..fed2b78d3 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.h,v 1.316.2.8.2.13 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_compile.h,v 1.316.2.8.2.16 2009/01/21 10:15:46 dmitry Exp $ */ #ifndef ZEND_COMPILE_H #define ZEND_COMPILE_H @@ -600,6 +600,7 @@ int zendlex(znode *zendlval TSRMLS_DC); #define ZEND_PARSED_FUNCTION_CALL (1<<3) #define ZEND_PARSED_VARIABLE (1<<4) #define ZEND_PARSED_REFERENCE_VARIABLE (1<<5) +#define ZEND_PARSED_NEW (1<<6) /* unset types */ @@ -658,6 +659,7 @@ int zendlex(znode *zendlval TSRMLS_DC); #define ZEND_ARG_SEND_BY_REF (1<<0) #define ZEND_ARG_COMPILE_TIME_BOUND (1<<1) #define ZEND_ARG_SEND_FUNCTION (1<<2) +#define ZEND_ARG_SEND_SILENT (1<<3) #define ZEND_SEND_BY_VAL 0 #define ZEND_SEND_BY_REF 1 @@ -685,6 +687,7 @@ int zendlex(znode *zendlval TSRMLS_DC); #define ZEND_RETURNS_FUNCTION 1<<0 +#define ZEND_RETURNS_NEW 1<<1 END_EXTERN_C() diff --git a/Zend/zend_config.nw.h b/Zend/zend_config.nw.h index 7ef9dea79..0ff7ebb1d 100644 --- a/Zend/zend_config.nw.h +++ b/Zend/zend_config.nw.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_config.nw.h,v 1.8.2.1.2.2 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_config.nw.h,v 1.8.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_CONFIG_NW_H #define ZEND_CONFIG_NW_H diff --git a/Zend/zend_config.w32.h b/Zend/zend_config.w32.h index ffc016c83..a71dce3f5 100644 --- a/Zend/zend_config.w32.h +++ b/Zend/zend_config.w32.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_config.w32.h,v 1.39.2.2.2.3 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_config.w32.h,v 1.39.2.2.2.4 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_CONFIG_W32_H #define ZEND_CONFIG_W32_H diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index b0114f8cb..fd090a323 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_constants.c,v 1.71.2.5.2.9 2008/02/19 12:00:36 dmitry Exp $ */ +/* $Id: zend_constants.c,v 1.71.2.5.2.10 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" #include "zend_constants.h" diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h index c55fe0b38..a9187f5f6 100644 --- a/Zend/zend_constants.h +++ b/Zend/zend_constants.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_constants.h,v 1.31.2.2.2.4 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_constants.h,v 1.31.2.2.2.5 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_CONSTANTS_H #define ZEND_CONSTANTS_H diff --git a/Zend/zend_default_classes.c b/Zend/zend_default_classes.c index e3d258adf..2cc46a5fb 100644 --- a/Zend/zend_default_classes.c +++ b/Zend/zend_default_classes.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_default_classes.c,v 1.59.2.2.2.2 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_default_classes.c,v 1.59.2.2.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" #include "zend_API.h" diff --git a/Zend/zend_dynamic_array.c b/Zend/zend_dynamic_array.c index f335054d2..18e1ed348 100644 --- a/Zend/zend_dynamic_array.c +++ b/Zend/zend_dynamic_array.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_dynamic_array.c,v 1.13.2.1.2.2 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_dynamic_array.c,v 1.13.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" diff --git a/Zend/zend_dynamic_array.h b/Zend/zend_dynamic_array.h index e7b0bcc26..b34a7e7cc 100644 --- a/Zend/zend_dynamic_array.h +++ b/Zend/zend_dynamic_array.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_dynamic_array.h,v 1.14.2.1.2.2 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_dynamic_array.h,v 1.14.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_DYNAMIC_ARRAY_H #define ZEND_DYNAMIC_ARRAY_H diff --git a/Zend/zend_errors.h b/Zend/zend_errors.h index 5f547aef2..f3659d99c 100644 --- a/Zend/zend_errors.h +++ b/Zend/zend_errors.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_errors.h,v 1.18.2.1.2.6 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_errors.h,v 1.18.2.1.2.7 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_ERRORS_H #define ZEND_ERRORS_H diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 612bd3b77..b53c227e3 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_exceptions.c,v 1.79.2.6.2.10 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_exceptions.c,v 1.79.2.6.2.11 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" #include "zend_API.h" diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h index b2bfa47b2..f8755127b 100644 --- a/Zend/zend_exceptions.h +++ b/Zend/zend_exceptions.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_exceptions.h,v 1.21.2.1.2.3 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_exceptions.h,v 1.21.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_EXCEPTIONS_H #define ZEND_EXCEPTIONS_H diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 4b97cd41f..382b472c5 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.716.2.12.2.28 2008/03/04 11:48:53 dmitry Exp $ */ +/* $Id: zend_execute.c,v 1.716.2.12.2.32 2009/02/15 14:31:17 iliaa Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -1402,6 +1402,7 @@ ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_v } \ EG(in_execution) = EX(original_in_execution); \ EG(current_execute_data) = EX(prev_execute_data); \ + EG(opline_ptr) = NULL; \ ZEND_VM_RETURN() #include "zend_vm_execute.h" diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 9b0b83655..e0aa7cddc 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.h,v 1.84.2.4.2.9 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_execute.h,v 1.84.2.4.2.10 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_EXECUTE_H #define ZEND_EXECUTE_H diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 5470218b4..1e3d1e08d 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.331.2.20.2.27 2008/03/04 11:46:09 dmitry Exp $ */ +/* $Id: zend_execute_API.c,v 1.331.2.20.2.30 2009/01/15 14:23:42 dmitry Exp $ */ #include <stdio.h> #include <signal.h> @@ -824,7 +824,9 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS } EX(function_state).function = Z_OBJ_HT_PP(fci->object_pp)->get_method(fci->object_pp, fname, fname_len TSRMLS_CC); - if (EX(function_state).function && calling_scope != EX(function_state).function->common.scope) { + if (EX(function_state).function && + (EX(function_state).function->common.fn_flags & ZEND_ACC_PRIVATE) == 0 && + calling_scope != EX(function_state).function->common.scope) { char *function_name_lc = zend_str_tolower_dup(fname, fname_len); if (zend_hash_find(&calling_scope->function_table, function_name_lc, fname_len+1, (void **) &EX(function_state).function)==FAILURE) { efree(function_name_lc); @@ -899,6 +901,26 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS } } + /* Prevent crash because of stack reallocation */ + if (!call_via_handler && + fci->param_count && + EG(argument_stack).top + fci->param_count > EG(argument_stack).max && + *(void***)fci->params >= EG(argument_stack).elements && + *(void***)fci->params < EG(argument_stack).top_element) { + + /* Manual stack reallocation */ + void **prev_elements = EG(argument_stack).elements; + void **prev_top_element = EG(argument_stack).top_element; + + ZEND_PTR_STACK_RESIZE_IF_NEEDED((&EG(argument_stack)), fci->param_count); + for (i=0; i<fci->param_count; i++) { + if ((void**)fci->params[i] >= prev_elements && + (void**)fci->params[i] < prev_top_element) { + fci->params[i] = (zval**)((void**)fci->params[i] - prev_elements + EG(argument_stack).elements); + } + } + } + for (i=0; i<fci->param_count; i++) { zval *param; diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c index 2add51c21..c38880255 100644 --- a/Zend/zend_extensions.c +++ b/Zend/zend_extensions.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_extensions.c,v 1.48.2.1.2.4 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_extensions.c,v 1.48.2.1.2.5 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend_extensions.h" diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index 24923f220..634a532c9 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_extensions.h,v 1.67.2.3.2.4 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_extensions.h,v 1.67.2.3.2.5 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_EXTENSIONS_H #define ZEND_EXTENSIONS_H diff --git a/Zend/zend_fast_cache.h b/Zend/zend_fast_cache.h index 6da941d00..f054a0aac 100644 --- a/Zend/zend_fast_cache.h +++ b/Zend/zend_fast_cache.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_fast_cache.h,v 1.21.2.1.2.3 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_fast_cache.h,v 1.21.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ #if 0 #ifndef ZEND_FAST_CACHE_H #define ZEND_FAST_CACHE_H diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index d5e5cd59e..79fa71b92 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_globals.h,v 1.141.2.3.2.8 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_globals.h,v 1.141.2.3.2.9 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_GLOBALS_H #define ZEND_GLOBALS_H diff --git a/Zend/zend_globals_macros.h b/Zend/zend_globals_macros.h index b0892afef..52d3f926b 100644 --- a/Zend/zend_globals_macros.h +++ b/Zend/zend_globals_macros.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_globals_macros.h,v 1.22.2.1.2.5 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_globals_macros.h,v 1.22.2.1.2.6 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_GLOBALS_MACROS_H #define ZEND_GLOBALS_MACROS_H diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index f3297ca5d..887a7545e 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_hash.c,v 1.121.2.4.2.9 2007/12/31 07:20:02 sebastian Exp $ */ +/* $Id: zend_hash.c,v 1.121.2.4.2.10 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 2e1cf9d20..0f991eb5e 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_hash.h,v 1.78.2.2.2.3 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_hash.h,v 1.78.2.2.2.4 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_HASH_H #define ZEND_HASH_H diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c index 4371cdb5c..a2fe8b623 100644 --- a/Zend/zend_highlight.c +++ b/Zend/zend_highlight.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_highlight.c,v 1.49.2.3.2.3 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_highlight.c,v 1.49.2.3.2.4 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" #include <zend_language_parser.h> diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h index a9c83484a..3c26e3b53 100644 --- a/Zend/zend_highlight.h +++ b/Zend/zend_highlight.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_highlight.h,v 1.25.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_highlight.h,v 1.25.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_HIGHLIGHT_H #define ZEND_HIGHLIGHT_H diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c index ad551602b..79ec45a0e 100644 --- a/Zend/zend_indent.c +++ b/Zend/zend_indent.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_indent.c,v 1.24.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_indent.c,v 1.24.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ /* This indenter doesn't really work, it's here for no particular reason. */ diff --git a/Zend/zend_indent.h b/Zend/zend_indent.h index 21b5d89d8..b4fa1fe7f 100644 --- a/Zend/zend_indent.h +++ b/Zend/zend_indent.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_indent.h,v 1.17.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_indent.h,v 1.17.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_INDENT_H #define ZEND_INDENT_H diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 13b8e38e3..4e8e22bef 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini.c,v 1.39.2.2.2.27 2008/03/13 15:56:21 iliaa Exp $ */ +/* $Id: zend_ini.c,v 1.39.2.2.2.28 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" #include "zend_qsort.h" diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h index ca7acaccf..40e7569d5 100644 --- a/Zend/zend_ini.h +++ b/Zend/zend_ini.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini.h,v 1.34.2.1.2.7 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_ini.h,v 1.34.2.1.2.8 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_INI_H #define ZEND_INI_H diff --git a/Zend/zend_ini_parser.c b/Zend/zend_ini_parser.c index a156b2480..cef2d6acc 100644 --- a/Zend/zend_ini_parser.c +++ b/Zend/zend_ini_parser.c @@ -102,7 +102,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -116,7 +116,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini_parser.y,v 1.41.2.2.2.3 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_ini_parser.y,v 1.41.2.2.2.4 2008/12/31 11:16:12 sebastian Exp $ */ #define DEBUG_CFG_PARSER 0 #include "zend.h" diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y index e20e5b07d..73fd50b05 100644 --- a/Zend/zend_ini_parser.y +++ b/Zend/zend_ini_parser.y @@ -3,7 +3,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini_parser.y,v 1.41.2.2.2.3 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_ini_parser.y,v 1.41.2.2.2.4 2008/12/31 11:16:12 sebastian Exp $ */ #define DEBUG_CFG_PARSER 0 #include "zend.h" diff --git a/Zend/zend_ini_scanner.h b/Zend/zend_ini_scanner.h index 35650f0bd..3824790f7 100644 --- a/Zend/zend_ini_scanner.h +++ b/Zend/zend_ini_scanner.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini_scanner.h,v 1.14.2.1.2.3 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_ini_scanner.h,v 1.14.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef _ZEND_INI_SCANNER_H #define _ZEND_INI_SCANNER_H diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index eb8cb64a1..d7ed87015 100755 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_interfaces.c,v 1.33.2.4.2.7 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_interfaces.c,v 1.33.2.4.2.8 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" #include "zend_API.h" diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h index bb7e00c2a..87ba8e151 100755 --- a/Zend/zend_interfaces.h +++ b/Zend/zend_interfaces.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_interfaces.h,v 1.11.2.1.2.3 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_interfaces.h,v 1.11.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_INTERFACES_H #define ZEND_INTERFACES_H diff --git a/Zend/zend_istdiostream.h b/Zend/zend_istdiostream.h index 0a7c08ffd..db6e5d908 100644 --- a/Zend/zend_istdiostream.h +++ b/Zend/zend_istdiostream.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_istdiostream.h,v 1.6.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_istdiostream.h,v 1.6.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef _ZEND_STDIOSTREAM #define _ZEND_STDIOSTREAM diff --git a/Zend/zend_iterators.c b/Zend/zend_iterators.c index d3f25f47e..18156e392 100755 --- a/Zend/zend_iterators.c +++ b/Zend/zend_iterators.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_iterators.c,v 1.12.2.1.2.3 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_iterators.c,v 1.12.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" #include "zend_API.h" diff --git a/Zend/zend_iterators.h b/Zend/zend_iterators.h index 46b812255..579d55181 100755 --- a/Zend/zend_iterators.h +++ b/Zend/zend_iterators.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_iterators.h,v 1.10.2.1.2.3 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_iterators.h,v 1.10.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ /* These iterators were designed to operate within the foreach() * structures provided by the engine, but could be extended for use diff --git a/Zend/zend_language_parser.c b/Zend/zend_language_parser.c index a9f46ff2a..898e5e56e 100644 --- a/Zend/zend_language_parser.c +++ b/Zend/zend_language_parser.c @@ -339,7 +339,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_parser.y,v 1.160.2.4.2.10 2008/03/10 14:54:47 felipe Exp $ */ +/* $Id: zend_language_parser.y,v 1.160.2.4.2.11 2008/07/24 11:47:12 dmitry Exp $ */ /* * LALR shift/reduce conflicts and how they are resolved: @@ -3845,7 +3845,7 @@ yyreduce: case 207: - { zend_do_end_new_object(&(yyvsp[(3) - (7)]), &(yyvsp[(4) - (7)]), &(yyvsp[(7) - (7)]) TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&(yyval), &(yyvsp[(1) - (7)]), &(yyvsp[(3) - (7)]) TSRMLS_CC); } + { zend_do_end_new_object(&(yyvsp[(3) - (7)]), &(yyvsp[(4) - (7)]), &(yyvsp[(7) - (7)]) TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); (yyvsp[(3) - (7)]).u.EA.type = ZEND_PARSED_NEW; zend_do_assign_ref(&(yyval), &(yyvsp[(1) - (7)]), &(yyvsp[(3) - (7)]) TSRMLS_CC); } break; case 208: diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index aa01fdaf4..f2c6d90c6 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_parser.y,v 1.160.2.4.2.10 2008/03/10 14:54:47 felipe Exp $ */ +/* $Id: zend_language_parser.y,v 1.160.2.4.2.11 2008/07/24 11:47:12 dmitry Exp $ */ /* * LALR shift/reduce conflicts and how they are resolved: @@ -553,7 +553,7 @@ expr_without_variable: T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' '=' expr { zend_do_list_end(&$$, &$7 TSRMLS_CC); } | variable '=' expr { zend_check_writable_variable(&$1); zend_do_assign(&$$, &$1, &$3 TSRMLS_CC); } | variable '=' '&' variable { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); } - | variable '=' '&' T_NEW class_name_reference { zend_error(E_STRICT, "Assigning the return value of new by reference is deprecated"); zend_check_writable_variable(&$1); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$4, &$7 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); } + | variable '=' '&' T_NEW class_name_reference { zend_error(E_STRICT, "Assigning the return value of new by reference is deprecated"); zend_check_writable_variable(&$1); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$4, &$7 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); $3.u.EA.type = ZEND_PARSED_NEW; zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); } | T_NEW class_name_reference { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$1, &$2 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$1, &$4 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} | T_CLONE expr { zend_do_clone(&$$, &$2 TSRMLS_CC); } | variable T_PLUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 TSRMLS_CC); } diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index e2627d800..2e935da55 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -3031,7 +3031,7 @@ char *yytext; +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.l,v 1.131.2.11.2.15 2008/04/09 21:40:13 scottmac Exp $ */ +/* $Id: zend_language_scanner.l,v 1.131.2.11.2.17 2008/05/10 09:18:27 mattwil Exp $ */ #define yyleng SCNG(yy_leng) #define yytext SCNG(yy_text) @@ -3812,9 +3812,11 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo while (s<end) { if (*s=='\\') { s++; - if (s>=end) { - continue; + if (s >= end) { + *t++ = '\\'; + break; } + switch(*s) { case 'n': *t++ = '\n'; @@ -5339,9 +5341,7 @@ YY_RULE_SETUP while (s<end) { if (*s=='\\') { s++; - if (s>=end) { - continue; - } + switch(*s) { case '\\': case '\'': diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h index 024bc279d..c02f13c9f 100644 --- a/Zend/zend_language_scanner.h +++ b/Zend/zend_language_scanner.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.h,v 1.19.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_language_scanner.h,v 1.19.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_SCANNER_H #define ZEND_SCANNER_H diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 55ff5af08..004260388 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.l,v 1.131.2.11.2.15 2008/04/09 21:40:13 scottmac Exp $ */ +/* $Id: zend_language_scanner.l,v 1.131.2.11.2.17 2008/05/10 09:18:27 mattwil Exp $ */ #define yyleng SCNG(yy_leng) #define yytext SCNG(yy_text) @@ -792,9 +792,11 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo while (s<end) { if (*s=='\\') { s++; - if (s>=end) { - continue; + if (s >= end) { + *t++ = '\\'; + break; } + switch(*s) { case 'n': *t++ = '\n'; @@ -1808,9 +1810,7 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ while (s<end) { if (*s=='\\') { s++; - if (s>=end) { - continue; - } + switch(*s) { case '\\': case '\'': diff --git a/Zend/zend_list.c b/Zend/zend_list.c index 4a3fa5189..48cca2c3f 100644 --- a/Zend/zend_list.c +++ b/Zend/zend_list.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_list.c,v 1.66.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_list.c,v 1.66.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ /* resource lists */ @@ -253,7 +253,6 @@ static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id TSRM static int zend_clean_module_rsrc_dtors_cb(zend_rsrc_list_dtors_entry *ld, int *module_number TSRMLS_DC) { if (ld->module_number == *module_number) { - zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC); zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC); return 1; } else { diff --git a/Zend/zend_list.h b/Zend/zend_list.h index 9446ee595..cfe5abbc3 100644 --- a/Zend/zend_list.h +++ b/Zend/zend_list.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_list.h,v 1.48.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_list.h,v 1.48.2.1.2.5 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_LIST_H #define ZEND_LIST_H @@ -95,10 +95,16 @@ extern ZEND_API int le_index_ptr; /* list entry type for index pointers */ #define ZEND_FETCH_RESOURCE(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type) \ rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 1, resource_type); \ ZEND_VERIFY_RESOURCE(rsrc); + +#define ZEND_FETCH_RESOURCE_NO_RETURN(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type) \ + (rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 1, resource_type)) #define ZEND_FETCH_RESOURCE2(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type1, resource_type2) \ rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 2, resource_type1, resource_type2); \ ZEND_VERIFY_RESOURCE(rsrc); + +#define ZEND_FETCH_RESOURCE2_NO_RETURN(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type1, resource_type2) \ + (rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 2, resource_type1, resource_type2)) #define ZEND_REGISTER_RESOURCE(rsrc_result, rsrc_pointer, rsrc_type) \ zend_register_resource(rsrc_result, rsrc_pointer, rsrc_type); diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c index 6a2e29179..70e2b9a9b 100644 --- a/Zend/zend_llist.c +++ b/Zend/zend_llist.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_llist.c,v 1.35.2.1.2.3 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_llist.c,v 1.35.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" #include "zend_llist.h" diff --git a/Zend/zend_llist.h b/Zend/zend_llist.h index 126a7896c..7291da55f 100644 --- a/Zend/zend_llist.h +++ b/Zend/zend_llist.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_llist.h,v 1.33.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_llist.h,v 1.33.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_LLIST_H #define ZEND_LLIST_H diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index 3c6d1f1d2..a26a0f9e1 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_modules.h,v 1.67.2.3.2.5 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_modules.h,v 1.67.2.3.2.6 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef MODULES_H #define MODULES_H diff --git a/Zend/zend_multibyte.c b/Zend/zend_multibyte.c index eae80315a..90bcf8004 100644 --- a/Zend/zend_multibyte.c +++ b/Zend/zend_multibyte.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_multibyte.c,v 1.4.2.4.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_multibyte.c,v 1.4.2.4.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" #include "zend_compile.h" diff --git a/Zend/zend_multibyte.h b/Zend/zend_multibyte.h index 7b364743c..0ffc1b620 100644 --- a/Zend/zend_multibyte.h +++ b/Zend/zend_multibyte.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_multibyte.h,v 1.3.2.3.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_multibyte.h,v 1.3.2.3.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_MULTIBYTE_H #define ZEND_MULTIBYTE_H diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h index 790eca2cc..b84480b57 100644 --- a/Zend/zend_multiply.h +++ b/Zend/zend_multiply.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_multiply.h,v 1.10.2.1.2.3 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_multiply.h,v 1.10.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ #if defined(__i386__) && defined(__GNUC__) diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 221dbbe37..b09668b0d 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.c,v 1.135.2.6.2.28 2008/02/21 13:55:22 dmitry Exp $ */ +/* $Id: zend_object_handlers.c,v 1.135.2.6.2.32 2009/02/17 17:09:05 iliaa Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -328,6 +328,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS && !guard->in_get) { /* have getter - try with it! */ + ZVAL_ADDREF(object); guard->in_get = 1; /* prevent circular getting */ rv = zend_std_call_getter(object, member TSRMLS_CC); guard->in_get = 0; @@ -352,6 +353,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) } else { retval = &EG(uninitialized_zval_ptr); } + zval_ptr_dtor(&object); } else { if (!silent) { zend_error(E_NOTICE,"Undefined property: %s::$%s", zobj->ce->name, Z_STRVAL_P(member)); @@ -422,12 +424,14 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM if (zobj->ce->__set && zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS && !guard->in_set) { + ZVAL_ADDREF(object); guard->in_set = 1; /* prevent circular setting */ if (zend_std_call_setter(object, member, value TSRMLS_CC) != SUCCESS) { /* for now, just ignore it - __set should take care of warnings, etc. */ } setter_done = 1; guard->in_set = 0; + zval_ptr_dtor(&object); } if (!setter_done && property_info) { zval **foo; @@ -468,6 +472,10 @@ zval *zend_std_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) } return 0; } + if (EG(exception)) { + zval_ptr_dtor(&retval); + return 0; + } /* Undo PZVAL_LOCK() */ retval->refcount--; @@ -602,9 +610,11 @@ static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC) zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS && !guard->in_unset) { /* have unseter - try with it! */ + ZVAL_ADDREF(object); guard->in_unset = 1; /* prevent circular unsetting */ zend_std_call_unsetter(object, member TSRMLS_CC); guard->in_unset = 0; + zval_ptr_dtor(&object); } } @@ -752,6 +762,24 @@ static inline zend_class_entry * zend_get_function_root_class(zend_function *fbc } +static inline union _zend_function *zend_get_user_call_function(zend_object *zobj, char *method_name, int method_len) /* {{{ */ +{ + zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function)); + call_user_call->type = ZEND_INTERNAL_FUNCTION; + call_user_call->module = zobj->ce->module; + call_user_call->handler = zend_std_call_user_call; + call_user_call->arg_info = NULL; + call_user_call->num_args = 0; + call_user_call->scope = zobj->ce; + call_user_call->fn_flags = 0; + call_user_call->function_name = estrndup(method_name, method_len); + call_user_call->pass_rest_by_reference = 0; + call_user_call->return_reference = ZEND_RETURN_VALUE; + + return (union _zend_function *)call_user_call; +} +/* }}} */ + static union _zend_function *zend_std_get_method(zval **object_ptr, char *method_name, int method_len TSRMLS_DC) { zend_object *zobj; @@ -768,19 +796,7 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method if (zend_hash_find(&zobj->ce->function_table, lc_method_name, method_len+1, (void **)&fbc) == FAILURE) { free_alloca_with_limit(lc_method_name, use_heap); if (zobj->ce->__call) { - zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function)); - call_user_call->type = ZEND_INTERNAL_FUNCTION; - call_user_call->module = zobj->ce->module; - call_user_call->handler = zend_std_call_user_call; - call_user_call->arg_info = NULL; - call_user_call->num_args = 0; - call_user_call->scope = zobj->ce; - call_user_call->fn_flags = 0; - call_user_call->function_name = estrndup(method_name, method_len); - call_user_call->pass_rest_by_reference = 0; - call_user_call->return_reference = ZEND_RETURN_VALUE; - - return (union _zend_function *)call_user_call; + return zend_get_user_call_function(zobj, method_name, method_len); } else { return NULL; } @@ -791,12 +807,18 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method zend_function *updated_fbc; /* Ensure that if we're calling a private function, we're allowed to do so. + * If we're not and __call() handler exists, invoke it, otherwise error out. */ updated_fbc = zend_check_private_int(fbc, Z_OBJ_HANDLER_P(object, get_class_entry)(object TSRMLS_CC), lc_method_name, method_len TSRMLS_CC); - if (!updated_fbc) { - zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : ""); + if (updated_fbc) { + fbc = updated_fbc; + } else { + if (zobj->ce->__call) { + fbc = zend_get_user_call_function(zobj, method_name, method_len); + } else { + zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : ""); + } } - fbc = updated_fbc; } else { /* Ensure that we haven't overridden a private function and end up calling * the overriding public function... @@ -814,9 +836,14 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method } if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. + * If we're not and __call() handler exists, invoke it, otherwise error out. */ if (!zend_check_protected(zend_get_function_root_class(fbc), EG(scope))) { - zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : ""); + if (zobj->ce->__call) { + fbc = zend_get_user_call_function(zobj, method_name, method_len); + } else { + zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : ""); + } } } } @@ -1020,6 +1047,7 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists zval *rv; /* have issetter - try with it! */ + ZVAL_ADDREF(object); guard->in_isset = 1; /* prevent circular getting */ rv = zend_std_call_issetter(object, member TSRMLS_CC); if (rv) { @@ -1037,6 +1065,7 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists } } guard->in_isset = 0; + zval_ptr_dtor(&object); } } else { switch (has_set_exists) { diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index 5fd5a4f1f..98ed2822b 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.h,v 1.47.2.2.2.6 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_object_handlers.h,v 1.47.2.2.2.7 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_OBJECT_HANDLERS_H #define ZEND_OBJECT_HANDLERS_H diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index 5bee77363..4754c4f9a 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_objects.c,v 1.56.2.3.2.7 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_objects.c,v 1.56.2.3.2.8 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" #include "zend_globals.h" diff --git a/Zend/zend_objects.h b/Zend/zend_objects.h index a598ef4e5..1c93f5c6a 100644 --- a/Zend/zend_objects.h +++ b/Zend/zend_objects.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_objects.h,v 1.25.2.2.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_objects.h,v 1.25.2.2.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_OBJECTS_H #define ZEND_OBJECTS_H diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c index c0d8444af..176b004bc 100644 --- a/Zend/zend_objects_API.c +++ b/Zend/zend_objects_API.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_objects_API.c,v 1.47.2.6.2.7 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_objects_API.c,v 1.47.2.6.2.9 2009/02/11 09:58:33 tony2001 Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -55,6 +55,7 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS if (obj->dtor && obj->object) { obj->refcount++; obj->dtor(obj->object, i TSRMLS_CC); + obj = &objects->object_buckets[i].bucket.obj; obj->refcount--; } } @@ -200,6 +201,10 @@ ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSR } zend_end_try(); } } + + /* re-read the object from the object store as the store might have been reallocated in the dtor */ + obj = &EG(objects_store).object_buckets[handle].bucket.obj; + if (obj->refcount == 1) { if (obj->free_storage) { zend_try { @@ -241,6 +246,7 @@ ZEND_API zend_object_value zend_objects_store_clone_obj(zval *zobject TSRMLS_DC) } obj->clone(obj->object, &new_object TSRMLS_CC); + obj = &EG(objects_store).object_buckets[handle].bucket.obj; retval.handle = zend_objects_store_put(new_object, obj->dtor, obj->free_storage, obj->clone TSRMLS_CC); retval.handlers = Z_OBJ_HT_P(zobject); diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h index bbb26a269..9646c2f5a 100644 --- a/Zend/zend_objects_API.h +++ b/Zend/zend_objects_API.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_objects_API.h,v 1.20.2.1.2.5 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_objects_API.h,v 1.20.2.1.2.6 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_OBJECTS_API_H #define ZEND_OBJECTS_API_H diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 21ab11614..8c7001f45 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_opcode.c,v 1.110.2.6.2.5 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_opcode.c,v 1.110.2.6.2.6 2008/12/31 11:17:33 sebastian Exp $ */ #include <stdio.h> diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index d0c6e4f41..f0f1a761a 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_operators.c,v 1.208.2.4.2.24 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_operators.c,v 1.208.2.4.2.30 2009/02/17 15:15:36 mattwil Exp $ */ #include <ctype.h> @@ -891,6 +891,11 @@ ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) return FAILURE; /* division by zero */ } if (op1->type == IS_LONG && op2->type == IS_LONG) { + if (Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == LONG_MIN) { + /* Prevent overflow error/crash */ + ZVAL_DOUBLE(result, (double) LONG_MIN / -1); + return SUCCESS; + } if (op1->value.lval % op2->value.lval == 0) { /* integer */ result->type = IS_LONG; result->value.lval = op1->value.lval / op2->value.lval; @@ -931,7 +936,8 @@ ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) return FAILURE; /* modulus by zero */ } - if (abs(op2->value.lval) == 1) { + if (op2->value.lval == -1) { + /* Prevent overflow error/crash if op1==LONG_MIN */ ZVAL_LONG(result, 0); return SUCCESS; } diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index a1783c901..41ec72622 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_operators.h,v 1.94.2.4.2.11 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_operators.h,v 1.94.2.4.2.15 2009/02/15 14:31:17 iliaa Exp $ */ #ifndef ZEND_OPERATORS_H #define ZEND_OPERATORS_H @@ -220,6 +220,9 @@ zend_memnstr(char *haystack, char *needle, int needle_len, char *end) char *p = haystack; char ne = needle[needle_len-1]; + if(needle_len > end-haystack) { + return NULL; + } end -= needle_len; while (p <= end) { diff --git a/Zend/zend_ptr_stack.c b/Zend/zend_ptr_stack.c index 62e43fc34..74150e052 100644 --- a/Zend/zend_ptr_stack.c +++ b/Zend/zend_ptr_stack.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ptr_stack.c,v 1.23.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_ptr_stack.c,v 1.23.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" #include "zend_ptr_stack.h" diff --git a/Zend/zend_ptr_stack.h b/Zend/zend_ptr_stack.h index a24e817bb..09274562c 100644 --- a/Zend/zend_ptr_stack.h +++ b/Zend/zend_ptr_stack.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ptr_stack.h,v 1.22.2.2.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_ptr_stack.h,v 1.22.2.2.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_PTR_STACK_H #define ZEND_PTR_STACK_H diff --git a/Zend/zend_qsort.c b/Zend/zend_qsort.c index da42b8ae3..bc2a6522a 100644 --- a/Zend/zend_qsort.c +++ b/Zend/zend_qsort.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_qsort.c,v 1.8.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_qsort.c,v 1.8.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" diff --git a/Zend/zend_qsort.h b/Zend/zend_qsort.h index 89bf7e1ef..920605911 100644 --- a/Zend/zend_qsort.h +++ b/Zend/zend_qsort.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_qsort.h,v 1.8.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_qsort.h,v 1.8.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_QSORT_H #define ZEND_QSORT_H diff --git a/Zend/zend_sprintf.c b/Zend/zend_sprintf.c index 1545e51f3..f415ee48d 100644 --- a/Zend/zend_sprintf.c +++ b/Zend/zend_sprintf.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_sprintf.c,v 1.16.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_sprintf.c,v 1.16.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #include <stdio.h> diff --git a/Zend/zend_stack.c b/Zend/zend_stack.c index 53767e5aa..478ed8288 100644 --- a/Zend/zend_stack.c +++ b/Zend/zend_stack.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_stack.c,v 1.16.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_stack.c,v 1.16.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" #include "zend_stack.h" diff --git a/Zend/zend_stack.h b/Zend/zend_stack.h index 5040f277c..b159d1f33 100644 --- a/Zend/zend_stack.h +++ b/Zend/zend_stack.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_stack.h,v 1.19.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_stack.h,v 1.19.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_STACK_H #define ZEND_STACK_H diff --git a/Zend/zend_static_allocator.c b/Zend/zend_static_allocator.c index ac91ab059..68403adc7 100644 --- a/Zend/zend_static_allocator.c +++ b/Zend/zend_static_allocator.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_static_allocator.c,v 1.13.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_static_allocator.c,v 1.13.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend_static_allocator.h" diff --git a/Zend/zend_static_allocator.h b/Zend/zend_static_allocator.h index f01d9bcee..465179dfc 100644 --- a/Zend/zend_static_allocator.h +++ b/Zend/zend_static_allocator.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_static_allocator.h,v 1.13.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_static_allocator.h,v 1.13.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_STATIC_ALLOCATOR_H #define ZEND_STATIC_ALLOCATOR_H diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c index 3b1113a17..19cd9bb26 100644 --- a/Zend/zend_stream.c +++ b/Zend/zend_stream.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_stream.c,v 1.13.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_stream.c,v 1.13.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" diff --git a/Zend/zend_stream.h b/Zend/zend_stream.h index df5774489..482cc043d 100644 --- a/Zend/zend_stream.h +++ b/Zend/zend_stream.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_stream.h,v 1.8.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_stream.h,v 1.8.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_STREAM_H #define ZEND_STREAM_H diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c index 77e5c82f4..4552640a9 100644 --- a/Zend/zend_strtod.c +++ b/Zend/zend_strtod.c @@ -89,7 +89,7 @@ * directly -- and assumed always to succeed. */ -/* $Id: zend_strtod.c,v 1.17.2.2.2.13 2007/09/04 18:46:21 tony2001 Exp $ */ +/* $Id: zend_strtod.c,v 1.17.2.2.2.15 2008/09/15 11:47:03 dmitry Exp $ */ #include <zend_operators.h> #include <zend_strtod.h> @@ -984,9 +984,9 @@ static Bigint * diff(Bigint *a, Bigint *b) static double ulp (double _x) { - _double x; + volatile _double x; register Long L; - _double a; + volatile _double a; value(x) = _x; L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1; @@ -1026,7 +1026,7 @@ b2d { ULong *xa, *xa0, w, y, z; int k; - _double d; + volatile _double d; #ifdef VAX ULong d0, d1; #else @@ -1092,7 +1092,7 @@ static Bigint * d2b(double _d, int *e, int *bits) Bigint *b; int de, i, k; ULong *x, y, z; - _double d; + volatile _double d; #ifdef VAX ULong d0, d1; #endif @@ -1213,7 +1213,7 @@ static Bigint * d2b(double _d, int *e, int *bits) static double ratio (Bigint *a, Bigint *b) { - _double da, db; + volatile _double da, db; int k, ka, kb; value(da) = b2d(a, &ka); @@ -1480,7 +1480,7 @@ ZEND_API char * zend_dtoa(double _d, int mode, int ndigits, int *decpt, int *sig Bigint *b, *b1, *delta, *mlo, *mhi, *S, *tmp; double ds; char *s, *s0; - _double d, d2, eps; + volatile _double d, d2, eps; value(d) = _d; @@ -1720,14 +1720,7 @@ ZEND_API char * zend_dtoa(double _d, int mode, int ndigits, int *decpt, int *sig if (value(d) > 0.5 + value(eps)) goto bump_up; else if (value(d) < 0.5 - value(eps)) { - /* cut ALL traling zeros only if the number of chars is greater than precision - * otherwise cut only extra zeros - */ - if (k < ndigits) { - while(*--s == '0' && (s - s0) > k); - } else { - while(*--s == '0'); - } + while(*--s == '0'); s++; goto ret1; } @@ -2043,7 +2036,7 @@ ZEND_API double zend_strtod (CONST char *s00, char **se) e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; CONST char *s, *s0, *s1; double aadj, aadj1, adj; - _double rv, rv0; + volatile _double rv, rv0; Long L; ULong y, z; Bigint *bb, *bb1, *bd, *bd0, *bs, *delta, *tmp; diff --git a/Zend/zend_strtod.h b/Zend/zend_strtod.h index 1569c916f..76fa5e473 100644 --- a/Zend/zend_strtod.h +++ b/Zend/zend_strtod.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_strtod.h,v 1.3.2.1.2.5 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_strtod.h,v 1.3.2.1.2.6 2008/12/31 11:17:33 sebastian Exp $ */ /* This is a header file for the strtod implementation by David M. Gay which * can be found in zend_strtod.c */ diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c index c4daeb99e..0b5fa570e 100644 --- a/Zend/zend_ts_hash.c +++ b/Zend/zend_ts_hash.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ts_hash.c,v 1.14.2.1.2.3 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_ts_hash.c,v 1.14.2.1.2.4 2008/12/31 11:17:33 sebastian Exp $ */ #include "zend.h" #include "zend_ts_hash.h" diff --git a/Zend/zend_ts_hash.h b/Zend/zend_ts_hash.h index 8c5a01154..43081df8a 100644 --- a/Zend/zend_ts_hash.h +++ b/Zend/zend_ts_hash.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ts_hash.h,v 1.13.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_ts_hash.h,v 1.13.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_TS_HASH_H #define ZEND_TS_HASH_H diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 9b1cc606b..ef5a5ac5b 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_types.h,v 1.6.2.2.2.4 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_types.h,v 1.6.2.2.2.5 2008/12/31 11:17:33 sebastian Exp $ */ #ifndef ZEND_TYPES_H #define ZEND_TYPES_H diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index 499e46bb6..ce9304c96 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_variables.c,v 1.62.2.1.2.3 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_variables.c,v 1.62.2.1.2.4 2008/12/31 11:17:34 sebastian Exp $ */ #include <stdio.h> #include "zend.h" diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h index 6a8fc90a1..abd613078 100644 --- a/Zend/zend_variables.h +++ b/Zend/zend_variables.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_variables.h,v 1.34.2.1.2.2 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_variables.h,v 1.34.2.1.2.3 2008/12/31 11:17:34 sebastian Exp $ */ #ifndef ZEND_VARIABLES_H #define ZEND_VARIABLES_H diff --git a/Zend/zend_vm.h b/Zend/zend_vm.h index ac6ef6233..e79541c2f 100644 --- a/Zend/zend_vm.h +++ b/Zend/zend_vm.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm.h,v 1.7.2.1.2.3 2007/12/31 07:20:03 sebastian Exp $ */ +/* $Id: zend_vm.h,v 1.7.2.1.2.4 2008/12/31 11:17:34 sebastian Exp $ */ #ifndef ZEND_VM_H #define ZEND_VM_H diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index f29970a49..7eabc5c67 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.59.2.29.2.56 2008/03/04 11:46:09 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.59.2.29.2.65 2009/02/15 14:31:17 iliaa Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -1182,6 +1182,8 @@ ZEND_VM_HELPER_EX(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST| zval *container; zval **retval; zend_free_op free_op1; + zend_free_op free_op2; + zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R); retval = &EX_T(opline->result.u.var).var.ptr; EX_T(opline->result.u.var).var.ptr_ptr = retval; @@ -1194,6 +1196,7 @@ ZEND_VM_HELPER_EX(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST| PZVAL_LOCK(*retval); AI_USE_PTR(EX_T(opline->result.u.var).var); } + FREE_OP2(); FREE_OP1(); ZEND_VM_NEXT_OPCODE(); } @@ -1206,10 +1209,8 @@ ZEND_VM_HELPER_EX(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST| *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); + FREE_OP2(); } else { - zend_free_op free_op2; - zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R); - if (IS_OP2_TMP_FREE()) { MAKE_REAL_ZVAL_PTR(offset); } @@ -1482,7 +1483,13 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV) PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } zend_error(E_STRICT, "Only variables should be assigned by reference"); + if (EG(exception)) { + FREE_OP2_VAR_PTR(); + ZEND_VM_NEXT_OPCODE(); + } ZEND_VM_DISPATCH_TO_HANDLER(ZEND_ASSIGN); + } else if (OP2_TYPE == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { + PZVAL_LOCK(*value_ptr_ptr); } if (OP1_TYPE == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { zend_error(E_ERROR, "Cannot assign by reference to overloaded object"); @@ -1491,6 +1498,10 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV) variable_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC); + if (OP2_TYPE == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { + (*variable_ptr_ptr)->refcount--; + } + if (!RETURN_VALUE_UNUSED(&opline->result)) { EX_T(opline->result.u.var).var.ptr_ptr = variable_ptr_ptr; PZVAL_LOCK(*variable_ptr_ptr); @@ -1742,7 +1753,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV) zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -1815,7 +1826,17 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV) !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name); + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + verb = "should not"; + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + severity = E_ERROR; + verb = "cannot"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); } if ((EX(object) = EG(This))) { @@ -2310,7 +2331,9 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY) } else { zval *valptr; - zend_error(E_STRICT, "Only variables should be passed by reference"); + if (!(opline->extended_value & ZEND_ARG_SEND_SILENT)) { + zend_error(E_STRICT, "Only variables should be passed by reference"); + } ALLOC_ZVAL(valptr); INIT_PZVAL_COPY(valptr, varptr); if (!IS_OP1_TMP_FREE()) { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 79e1a1067..50176ad13 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -710,7 +710,17 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name); + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + verb = "should not"; + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + severity = E_ERROR; + verb = "cannot"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); } if ((EX(object) = EG(This))) { @@ -911,7 +921,17 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name); + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + verb = "should not"; + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + severity = E_ERROR; + verb = "cannot"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); } if ((EX(object) = EG(This))) { @@ -1072,7 +1092,17 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name); + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + verb = "should not"; + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + severity = E_ERROR; + verb = "cannot"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); } if ((EX(object) = EG(This))) { @@ -1232,7 +1262,17 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name); + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + verb = "should not"; + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + severity = E_ERROR; + verb = "cannot"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); } if ((EX(object) = EG(This))) { @@ -1325,7 +1365,17 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name); + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + verb = "should not"; + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + severity = E_ERROR; + verb = "cannot"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); } if ((EX(object) = EG(This))) { @@ -5294,7 +5344,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -5737,7 +5787,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -6182,7 +6232,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -6719,7 +6769,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -7484,7 +7534,9 @@ static int ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zval *valptr; - zend_error(E_STRICT, "Only variables should be passed by reference"); + if (!(opline->extended_value & ZEND_ARG_SEND_SILENT)) { + zend_error(E_STRICT, "Only variables should be passed by reference"); + } ALLOC_ZVAL(valptr); INIT_PZVAL_COPY(valptr, varptr); if (!0) { @@ -9072,6 +9124,8 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CONST(int type, ZEND zval **retval; zend_free_op free_op1; + zval *offset = &opline->op2.u.constant; + retval = &EX_T(opline->result.u.var).var.ptr; EX_T(opline->result.u.var).var.ptr_ptr = retval; @@ -9083,6 +9137,7 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CONST(int type, ZEND PZVAL_LOCK(*retval); AI_USE_PTR(EX_T(opline->result.u.var).var); } + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } @@ -9095,10 +9150,8 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CONST(int type, ZEND *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); - } else { - - zval *offset = &opline->op2.u.constant; + } else { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -9365,7 +9418,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -10588,6 +10641,8 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_TMP(int type, ZEND_O zval *container; zval **retval; zend_free_op free_op1; + zend_free_op free_op2; + zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); retval = &EX_T(opline->result.u.var).var.ptr; EX_T(opline->result.u.var).var.ptr_ptr = retval; @@ -10600,6 +10655,7 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_TMP(int type, ZEND_O PZVAL_LOCK(*retval); AI_USE_PTR(EX_T(opline->result.u.var).var); } + zval_dtor(free_op2.var); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } @@ -10612,10 +10668,8 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_TMP(int type, ZEND_O *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); + zval_dtor(free_op2.var); } else { - zend_free_op free_op2; - zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (1) { MAKE_REAL_ZVAL_PTR(offset); } @@ -10883,7 +10937,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -12108,6 +12162,8 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_VAR(int type, ZEND_O zval *container; zval **retval; zend_free_op free_op1; + zend_free_op free_op2; + zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); retval = &EX_T(opline->result.u.var).var.ptr; EX_T(opline->result.u.var).var.ptr_ptr = retval; @@ -12120,6 +12176,7 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_VAR(int type, ZEND_O PZVAL_LOCK(*retval); AI_USE_PTR(EX_T(opline->result.u.var).var); } + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } @@ -12132,10 +12189,8 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_VAR(int type, ZEND_O *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - zend_free_op free_op2; - zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -12385,7 +12440,13 @@ static int ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } zend_error(E_STRICT, "Only variables should be assigned by reference"); + if (EG(exception)) { + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + ZEND_VM_NEXT_OPCODE(); + } return ZEND_ASSIGN_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else if (IS_VAR == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { + PZVAL_LOCK(*value_ptr_ptr); } if (IS_VAR == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { zend_error(E_ERROR, "Cannot assign by reference to overloaded object"); @@ -12394,6 +12455,10 @@ static int ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) variable_ptr_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC); + if (IS_VAR == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { + (*variable_ptr_ptr)->refcount--; + } + if (!RETURN_VALUE_UNUSED(&opline->result)) { EX_T(opline->result.u.var).var.ptr_ptr = variable_ptr_ptr; PZVAL_LOCK(*variable_ptr_ptr); @@ -12441,7 +12506,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -14113,6 +14178,8 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CV(int type, ZEND_OP zval **retval; zend_free_op free_op1; + zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + retval = &EX_T(opline->result.u.var).var.ptr; EX_T(opline->result.u.var).var.ptr_ptr = retval; @@ -14124,6 +14191,7 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CV(int type, ZEND_OP PZVAL_LOCK(*retval); AI_USE_PTR(EX_T(opline->result.u.var).var); } + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } @@ -14136,10 +14204,8 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CV(int type, ZEND_OP *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); - } else { - - zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + } else { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -14387,7 +14453,13 @@ static int ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } zend_error(E_STRICT, "Only variables should be assigned by reference"); + if (EG(exception)) { + + ZEND_VM_NEXT_OPCODE(); + } return ZEND_ASSIGN_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else if (IS_CV == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { + PZVAL_LOCK(*value_ptr_ptr); } if (IS_VAR == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { zend_error(E_ERROR, "Cannot assign by reference to overloaded object"); @@ -14396,6 +14468,10 @@ static int ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) variable_ptr_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC); + if (IS_CV == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { + (*variable_ptr_ptr)->refcount--; + } + if (!RETURN_VALUE_UNUSED(&opline->result)) { EX_T(opline->result.u.var).var.ptr_ptr = variable_ptr_ptr; PZVAL_LOCK(*variable_ptr_ptr); @@ -14442,7 +14518,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -15370,6 +15446,8 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST(int type, Z zval **retval; + zval *offset = &opline->op2.u.constant; + retval = &EX_T(opline->result.u.var).var.ptr; EX_T(opline->result.u.var).var.ptr_ptr = retval; @@ -15382,6 +15460,7 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST(int type, Z AI_USE_PTR(EX_T(opline->result.u.var).var); } + ZEND_VM_NEXT_OPCODE(); } @@ -15393,10 +15472,8 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST(int type, Z *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); - } else { - - zval *offset = &opline->op2.u.constant; + } else { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -15616,7 +15693,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_A zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -16393,6 +16470,8 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP(int type, ZEN zval *container; zval **retval; + zend_free_op free_op2; + zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); retval = &EX_T(opline->result.u.var).var.ptr; EX_T(opline->result.u.var).var.ptr_ptr = retval; @@ -16405,6 +16484,7 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP(int type, ZEN PZVAL_LOCK(*retval); AI_USE_PTR(EX_T(opline->result.u.var).var); } + zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } @@ -16417,10 +16497,8 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP(int type, ZEN *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); + zval_dtor(free_op2.var); } else { - zend_free_op free_op2; - zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (1) { MAKE_REAL_ZVAL_PTR(offset); } @@ -16640,7 +16718,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -17373,6 +17451,8 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR(int type, ZEN zval *container; zval **retval; + zend_free_op free_op2; + zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); retval = &EX_T(opline->result.u.var).var.ptr; EX_T(opline->result.u.var).var.ptr_ptr = retval; @@ -17385,6 +17465,7 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR(int type, ZEN PZVAL_LOCK(*retval); AI_USE_PTR(EX_T(opline->result.u.var).var); } + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } @@ -17397,10 +17478,8 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR(int type, ZEN *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - zend_free_op free_op2; - zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -17620,7 +17699,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -18619,6 +18698,8 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(int type, ZEND zval **retval; + zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + retval = &EX_T(opline->result.u.var).var.ptr; EX_T(opline->result.u.var).var.ptr_ptr = retval; @@ -18631,6 +18712,7 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(int type, ZEND AI_USE_PTR(EX_T(opline->result.u.var).var); } + ZEND_VM_NEXT_OPCODE(); } @@ -18642,10 +18724,8 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(int type, ZEND *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); - } else { - - zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + } else { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -18865,7 +18945,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -19768,7 +19848,9 @@ static int ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zval *valptr; - zend_error(E_STRICT, "Only variables should be passed by reference"); + if (!(opline->extended_value & ZEND_ARG_SEND_SILENT)) { + zend_error(E_STRICT, "Only variables should be passed by reference"); + } ALLOC_ZVAL(valptr); INIT_PZVAL_COPY(valptr, varptr); if (!0) { @@ -21199,6 +21281,8 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_CONST(int type, ZEND_ zval **retval; + zval *offset = &opline->op2.u.constant; + retval = &EX_T(opline->result.u.var).var.ptr; EX_T(opline->result.u.var).var.ptr_ptr = retval; @@ -21211,6 +21295,7 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_CONST(int type, ZEND_ AI_USE_PTR(EX_T(opline->result.u.var).var); } + ZEND_VM_NEXT_OPCODE(); } @@ -21222,10 +21307,8 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_CONST(int type, ZEND_ *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); - } else { - - zval *offset = &opline->op2.u.constant; + } else { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -21490,7 +21573,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -22707,6 +22790,8 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_TMP(int type, ZEND_OP zval *container; zval **retval; + zend_free_op free_op2; + zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); retval = &EX_T(opline->result.u.var).var.ptr; EX_T(opline->result.u.var).var.ptr_ptr = retval; @@ -22719,6 +22804,7 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_TMP(int type, ZEND_OP PZVAL_LOCK(*retval); AI_USE_PTR(EX_T(opline->result.u.var).var); } + zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); } @@ -22731,10 +22817,8 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_TMP(int type, ZEND_OP *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); + zval_dtor(free_op2.var); } else { - zend_free_op free_op2; - zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (1) { MAKE_REAL_ZVAL_PTR(offset); } @@ -23000,7 +23084,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -24219,6 +24303,8 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_VAR(int type, ZEND_OP zval *container; zval **retval; + zend_free_op free_op2; + zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); retval = &EX_T(opline->result.u.var).var.ptr; EX_T(opline->result.u.var).var.ptr_ptr = retval; @@ -24231,6 +24317,7 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_VAR(int type, ZEND_OP PZVAL_LOCK(*retval); AI_USE_PTR(EX_T(opline->result.u.var).var); } + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; ZEND_VM_NEXT_OPCODE(); } @@ -24243,10 +24330,8 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_VAR(int type, ZEND_OP *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - zend_free_op free_op2; - zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -24494,7 +24579,13 @@ static int ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } zend_error(E_STRICT, "Only variables should be assigned by reference"); + if (EG(exception)) { + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + ZEND_VM_NEXT_OPCODE(); + } return ZEND_ASSIGN_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else if (IS_VAR == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { + PZVAL_LOCK(*value_ptr_ptr); } if (IS_CV == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { zend_error(E_ERROR, "Cannot assign by reference to overloaded object"); @@ -24503,6 +24594,10 @@ static int ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) variable_ptr_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC); + if (IS_VAR == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { + (*variable_ptr_ptr)->refcount--; + } + if (!RETURN_VALUE_UNUSED(&opline->result)) { EX_T(opline->result.u.var).var.ptr_ptr = variable_ptr_ptr; PZVAL_LOCK(*variable_ptr_ptr); @@ -24549,7 +24644,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { @@ -26214,6 +26309,8 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_CV(int type, ZEND_OPC zval **retval; + zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + retval = &EX_T(opline->result.u.var).var.ptr; EX_T(opline->result.u.var).var.ptr_ptr = retval; @@ -26226,6 +26323,7 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_CV(int type, ZEND_OPC AI_USE_PTR(EX_T(opline->result.u.var).var); } + ZEND_VM_NEXT_OPCODE(); } @@ -26237,10 +26335,8 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_CV(int type, ZEND_OPC *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); - } else { - - zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); + } else { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -26486,7 +26582,13 @@ static int ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } zend_error(E_STRICT, "Only variables should be assigned by reference"); + if (EG(exception)) { + + ZEND_VM_NEXT_OPCODE(); + } return ZEND_ASSIGN_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else if (IS_CV == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { + PZVAL_LOCK(*value_ptr_ptr); } if (IS_CV == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { zend_error(E_ERROR, "Cannot assign by reference to overloaded object"); @@ -26495,6 +26597,10 @@ static int ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) variable_ptr_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC); + if (IS_CV == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { + (*variable_ptr_ptr)->refcount--; + } + if (!RETURN_VALUE_UNUSED(&opline->result)) { EX_T(opline->result.u.var).var.ptr_ptr = variable_ptr_ptr; PZVAL_LOCK(*variable_ptr_ptr); @@ -26540,7 +26646,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); } - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { + if (!EX(object) || (EX(fbc) && (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0)) { EX(object) = NULL; } else { if (!PZVAL_IS_REF(EX(object))) { diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index 57244bfc3..6f730291a 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -3,7 +3,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | @@ -16,7 +16,7 @@ | Authors: Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ - $Id: zend_vm_gen.php,v 1.12.2.5.2.5 2007/12/31 07:25:08 sebastian Exp $ + $Id: zend_vm_gen.php,v 1.12.2.5.2.6 2008/12/31 11:17:35 sebastian Exp $ */ $header_text = <<< DATA @@ -24,7 +24,7 @@ $header_text = <<< DATA +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index e8fbd535a..6a4f6eb15 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2009 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 | |
