summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:38:07 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:38:07 -0400
commitbb01389fbd53ec1cbcb80d0681a37cca1267891a (patch)
tree4783178fca65a5d9071c8df34f2ddc3d31728673 /Zend
parenteddbbea4325e602ddc87c545531609132d4f0e3b (diff)
downloadphp-bb01389fbd53ec1cbcb80d0681a37cca1267891a.tar.gz
Imported Upstream version 5.2.4upstream/5.2.4
Diffstat (limited to 'Zend')
-rw-r--r--Zend/README.ZEND_MM35
-rw-r--r--Zend/tests/017.phpt12
-rw-r--r--Zend/tests/019.phpt1332
-rw-r--r--Zend/tests/020.phpt31
-rw-r--r--Zend/tests/array_append_COW.phpt16
-rw-r--r--Zend/tests/array_unshift_COW.phpt16
-rwxr-xr-xZend/tests/bug27798.phpt4
-rwxr-xr-xZend/tests/bug37715.phpt29
-rwxr-xr-xZend/tests/bug40509.phpt26
-rwxr-xr-xZend/tests/bug40705.phpt26
-rwxr-xr-xZend/tests/bug40757.phpt28
-rwxr-xr-xZend/tests/bug41372.phpt13
-rwxr-xr-xZend/tests/bug41633_1.phpt12
-rwxr-xr-xZend/tests/bug41633_2.phpt11
-rwxr-xr-xZend/tests/bug41633_3.phpt12
-rwxr-xr-xZend/tests/bug41633_4.phpt12
-rw-r--r--Zend/tests/bug41640.phpt15
-rw-r--r--Zend/tests/bug41813.phpt12
-rw-r--r--Zend/tests/bug41919.phpt12
-rwxr-xr-xZend/tests/bug41929.phpt24
-rwxr-xr-xZend/tests/bug41961.phpt29
-rwxr-xr-xZend/tests/bug42119.phpt19
-rw-r--r--Zend/tests/bug42211.phpt30
-rw-r--r--Zend/tests/class_constants_001.phpt22
-rw-r--r--Zend/tests/class_constants_002.phpt31
-rw-r--r--Zend/tests/class_constants_003.phpt33
-rw-r--r--Zend/tests/double_to_string.phpt4
-rw-r--r--Zend/tests/get_defined_vars.phpt128
-rwxr-xr-xZend/tests/is_a.phpt1
-rwxr-xr-xZend/tests/selfParent_001.phpt27
-rwxr-xr-xZend/tests/selfParent_002.phpt27
-rw-r--r--Zend/zend.c6
-rw-r--r--Zend/zend.h3
-rw-r--r--Zend/zend_API.c28
-rw-r--r--Zend/zend_alloc.c11
-rw-r--r--Zend/zend_builtin_functions.c48
-rw-r--r--Zend/zend_constants.c7
-rw-r--r--Zend/zend_constants.h4
-rw-r--r--Zend/zend_execute.c30
-rw-r--r--Zend/zend_execute.h6
-rw-r--r--Zend/zend_execute_API.c23
-rw-r--r--Zend/zend_hash.c11
-rw-r--r--Zend/zend_ini.c33
-rw-r--r--Zend/zend_ini.h3
-rw-r--r--Zend/zend_ini_parser.c90
-rw-r--r--Zend/zend_ini_parser.y90
-rw-r--r--Zend/zend_ini_scanner.c156
-rw-r--r--Zend/zend_ini_scanner.l54
-rw-r--r--Zend/zend_language_parser.c2
-rw-r--r--Zend/zend_language_parser.y2
-rw-r--r--Zend/zend_object_handlers.c8
-rw-r--r--Zend/zend_objects_API.c4
-rw-r--r--Zend/zend_objects_API.h4
-rw-r--r--Zend/zend_operators.c9
-rw-r--r--Zend/zend_operators.h4
-rw-r--r--Zend/zend_strtod.c3
-rw-r--r--Zend/zend_vm.h4
-rw-r--r--Zend/zend_vm_def.h10
-rw-r--r--Zend/zend_vm_execute.h30
-rw-r--r--Zend/zend_vm_execute.skl2
60 files changed, 2393 insertions, 321 deletions
diff --git a/Zend/README.ZEND_MM b/Zend/README.ZEND_MM
index 0825e08b4..cf9a9b7e8 100644
--- a/Zend/README.ZEND_MM
+++ b/Zend/README.ZEND_MM
@@ -1,13 +1,34 @@
-The goal of the new memory manager (PHP 5.2 and later) is reducing memory allocation overhead and speedup memory management.
+Zend Memory Manager
+===================
-The new manager's "configure" has no "--disable-zend-memory-manager" option, but it has "--enable-malloc-mm" instead. It is enabled by default in DEBUG build and disabled by default in RELEASE built. It allows select malloc/emalloc at runtime. So you can use internal and external memory debuggers without recompilation.
+General:
+--------
-$ sapi/cli/php -r 'leak();'
+The goal of the new memory manager (available since PHP 5.2) is to reduce memory
+allocation overhead and speedup memory management.
-$ USE_ZEND_ALLOC=0 valgrind --leak-check=full -r 'leak();'
+The new manager's "configure" has no "--disable-zend-memory-manager" option,
+but it has "--enable-malloc-mm" instead. It is enabled by default in DEBUG
+build and disabled by default in RELEASE build. when enabled it allows selecting
+between malloc and emalloc at runtime so you can use internal and external memory
+debuggers without recompilation.
-The patch allows tweaking memory manager with ZEND_MM_MEM_TYPE and ZEND_MM_SEG_SIZE environment variables. Default values are "malloc" and "256K". Dependent on target system you can also use "mmap_anon", "mmap_zero"
-and "win32" storage managers.
+Debugging:
+----------
-$ ZEND_MM_MEM_TYPE=mmap_anon ZEND_MM_SEG_SIZE=1M sapi/cli/php
+Normal:
+ $ sapi/cli/php -r 'leak();'
+
+Zend MM disabled:
+
+ $ USE_ZEND_ALLOC=0 valgrind --leak-check=full sapi/cli/php -r 'leak();'
+
+Tweaking:
+---------
+
+The Zend MM can be tweaked using ZEND_MM_MEM_TYPE and ZEND_MM_SEG_SIZE environment
+variables. Default values are "malloc" and "256K". Dependent on target system you
+can also use "mmap_anon", "mmap_zero" and "win32" storage managers.
+
+ $ ZEND_MM_MEM_TYPE=mmap_anon ZEND_MM_SEG_SIZE=1M sapi/cli/php ..etc.
diff --git a/Zend/tests/017.phpt b/Zend/tests/017.phpt
index e8a5cfe85..9ed773276 100644
--- a/Zend/tests/017.phpt
+++ b/Zend/tests/017.phpt
@@ -10,9 +10,11 @@ var_dump(get_resource_type($fp));
fclose($fp);
var_dump(get_resource_type($fp));
-var_dump(get_loaded_extensions(true));
var_dump(gettype(get_loaded_extensions()));
var_dump(count(get_loaded_extensions()));
+var_dump(gettype(get_loaded_extensions(true)));
+var_dump(count(get_loaded_extensions(true)));
+var_dump(get_loaded_extensions(true, true));
define("USER_CONSTANT", "test");
@@ -50,11 +52,13 @@ Warning: Supplied argument is not a valid resource handle in %s on line %d
bool(false)
string(6) "stream"
string(7) "Unknown"
-
-Warning: Wrong parameter count for get_loaded_extensions() in %s on line %d
-NULL
string(5) "array"
int(%d)
+string(5) "array"
+int(%d)
+
+Warning: get_loaded_extensions() expects at most 1 parameter, 2 given in %s on line %d
+NULL
Warning: Wrong parameter count for get_defined_constants() in %s on line %d
NULL
diff --git a/Zend/tests/019.phpt b/Zend/tests/019.phpt
new file mode 100644
index 000000000..47158771e
--- /dev/null
+++ b/Zend/tests/019.phpt
@@ -0,0 +1,1332 @@
+--TEST--
+Test unset(), empty() and isset() functions
+--FILE--
+<?php
+/* Prototype: void unset ( mixed $var [, mixed $var [, mixed $...]] );
+ Description: unset() destroys the specified variables
+
+ Prototype: bool empty( mixed $var );
+ Description: Determine whether a variable is considered to be empty
+
+ Prototype: bool isset ( mixed $var [, mixed $var [, $...]] );
+ Description: Returns TRUE if var exists; FALSE otherwise
+*/
+
+echo "*** Testing unset(), empty() & isset() with scalar variables ***\n";
+
+// testing scalar variables
+$scalar_variables = array(
+ 0,
+ 1,
+ +1
+ -1,
+ 0x55,
+ -0xFA,
+ 0123,
+ -0563,
+ 0.0,
+ 1e5,
+ 1E-5,
+ -1.5e5,
+ +5.6,
+ "",
+ '',
+ " ",
+ ' ',
+ "string",
+ "123",
+ "0",
+ "ture",
+ "FALSE",
+ "NULL",
+ "null",
+ true,
+ false,
+ TRUE,
+ FALSE
+);
+
+$loop_counter = 1;
+foreach ($scalar_variables as $scalar_var) {
+ $set_var = 10; // this variable to use with isset
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+
+ // checking with isset before unsetting, expected: bool(true)
+ var_dump( isset($scalar_var) );
+ var_dump( isset($scalar_var, $set_var) );
+ // checking if the var is empty, expected: bool(false) on most
+ // except "", 0, "0", NULL, FALSE
+ var_dump( empty($scalar_var) );
+
+ // destroy the variable using unset
+ unset( $scalar_var );
+ // dump and see if its destroyed, expcted: NULL
+ var_dump( $scalar_var );
+
+ // check using isset to see if unset, expected: bool(false)
+ var_dump( isset($scalar_var) );
+ var_dump( isset($scalar_var, $set_var) );
+
+ // empty to check if empty, expecting bool(true)
+ var_dump( empty($scalar_var) );
+
+ // isset() with two args, one arg only unset, expected: bool(false)
+ var_dump( isset($scalar_var, $set_var) );
+
+ // isset() with two args, both args already unset, expected: bool(false);
+ unset($set_var);
+ var_dump( isset($scalar_var, $set_var) );
+}
+
+echo "\n*** Testing unset(), empty() & isset() with arrays ***\n";
+$array_variables = array(
+ array(),
+ array(NULL),
+ array(0),
+ array("0"),
+ array(""),
+ array(1,2,3,4),
+ array(1.4,2.5,5.6),
+ array(1 => "One", 2 => "two"),
+ array("Name" => "Jack", "Age" => "30"),
+ array(1,2, "One" => "1", 2 => "two", ""=>"empty", "" => '')
+);
+
+$outer_loop_counter = 1;
+foreach ($array_variables as $array_var) {
+ echo "--- Outerloop Iteration $outer_loop_counter ---\n";
+
+ // check the isset and unset on non existing key
+ $var = 1; // a var which is defined
+ // try to unset the element which is non-existent
+ unset($array_var['non_existent']);
+ // check using isset() & empty() on a non_existent element in the array
+ var_dump( isset($array_var['non_existent']) );
+ var_dump( isset($array_var['non_existent'], $var) );
+ var_dump( isset($array_var['non_existent'], $array_var['none']) );
+ var_dump( empty($array_var['non_existent']) );
+
+ // testing empty and isset on arrays
+ var_dump( empty($array_var) ); // expecting bool(false), except: array(), which is considered empty
+ var_dump( isset($array_var) ); // expecting bool(true), except: array(), which is not set
+
+ // get the keys of the $array_var
+ $keys = array_keys($array_var);
+ // unset each element in the array and see the working of unset, isset & empty
+ $inner_loop_counter = 1;
+ foreach ($keys as $key_value) {
+ echo "-- Innerloop Iteration $inner_loop_counter of Outerloop Iteration $outer_loop_counter --\n";
+ $inner_loop_counter++;
+
+ // unset the element
+ unset($array_var[$key_value]);
+ // dump the array after element was unset
+ var_dump($array_var);
+ // check using isset for the element that was unset
+ var_dump( isset($array_var[$key_val]) ); // expected: bool(false)
+ // calling isset with more args
+ var_dump( isset($array_var[$key_val], $array_var) ); //expected: bool(false)
+
+ // calling empty, expected bool(true)
+ var_dump( empty($array_var[$key_val]) );
+
+ // dump the array to see that that array did not get modified
+ // because of using isset, empty and unset on its element
+ var_dump($array_var);
+ }
+
+ $outer_loop_counter++;
+
+ // unset the whole array
+ unset($array_var);
+ // dump the array to see its unset
+ var_dump($array_var);
+ // use isset to see that array is not set
+ var_dump( isset($array_var) ); //expected: bool(false)
+ var_dump( isset($array_var, $array_var[$key_val]) ); // expected: bool(false)
+
+ // empty() to see if the array is empty
+ var_dump( empty($array_var) ); // expected: bool(true)
+}
+
+echo "\n*** Testing unset(), emtpy() & isset() with resource variables ***\n";
+$fp = fopen(__FILE__, "r");
+$dfp = opendir( dirname(__FILE__) );
+$resources = array (
+ $fp,
+ $dfp
+);
+$loop_counter = 1;
+foreach ($resources as $resource) {
+ $temp_var = 10;
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ //dump the resource first
+ var_dump($resource);
+
+ // check using isset() and empty()
+ var_dump( isset($resource) ); // expected: bool(true)
+ var_dump( empty($resource) ); // expected: bool(false)
+ // call isset() with two args, both set
+ var_dump( isset($resource, $temp_var) ); // expected: bool(true)
+
+ // dump the resource to see using isset() and empty () had no effect on it
+ var_dump($resource);
+
+ // unset the resource
+ unset($resource);
+ // check using isset() and empty()
+ var_dump( isset($resource) ); // expected: bool(flase)
+ var_dump( empty($resource) ); // expected: bool(true)
+ // call isset() with two args, but one set
+ var_dump( isset($resource, $temp_var) ); // expected: bool(false)
+ // uset the temp_var
+ unset($temp_var);
+ // now the isset() with both the args as unset
+ var_dump( isset($resource, $temp_var) ); // expected: bool(false);
+
+ // dump the resource to see if there any effect on it
+ var_dump($resource);
+}
+// unset and dump the array containing all the resources to see that
+// unset works correctly
+unset($resources);
+var_dump($resources);
+var_dump( isset($resources) ); //expected: bool(false)
+var_dump( empty($resources) ); // expected: bool(true)
+
+echo "\n*** Testing unset(), empty() & isset() with objects ***\n";
+class Point
+{
+ var $x;
+ var $y;
+ var $lable;
+
+ function Point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function setLable($lable) {
+ $this->lable = $lable;
+ }
+ function testPoint() {
+ echo "\nPoint::testPoint() called\n";
+ }
+}
+$point1 = new Point(30,40);
+
+// use unset/empty/isset to check the object
+var_dump($point1); // dump the object
+
+// check the object and member that is not set
+var_dump( isset($point1) ); // expected: bool(true)
+var_dump( empty($point1) ); // expected: bool(false)
+var_dump( isset($point1->$lable) ); //expected: bool(flase)
+var_dump( empty($point1->$lable) ); //expected: bool(true)
+
+//set the member variable lable and check
+$point1->setLable("Point1");
+var_dump( isset($point1->$lable) ); //expected: bool(true)
+var_dump( empty($point1->$lable) ); //expected: bool(false)
+
+// dump the object to see that obj was not harmed
+// because of the usage of the isset & empty
+var_dump($point1);
+
+//unset a member and check
+unset($point1->x);
+// dump the point to see that variable was unset
+var_dump($point1);
+var_dump( isset($point1->x) ); // expected: bool(false)
+var_dump( empty($point1->x) ); // expected: bool(true)
+
+// unset all members and check
+unset($point1->y);
+unset($point1->lable);
+// dump the objec to check that all variables are unset
+var_dump($point1);
+var_dump( isset($point1) ); // expected: bool(ture)
+var_dump( empty($point1) ); // expected: bool(false)
+
+//unset the object and check
+unset($point1);
+var_dump( isset($point1) ); // expected: bool(false)
+var_dump( empty($point1) ); // expected: bool(true)
+// dump to see that object is unset
+var_dump($point1);
+
+// try isset/unset/empty on a member function
+$point2 = new Point(5,6);
+var_dump( isset($point2->testPoint) );
+var_dump( empty($point2->testPoint) );
+unset($point2->testPoint);
+var_dump( isset($point2->testPoint) );
+var_dump( empty($point2->testPoint) );
+
+// use get_class_methods to see effect if any
+var_dump( get_class_methods($point2) );
+// dump the object to see the effect, none expected
+var_dump($point2);
+
+/* testing variation in operation for isset(), empty() & unset().
+Note: Most of the variation for function unset() is testing by a
+ set of testcases named "Zend/tests/unset_cv??.phpt", only
+ variation not tested are attempted here */
+
+echo "\n*** Testing possible variation in operation for isset(), empty() & unset() ***\n";
+/* unset() variation1: checking unset on static variable inside a function.
+ * unset() destroys the variable only in the context of the rest of a function
+ * Following calls will restore the previous value of a variable.
+ */
+echo "\n** Testing unset() variation 1: unset on static variable inside a function **\n";
+function test_unset1() {
+ static $static_var;
+
+ // increment the value of the static. this change is in function context
+ $static_var ++;
+
+ echo "value of static_var before unset: $static_var\n";
+ // check using isset and empty
+ var_dump( isset($static_var) );
+ var_dump( empty($static_var) );
+
+ // unset the static var
+ unset($static_var);
+ echo "value of static_var after unset: $static_var\n";
+ // check using isset and empty
+ var_dump( isset($static_var) );
+ var_dump( empty($static_var) );
+
+ // assign a value to static var
+ $static_var = 20;
+ echo "value of static_var after new assignment: $static_var\n";
+}
+// call the functiont
+test_unset1();
+test_unset1();
+test_unset1();
+
+
+echo "\n** Testing unset() variation 2: unset on a variable passed by ref. inside of a function **\n";
+/* unset() variation2: Pass by reference
+ * If a variable that is PASSED BY REFERENCE is unset() inside of a function,
+ * only the local variable is destroyed. The variable in the calling environment
+ * will retain the same value as before unset() was called.
+ */
+function test_unset2( &$ref_val ) {
+ // unset the variable passed
+ unset($ref_val);
+ // check using isset and empty to confirm
+ var_dump( isset($ref_val) );
+ var_dump( empty($ref_val) );
+
+ // set the value ot a new one
+ $ref_val = "new value by ref";
+}
+
+$value = "value";
+var_dump($value);
+test_unset2($value);
+var_dump($value);
+
+
+echo "\n** Testing unset() variation 3: unset on a global variable inside of a function **\n";
+/* unset() variation2: unset on a global variable inside a function
+ * If a globalized variable is unset() inside of a function, only the
+ * local variable is destroyed. The variable in the calling environment
+ * will retain the same value as before unset() was called.
+ */
+$global_var = 10;
+
+function test_unset3() {
+ global $global_var;
+
+ // check the $global_var using isset and empty
+ var_dump( isset($global_var) );
+ var_dump( empty($global_var) );
+
+ // unset the global var
+ unset($global_var);
+
+ // check the $global_var using isset and empty
+ var_dump( isset($global_var) );
+ var_dump( empty($global_var) );
+}
+
+var_dump($global_var);
+test_unset3();
+var_dump($global_var);
+
+//Note: No error conditions relating to passing arugments can be tested
+// because these are not functions but statements, it will result in syntax error.
+echo "Done\n";
+--EXPECTF--
+*** Testing unset(), empty() & isset() with scalar variables ***
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(true)
+bool(true)
+bool(true)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 5 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 6 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 8 --
+bool(true)
+bool(true)
+bool(true)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 9 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 10 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 11 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 12 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 13 --
+bool(true)
+bool(true)
+bool(true)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 14 --
+bool(true)
+bool(true)
+bool(true)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 15 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 16 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 17 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 18 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 19 --
+bool(true)
+bool(true)
+bool(true)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 20 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 21 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 22 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 23 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 24 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 25 --
+bool(true)
+bool(true)
+bool(true)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 26 --
+bool(true)
+bool(true)
+bool(false)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 27 --
+bool(true)
+bool(true)
+bool(true)
+
+Notice: Undefined variable: scalar_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+
+*** Testing unset(), empty() & isset() with arrays ***
+--- Outerloop Iteration 1 ---
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+
+Notice: Undefined variable: array_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+--- Outerloop Iteration 2 ---
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+-- Innerloop Iteration 1 of Outerloop Iteration 2 --
+array(0) {
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(0) {
+}
+
+Notice: Undefined variable: array_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+--- Outerloop Iteration 3 ---
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+-- Innerloop Iteration 1 of Outerloop Iteration 3 --
+array(0) {
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(0) {
+}
+
+Notice: Undefined variable: array_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+--- Outerloop Iteration 4 ---
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+-- Innerloop Iteration 1 of Outerloop Iteration 4 --
+array(0) {
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(0) {
+}
+
+Notice: Undefined variable: array_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+--- Outerloop Iteration 5 ---
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+-- Innerloop Iteration 1 of Outerloop Iteration 5 --
+array(0) {
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(0) {
+}
+
+Notice: Undefined variable: array_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+--- Outerloop Iteration 6 ---
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+-- Innerloop Iteration 1 of Outerloop Iteration 6 --
+array(3) {
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(3) {
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+}
+-- Innerloop Iteration 2 of Outerloop Iteration 6 --
+array(2) {
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(2) {
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+}
+-- Innerloop Iteration 3 of Outerloop Iteration 6 --
+array(1) {
+ [3]=>
+ int(4)
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(1) {
+ [3]=>
+ int(4)
+}
+-- Innerloop Iteration 4 of Outerloop Iteration 6 --
+array(0) {
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(0) {
+}
+
+Notice: Undefined variable: array_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+--- Outerloop Iteration 7 ---
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+-- Innerloop Iteration 1 of Outerloop Iteration 7 --
+array(2) {
+ [1]=>
+ float(2.5)
+ [2]=>
+ float(5.6)
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(2) {
+ [1]=>
+ float(2.5)
+ [2]=>
+ float(5.6)
+}
+-- Innerloop Iteration 2 of Outerloop Iteration 7 --
+array(1) {
+ [2]=>
+ float(5.6)
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(1) {
+ [2]=>
+ float(5.6)
+}
+-- Innerloop Iteration 3 of Outerloop Iteration 7 --
+array(0) {
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(0) {
+}
+
+Notice: Undefined variable: array_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+--- Outerloop Iteration 8 ---
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+-- Innerloop Iteration 1 of Outerloop Iteration 8 --
+array(1) {
+ [2]=>
+ string(3) "two"
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(1) {
+ [2]=>
+ string(3) "two"
+}
+-- Innerloop Iteration 2 of Outerloop Iteration 8 --
+array(0) {
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(0) {
+}
+
+Notice: Undefined variable: array_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+--- Outerloop Iteration 9 ---
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+-- Innerloop Iteration 1 of Outerloop Iteration 9 --
+array(1) {
+ ["Age"]=>
+ string(2) "30"
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(1) {
+ ["Age"]=>
+ string(2) "30"
+}
+-- Innerloop Iteration 2 of Outerloop Iteration 9 --
+array(0) {
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(0) {
+}
+
+Notice: Undefined variable: array_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+--- Outerloop Iteration 10 ---
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+-- Innerloop Iteration 1 of Outerloop Iteration 10 --
+array(4) {
+ [1]=>
+ int(2)
+ ["One"]=>
+ string(1) "1"
+ [2]=>
+ string(3) "two"
+ [""]=>
+ string(0) ""
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(4) {
+ [1]=>
+ int(2)
+ ["One"]=>
+ string(1) "1"
+ [2]=>
+ string(3) "two"
+ [""]=>
+ string(0) ""
+}
+-- Innerloop Iteration 2 of Outerloop Iteration 10 --
+array(3) {
+ ["One"]=>
+ string(1) "1"
+ [2]=>
+ string(3) "two"
+ [""]=>
+ string(0) ""
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(3) {
+ ["One"]=>
+ string(1) "1"
+ [2]=>
+ string(3) "two"
+ [""]=>
+ string(0) ""
+}
+-- Innerloop Iteration 3 of Outerloop Iteration 10 --
+array(2) {
+ [2]=>
+ string(3) "two"
+ [""]=>
+ string(0) ""
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(2) {
+ [2]=>
+ string(3) "two"
+ [""]=>
+ string(0) ""
+}
+-- Innerloop Iteration 4 of Outerloop Iteration 10 --
+array(1) {
+ [""]=>
+ string(0) ""
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(1) {
+ [""]=>
+ string(0) ""
+}
+-- Innerloop Iteration 5 of Outerloop Iteration 10 --
+array(0) {
+}
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(false)
+
+Notice: Undefined variable: key_val in %s on line %d
+bool(true)
+array(0) {
+}
+
+Notice: Undefined variable: array_var in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(true)
+
+*** Testing unset(), emtpy() & isset() with resource variables ***
+-- Iteration 1 --
+resource(5) of type (stream)
+bool(true)
+bool(false)
+bool(true)
+resource(5) of type (stream)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+
+Notice: Undefined variable: resource in %s on line %d
+NULL
+-- Iteration 2 --
+resource(6) of type (stream)
+bool(true)
+bool(false)
+bool(true)
+resource(6) of type (stream)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+
+Notice: Undefined variable: resource in %s on line %d
+NULL
+
+Notice: Undefined variable: resources in %s on line %d
+NULL
+bool(false)
+bool(true)
+
+*** Testing unset(), empty() & isset() with objects ***
+object(Point)#1 (3) {
+ ["x"]=>
+ int(30)
+ ["y"]=>
+ int(40)
+ ["lable"]=>
+ NULL
+}
+bool(true)
+bool(false)
+
+Notice: Undefined variable: lable in %s on line %d
+bool(false)
+
+Notice: Undefined variable: lable in %s on line %d
+bool(true)
+
+Notice: Undefined variable: lable in %s on line %d
+bool(false)
+
+Notice: Undefined variable: lable in %s on line %d
+bool(true)
+object(Point)#1 (3) {
+ ["x"]=>
+ int(30)
+ ["y"]=>
+ int(40)
+ ["lable"]=>
+ string(6) "Point1"
+}
+object(Point)#1 (2) {
+ ["y"]=>
+ int(40)
+ ["lable"]=>
+ string(6) "Point1"
+}
+bool(false)
+bool(true)
+object(Point)#1 (0) {
+}
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+
+Notice: Undefined variable: point1 in %s on line %d
+NULL
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+array(3) {
+ [0]=>
+ string(5) "Point"
+ [1]=>
+ string(8) "setLable"
+ [2]=>
+ string(9) "testPoint"
+}
+object(Point)#1 (3) {
+ ["x"]=>
+ int(5)
+ ["y"]=>
+ int(6)
+ ["lable"]=>
+ NULL
+}
+
+*** Testing possible variation in operation for isset(), empty() & unset() ***
+
+** Testing unset() variation 1: unset on static variable inside a function **
+value of static_var before unset: 1
+bool(true)
+bool(false)
+
+Notice: Undefined variable: static_var in %s on line %d
+value of static_var after unset:
+bool(false)
+bool(true)
+value of static_var after new assignment: 20
+value of static_var before unset: 2
+bool(true)
+bool(false)
+
+Notice: Undefined variable: static_var in %s on line %d
+value of static_var after unset:
+bool(false)
+bool(true)
+value of static_var after new assignment: 20
+value of static_var before unset: 3
+bool(true)
+bool(false)
+
+Notice: Undefined variable: static_var in %s on line %d
+value of static_var after unset:
+bool(false)
+bool(true)
+value of static_var after new assignment: 20
+
+** Testing unset() variation 2: unset on a variable passed by ref. inside of a function **
+string(5) "value"
+bool(false)
+bool(true)
+string(5) "value"
+
+** Testing unset() variation 3: unset on a global variable inside of a function **
+int(10)
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+int(10)
+Done
diff --git a/Zend/tests/020.phpt b/Zend/tests/020.phpt
new file mode 100644
index 000000000..fa49a9327
--- /dev/null
+++ b/Zend/tests/020.phpt
@@ -0,0 +1,31 @@
+--TEST--
+func_get_arg() invalid usage
+--FILE--
+<?php
+
+var_dump(func_get_arg(1,2,3));
+var_dump(func_get_arg(1));
+var_dump(func_get_arg());
+
+function bar() {
+ var_dump(func_get_arg(1));
+}
+
+function foo() {
+ bar(func_get_arg(1));
+}
+
+foo(1,2);
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(false)
+
+Warning: func_get_arg(): Called from the global scope - no function context in %s on line %d
+bool(false)
+bool(false)
+
+Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
+bool(false)
+Done
diff --git a/Zend/tests/array_append_COW.phpt b/Zend/tests/array_append_COW.phpt
new file mode 100644
index 000000000..0e3008589
--- /dev/null
+++ b/Zend/tests/array_append_COW.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Tests that array manipulation code is correctly dealing with copy on write and splitting on reference
+--FILE--
+<?php
+ $a=array();
+ $b=1;
+ $c=&$b;
+ $a[]=$b;
+ $b=2;
+ var_dump ($a);
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ int(1)
+}
diff --git a/Zend/tests/array_unshift_COW.phpt b/Zend/tests/array_unshift_COW.phpt
new file mode 100644
index 000000000..ecc42bb0f
--- /dev/null
+++ b/Zend/tests/array_unshift_COW.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Tests that array unshift code is correctly dealing with copy on write and splitting on reference
+--FILE--
+<?php
+ $a=array();
+ $b=1;
+ $c=&$b;
+ array_unshift ($a,$b);
+ $b=2;
+ var_dump ($a);
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ int(1)
+}
diff --git a/Zend/tests/bug27798.phpt b/Zend/tests/bug27798.phpt
index f0d1cd5e9..9e54efa83 100755
--- a/Zend/tests/bug27798.phpt
+++ b/Zend/tests/bug27798.phpt
@@ -49,12 +49,12 @@ array(1) {
}
Base::__construct
array(3) {
- ["Baz"]=>
- int(4)
["Foo"]=>
int(1)
["Bar"]=>
int(2)
+ ["Baz"]=>
+ int(3)
}
Child::__construct
array(3) {
diff --git a/Zend/tests/bug37715.phpt b/Zend/tests/bug37715.phpt
new file mode 100755
index 000000000..3a69b717f
--- /dev/null
+++ b/Zend/tests/bug37715.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #37715 (array pointers resetting on copy)
+--FILE--
+<?php
+$a = array(
+ 'a' => array(
+ 'A', 'B', 'C', 'D',
+ ),
+ 'b' => array(
+ 'AA', 'BB', 'CC', 'DD',
+ ),
+);
+
+// Set the pointer of $a to 'b' and the pointer of 'b' to 'CC'
+reset($a);
+next($a);
+next($a['b']);
+next($a['b']);
+next($a['b']);
+
+var_dump(key($a['b']));
+foreach($a as $k => $d)
+{
+}
+// Alternatively $c = $a; and foreachloop removal will cause identical results.
+var_dump(key($a['b']));
+--EXPECT--
+int(3)
+int(3)
diff --git a/Zend/tests/bug40509.phpt b/Zend/tests/bug40509.phpt
new file mode 100755
index 000000000..d3352ef5a
--- /dev/null
+++ b/Zend/tests/bug40509.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #40509 key() function changed behaviour if global array is used within function
+--FILE--
+<?php
+function foo()
+{
+ global $arr;
+
+ $c = $arr["v"];
+ foreach ($c as $v) {}
+}
+
+$arr["v"] = array("a");
+
+var_dump(key($arr["v"]));
+foo();
+var_dump(key($arr["v"]));
+foreach ($arr["v"] as $k => $v) {
+ var_dump($k);
+}
+var_dump(key($arr["v"]));
+--EXPECT--
+int(0)
+int(0)
+int(0)
+NULL
diff --git a/Zend/tests/bug40705.phpt b/Zend/tests/bug40705.phpt
new file mode 100755
index 000000000..aa150276c
--- /dev/null
+++ b/Zend/tests/bug40705.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #40705 Iterating within function moves original array pointer
+--FILE--
+<?php
+function doForeach($array)
+{
+ foreach ($array as $k => $v) {
+ // do stuff
+ }
+}
+
+$foo = array('foo', 'bar', 'baz');
+var_dump(key($foo));
+doForeach($foo);
+var_dump(key($foo));
+foreach ($foo as $k => $v) {
+ var_dump($k);
+}
+var_dump(key($foo));
+--EXPECT--
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+NULL
diff --git a/Zend/tests/bug40757.phpt b/Zend/tests/bug40757.phpt
new file mode 100755
index 000000000..d413b1022
--- /dev/null
+++ b/Zend/tests/bug40757.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #40757 (get_object_vars() get nothing in child class)
+--FILE--
+<?php
+class Base {
+ private $p1='sadf';
+
+ function getFields($obj){
+ return get_object_vars($obj);
+ }
+}
+
+class Child extends Base { }
+
+$base=new Base();
+print_r($base->getFields(new Base()));
+$child=new Child();
+print_r($child->getFields(new Base()));
+?>
+--EXPECT--
+Array
+(
+ [p1] => sadf
+)
+Array
+(
+ [p1] => sadf
+)
diff --git a/Zend/tests/bug41372.phpt b/Zend/tests/bug41372.phpt
new file mode 100755
index 000000000..090efcd31
--- /dev/null
+++ b/Zend/tests/bug41372.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #41372 Internal pointer of source array resets during array copying
+--FILE--
+<?php
+$Foo = array('val1', 'val2', 'val3');
+end($Foo);
+echo key($Foo),"\n";
+$MagicInternalPointerResetter = $Foo;
+echo key($Foo),"\n";
+?>
+--EXPECT--
+2
+2
diff --git a/Zend/tests/bug41633_1.phpt b/Zend/tests/bug41633_1.phpt
new file mode 100755
index 000000000..fbd27418c
--- /dev/null
+++ b/Zend/tests/bug41633_1.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #41633.1 (self:: doesn't work for constants)
+--FILE--
+<?php
+class Foo {
+ const A = self::B;
+ const B = "ok";
+}
+echo Foo::A."\n";
+?>
+--EXPECT--
+ok
diff --git a/Zend/tests/bug41633_2.phpt b/Zend/tests/bug41633_2.phpt
new file mode 100755
index 000000000..1aa76be21
--- /dev/null
+++ b/Zend/tests/bug41633_2.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #41633.2 (Undefined class constants must not be substituted by strings)
+--FILE--
+<?php
+class Foo {
+ const A = self::B;
+}
+echo Foo::A."\n";
+?>
+--EXPECTF--
+Fatal error: Undefined class constant 'self::B' in %sbug41633_2.php on line 5
diff --git a/Zend/tests/bug41633_3.phpt b/Zend/tests/bug41633_3.phpt
new file mode 100755
index 000000000..9b537fe35
--- /dev/null
+++ b/Zend/tests/bug41633_3.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #41633.3 (Crash instantiating classes with self-referencing constants)
+--FILE--
+<?php
+class Foo {
+ const A = Foo::B;
+ const B = Foo::A;
+}
+echo Foo::A;
+?>
+--EXPECTF--
+Fatal error: Cannot declare self-referencing constant 'Foo::B' in %sbug41633_3.php on line %d
diff --git a/Zend/tests/bug41633_4.phpt b/Zend/tests/bug41633_4.phpt
new file mode 100755
index 000000000..16e58954d
--- /dev/null
+++ b/Zend/tests/bug41633_4.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #41633.4 (self:: doesn't work for constants)
+--FILE--
+<?php
+class Foo {
+ const A = self::B;
+ const B = "ok";
+}
+var_dump(defined("Foo::A"));
+?>
+--EXPECT--
+bool(true)
diff --git a/Zend/tests/bug41640.phpt b/Zend/tests/bug41640.phpt
new file mode 100644
index 000000000..c859d9085
--- /dev/null
+++ b/Zend/tests/bug41640.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #41640 (get_class_vars produces error on class constants)
+--FILE--
+<?php
+class foo {
+ const FOO = 1;
+ public $x = self::FOO;
+}
+
+var_dump(get_class_vars("foo"));
+--EXPECT--
+array(1) {
+ ["x"]=>
+ int(1)
+}
diff --git a/Zend/tests/bug41813.phpt b/Zend/tests/bug41813.phpt
new file mode 100644
index 000000000..c330b14fe
--- /dev/null
+++ b/Zend/tests/bug41813.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #41813 (segmentation fault when using string offset as an object)
+--FILE--
+<?php
+
+$foo = "50";
+$foo[0]->bar = "xyz";
+
+echo "Done\n";
+?>
+--EXPECTF--
+Fatal error: Cannot use string offset as an array in %s on line %d
diff --git a/Zend/tests/bug41919.phpt b/Zend/tests/bug41919.phpt
new file mode 100644
index 000000000..127eb97bc
--- /dev/null
+++ b/Zend/tests/bug41919.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #41919 (crash in string to array conversion)
+--FILE--
+<?php
+$foo="50";
+$foo[3]->bar[1] = "bang";
+
+echo "ok\n";
+?>
+--EXPECTF--
+Warning: Cannot use string offset as an array in %s/bug41919.php on line %d
+ok
diff --git a/Zend/tests/bug41929.phpt b/Zend/tests/bug41929.phpt
new file mode 100755
index 000000000..47c7118ed
--- /dev/null
+++ b/Zend/tests/bug41929.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #41929 Foreach on object does not iterate over all visible properties
+--FILE--
+<?php
+class C {
+ private $priv = "ok";
+
+ function doLoop() {
+ echo $this->priv,"\n";
+ foreach ($this as $k=>$v) {
+ echo "$k: $v\n";
+ }
+ }
+}
+
+class D extends C {
+}
+
+$myD = new D;
+$myD->doLoop();
+?>
+--EXPECT--
+ok
+priv: ok
diff --git a/Zend/tests/bug41961.phpt b/Zend/tests/bug41961.phpt
new file mode 100755
index 000000000..1a6e52308
--- /dev/null
+++ b/Zend/tests/bug41961.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #41961 (Ensure search for hidden private methods does not stray from class hierarchy)
+--FILE--
+<?php
+X::test();
+
+/** Class X is related to neither ParentClass nor ChildClass. */
+class X {
+ public static function test() {
+ $myChild = new ChildClass;
+ $myChild->secret(); // bug - invokes X::secret() instead of ChildClass::secret()
+ }
+ private function secret() {
+ echo "Called private " . __METHOD__ . "() on an instance of: " . get_class($this) . "\n";
+ }
+}
+
+class ParentClass {
+ private function secret() { }
+}
+
+class ChildClass extends ParentClass {
+ public function secret() {
+ echo "Called public " . __METHOD__ . "() on an instance of: " . get_class($this) . "\n";
+ }
+}
+?>
+--EXPECT--
+Called public ChildClass::secret() on an instance of: ChildClass
diff --git a/Zend/tests/bug42119.phpt b/Zend/tests/bug42119.phpt
new file mode 100755
index 000000000..79d70f0ae
--- /dev/null
+++ b/Zend/tests/bug42119.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #42119 (array_push($arr,&$obj) doesn't work with zend.ze1_compatibility_mode On)
+--INI--
+allow_call_time_pass_reference=1
+zend.ze1_compatibility_mode=1
+--FILE--
+<?php
+class myclass {
+ var $item = 1;
+}
+
+$arr = array();
+@$myobj = new myclass();
+array_push($arr,&$myobj);
+$myobj->item = 2;
+echo $arr[0]->item,"\n";
+?>
+--EXPECT--
+2
diff --git a/Zend/tests/bug42211.phpt b/Zend/tests/bug42211.phpt
new file mode 100644
index 000000000..e9f2a1e21
--- /dev/null
+++ b/Zend/tests/bug42211.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #42211 (property_exists() fails to find protected properties from a parent class)
+--FILE--
+<?php
+class A {
+ function foo() {
+ var_dump(property_exists('B', 'publicBar'));
+ var_dump(property_exists('B', 'protectedBar'));
+ var_dump(property_exists('B', 'privateBar'));
+ }
+}
+
+class B extends A {
+ static public $publicBar = "ok";
+ static protected $protectedBar = "ok";
+ static private $privateBar = "fail";
+}
+
+$a = new A();
+$a->foo();
+$b = new B();
+$b->foo();
+--EXPECT--
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+
diff --git a/Zend/tests/class_constants_001.phpt b/Zend/tests/class_constants_001.phpt
new file mode 100644
index 000000000..45270f6f7
--- /dev/null
+++ b/Zend/tests/class_constants_001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+class constants basic tests
+--FILE--
+<?php
+
+class test {
+ const val = "string";
+ const val2 = 1;
+}
+
+var_dump(test::val);
+var_dump(test::val2);
+
+var_dump(test::val3);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(6) "string"
+int(1)
+
+Fatal error: Undefined class constant 'val3' in %s on line %d
diff --git a/Zend/tests/class_constants_002.phpt b/Zend/tests/class_constants_002.phpt
new file mode 100644
index 000000000..9aad8088d
--- /dev/null
+++ b/Zend/tests/class_constants_002.phpt
@@ -0,0 +1,31 @@
+--TEST--
+class constants as default function arguments
+--FILE--
+<?php
+
+class test {
+ const val = 1;
+}
+
+function foo($v = test::val) {
+ var_dump($v);
+}
+
+function bar($b = NoSuchClass::val) {
+ var_dump($b);
+}
+
+foo();
+foo(5);
+
+bar(10);
+bar();
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(1)
+int(5)
+int(10)
+
+Fatal error: Class 'NoSuchClass' not found in %s on line %d
diff --git a/Zend/tests/class_constants_003.phpt b/Zend/tests/class_constants_003.phpt
new file mode 100644
index 000000000..c2782ff1c
--- /dev/null
+++ b/Zend/tests/class_constants_003.phpt
@@ -0,0 +1,33 @@
+--TEST--
+class constants as default function arguments and dynamically loaded classes
+--FILE--
+<?php
+
+$class_data = <<<DATA
+<?php
+class test {
+ const val = 1;
+}
+?>
+DATA;
+
+$filename = dirname(__FILE__)."/cc003.dat";
+file_put_contents($filename, $class_data);
+
+function foo($v = test::val) {
+ var_dump($v);
+}
+
+include $filename;
+
+foo();
+foo(5);
+
+unlink($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(1)
+int(5)
+Done
diff --git a/Zend/tests/double_to_string.phpt b/Zend/tests/double_to_string.phpt
index e79909384..2948b0b54 100644
--- a/Zend/tests/double_to_string.phpt
+++ b/Zend/tests/double_to_string.phpt
@@ -35,9 +35,9 @@ echo "Done\n";
--EXPECTF--
string(7) "2.9E+17"
string(7) "2.9E+14"
-string(14) "29000000000000"
string(%d) "2%s"
-string(14) "29000000000001"
+string(%d) "2%s"
+string(%d) "29%d"
string(13) "29000.7123123"
string(15) "239234242.71231"
string(16) "0.12345678901235"
diff --git a/Zend/tests/get_defined_vars.phpt b/Zend/tests/get_defined_vars.phpt
new file mode 100644
index 000000000..81aa97a45
--- /dev/null
+++ b/Zend/tests/get_defined_vars.phpt
@@ -0,0 +1,128 @@
+--TEST--
+Testing get_defined_vars() Function
+--FILE--
+<?php
+/* Prototype: array get_defined_vars(void);
+ * Description: Returns a multidimentional array of all defined variables.
+ */
+
+/* Various variables definitions used for testing of the function */
+
+$number = 22.33; //number
+$string = "sample string"; //string
+$array1 = array(1, 1, 2, 3, 5, 8); //simple array
+$assoc_array = array( 'a'=>97, 'c'=>99, 'A'=>65, 'C'=>67, 1=>"string1" ); //associative array
+$boolean = TRUE; //boolean
+
+/* Checking for Class and Objects */
+class sample {
+var $number = 233;
+var $string = "string2";
+public function func() {
+$local_var = 2;
+var_dump( get_defined_vars() );
+}
+}
+$sample_obj = new sample; //object declaration
+
+function func() {
+$string33 = 22;
+var_dump( get_defined_vars() );
+}
+
+$arr = get_defined_vars();
+
+/* Displaying various variable through the array captured by the get_defined_vars function call */
+echo "\n*** Displaying various variables through the array captured by the get_defined_vars function call ***\n";
+var_dump( $arr["argc"] );
+var_dump( $arr["number"] );
+var_dump( $arr["string"] );
+var_dump( $arr["array1"] );
+var_dump( $arr["assoc_array"] );
+var_dump( $arr["boolean"] );
+var_dump( $arr["sample_obj"] );
+
+
+echo "\n*** Checking for output when get_defined_vars called in local function ***\n";
+func();
+
+
+echo "\n*** Checking for output when get_defined_vars called in function of a class ***\n";
+$sample_obj->func();
+
+echo "\n*** Checking for output when get_defined_vars called in nested functions ***\n";
+function func1(){
+$func1_var = 2;
+var_dump( get_defined_vars() );
+function func2(){
+$func2_var = 3;
+var_dump( get_defined_vars() );
+}
+func2();
+}
+func1();
+
+echo "\nDone";
+?>
+--EXPECTF--
+*** Displaying various variables through the array captured by the get_defined_vars function call ***
+int(1)
+float(22.33)
+string(13) "sample string"
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(5)
+ [5]=>
+ int(8)
+}
+array(5) {
+ ["a"]=>
+ int(97)
+ ["c"]=>
+ int(99)
+ ["A"]=>
+ int(65)
+ ["C"]=>
+ int(67)
+ [1]=>
+ string(7) "string1"
+}
+bool(true)
+object(sample)#1 (2) {
+ ["number"]=>
+ int(233)
+ ["string"]=>
+ string(7) "string2"
+}
+
+*** Checking for output when get_defined_vars called in local function ***
+array(1) {
+ ["string33"]=>
+ int(22)
+}
+
+*** Checking for output when get_defined_vars called in function of a class ***
+array(1) {
+ ["local_var"]=>
+ int(2)
+}
+
+*** Checking for output when get_defined_vars called in nested functions ***
+array(1) {
+ ["func1_var"]=>
+ int(2)
+}
+array(1) {
+ ["func2_var"]=>
+ int(3)
+}
+
+Done
diff --git a/Zend/tests/is_a.phpt b/Zend/tests/is_a.phpt
index bf9f61264..03bb033a9 100755
--- a/Zend/tests/is_a.phpt
+++ b/Zend/tests/is_a.phpt
@@ -47,5 +47,4 @@ bool(false)
bool(true)
bool(false)
AUTOLOAD 'X1'
-AUTOLOAD 'X2'
bool(false)
diff --git a/Zend/tests/selfParent_001.phpt b/Zend/tests/selfParent_001.phpt
new file mode 100755
index 000000000..d2796996d
--- /dev/null
+++ b/Zend/tests/selfParent_001.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test when constants are initialised. See also selfParent_002.phpt.
+--FILE--
+<?php
+class A {
+ const myConst = "const in A";
+ const myDynConst = self::myConst;
+
+ public static function test() {
+ var_dump(self::myDynConst);
+ }
+}
+
+class B extends A {
+ const myConst = "const in B";
+
+ public static function test() {
+ var_dump(parent::myDynConst);
+ }
+}
+
+A::test();
+B::test();
+?>
+--EXPECT--
+string(10) "const in A"
+string(10) "const in A"
diff --git a/Zend/tests/selfParent_002.phpt b/Zend/tests/selfParent_002.phpt
new file mode 100755
index 000000000..45120177a
--- /dev/null
+++ b/Zend/tests/selfParent_002.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test when constants are initialised. See also selfParent_001.phpt.
+--FILE--
+<?php
+class A {
+ const myConst = "const in A";
+ const myDynConst = self::myConst;
+
+ public static function test() {
+ var_dump(self::myDynConst);
+ }
+}
+
+class B extends A {
+ const myConst = "const in B";
+
+ public static function test() {
+ var_dump(parent::myDynConst);
+ }
+}
+
+B::test();
+A::test();
+?>
+--EXPECT--
+string(10) "const in A"
+string(10) "const in A"
diff --git a/Zend/zend.c b/Zend/zend.c
index a2cd84c37..96e717d8b 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend.c,v 1.308.2.12.2.34 2007/04/26 19:08:58 tony2001 Exp $ */
+/* $Id: zend.c,v 1.308.2.12.2.35 2007/07/21 00:35:14 jani Exp $ */
#include "zend.h"
#include "zend_extensions.h"
@@ -560,7 +560,7 @@ static void scanner_globals_ctor(zend_scanner_globals *scanner_globals_p TSRMLS_
scanner_globals_p->yy_start_stack = 0;
}
-void zend_init_opcodes_handlers();
+void zend_init_opcodes_handlers(void);
int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions)
{
@@ -811,7 +811,7 @@ void zend_append_version_info(zend_extension *extension)
}
-ZEND_API char *get_zend_version()
+ZEND_API char *get_zend_version(void)
{
return zend_version_info;
}
diff --git a/Zend/zend.h b/Zend/zend.h
index 15ebabd05..a8c2f56c1 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend.h,v 1.293.2.11.2.8 2007/04/26 19:08:58 tony2001 Exp $ */
+/* $Id: zend.h,v 1.293.2.11.2.9 2007/07/23 16:17:10 jani Exp $ */
#ifndef ZEND_H
#define ZEND_H
@@ -648,6 +648,7 @@ END_EXTERN_C()
#define ZEND_MAX_RESERVED_RESOURCES 4
+#include "zend_operators.h"
#include "zend_variables.h"
#endif /* ZEND_H */
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 2da877bd8..b8480a33f 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_API.c,v 1.296.2.27.2.31 2007/05/30 10:17:43 tony2001 Exp $ */
+/* $Id: zend_API.c,v 1.296.2.27.2.33 2007/08/01 10:56:45 dmitry Exp $ */
#include "zend.h"
#include "zend_execute.h"
@@ -154,7 +154,9 @@ ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_arr
while (param_count-->0) {
zval **value = (zval**)(p-arg_count);
- if (EG(ze1_compatibility_mode) && Z_TYPE_PP(value) == IS_OBJECT) {
+ if (EG(ze1_compatibility_mode) &&
+ Z_TYPE_PP(value) == IS_OBJECT &&
+ !(*value)->is_ref) {
zval *value_ptr;
char *class_name;
zend_uint class_name_len;
@@ -1488,17 +1490,17 @@ try_again:
if (dep->type == MODULE_DEP_REQUIRED || dep->type == MODULE_DEP_OPTIONAL) {
b2 = b1 + 1;
while (b2 < end) {
- r = (zend_module_entry*)(*b2)->pData;
- if (strcasecmp(dep->name, r->name) == 0) {
- tmp = *b1;
- *b1 = *b2;
- *b2 = tmp;
- goto try_again;
- }
- b2++;
- }
- }
- dep++;
+ r = (zend_module_entry*)(*b2)->pData;
+ if (strcasecmp(dep->name, r->name) == 0) {
+ tmp = *b1;
+ *b1 = *b2;
+ *b2 = tmp;
+ goto try_again;
+ }
+ b2++;
+ }
+ }
+ dep++;
}
}
b1++;
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index df455ed38..91577b8eb 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_alloc.c,v 1.144.2.3.2.42 2007/05/28 10:07:50 tony2001 Exp $ */
+/* $Id: zend_alloc.c,v 1.144.2.3.2.43 2007/07/25 11:13:00 dmitry Exp $ */
#include "zend.h"
#include "zend_alloc.h"
@@ -1560,6 +1560,15 @@ ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent
free(heap);
}
} else {
+#ifdef HAVE_MEM_WIN32
+ /* FIX for bug #41713 */
+ /* TODO: add new "compact" handler */
+ if (storage->handlers->dtor == zend_mm_mem_win32_dtor &&
+ storage->handlers->init == zend_mm_mem_win32_init) {
+ HeapDestroy((HANDLE)storage->data);
+ storage->data = (void*)HeapCreate(HEAP_NO_SERIALIZE, 0, 0);
+ }
+#endif
heap->segments_list = NULL;
zend_mm_init(heap);
heap->real_size = 0;
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 869a4d59e..44b7fcfea 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.17 2007/04/16 08:09:54 dmitry Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.24 2007/08/22 13:19:47 dmitry Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -25,6 +25,7 @@
#include "zend_constants.h"
#include "zend_ini.h"
#include "zend_exceptions.h"
+#include "zend_extensions.h"
#undef ZEND_TEST_EXCEPTIONS
@@ -659,7 +660,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
convert_to_string_ex(class_name);
- if (zend_lookup_class_ex(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name), (instance_ce != NULL), &ce TSRMLS_CC) == FAILURE) {
+ if (zend_lookup_class_ex(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name), 0, &ce TSRMLS_CC) == FAILURE) {
retval = 0;
} else {
if (only_subclass) {
@@ -770,8 +771,8 @@ ZEND_FUNCTION(get_class_vars)
RETURN_FALSE;
} else {
array_init(return_value);
- add_class_vars(*pce, &(*pce)->default_properties, return_value TSRMLS_CC);
zend_update_class_constants(*pce TSRMLS_CC);
+ add_class_vars(*pce, &(*pce)->default_properties, return_value TSRMLS_CC);
add_class_vars(*pce, CE_STATIC_MEMBERS(*pce), return_value TSRMLS_CC);
}
}
@@ -789,7 +790,7 @@ ZEND_FUNCTION(get_object_vars)
char *key, *prop_name, *class_name;
uint key_len;
ulong num_index;
- int instanceof;
+ zend_object *zobj;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &obj) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -808,7 +809,7 @@ ZEND_FUNCTION(get_object_vars)
RETURN_FALSE;
}
- instanceof = EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), Z_OBJCE_PP(obj) TSRMLS_CC);
+ zobj = zend_objects_get_address(*obj TSRMLS_CC);
array_init(return_value);
@@ -816,17 +817,11 @@ ZEND_FUNCTION(get_object_vars)
while (zend_hash_get_current_data_ex(properties, (void **) &value, &pos) == SUCCESS) {
if (zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos) == HASH_KEY_IS_STRING) {
- if (key[0]) {
+ if (zend_check_property_access(zobj, key, key_len-1 TSRMLS_CC) == SUCCESS) {
+ zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name);
/* Not separating references */
(*value)->refcount++;
- add_assoc_zval_ex(return_value, key, key_len, *value);
- } else if (instanceof) {
- zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name);
- if (!memcmp(class_name, "*", 2) || (Z_OBJCE_P(EG(This)) == Z_OBJCE_PP(obj) && !strcmp(Z_OBJCE_P(EG(This))->name, class_name))) {
- /* Not separating references */
- (*value)->refcount++;
- add_assoc_zval_ex(return_value, prop_name, strlen(prop_name)+1, *value);
- }
+ add_assoc_zval_ex(return_value, prop_name, strlen(prop_name)+1, *value);
}
}
zend_hash_move_forward_ex(properties, &pos);
@@ -984,7 +979,8 @@ ZEND_FUNCTION(property_exists)
}
zend_unmangle_property_name(property_info->name, property_info->name_length, &class_name, &prop_name);
if (!strncmp(class_name, "*", 1)) {
- if (instanceof_function(EG(scope), ce TSRMLS_CC)) {
+ if (instanceof_function(EG(scope), ce TSRMLS_CC) ||
+ (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC))) {
RETURN_TRUE;
}
RETURN_FALSE;
@@ -1554,6 +1550,13 @@ static int add_extension_info(zend_module_entry *module, void *arg TSRMLS_DC)
return 0;
}
+static int add_zendext_info(zend_extension *ext, void *arg TSRMLS_DC)
+{
+ zval *name_array = (zval *)arg;
+ add_next_index_string(name_array, ext->name, 1);
+ return 0;
+}
+
static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC)
{
zval *name_array = (zval *)arg;
@@ -1568,16 +1571,23 @@ static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC)
}
-/* {{{ proto array get_loaded_extensions(void)
+/* {{{ proto array get_loaded_extensions([bool zend_extensions]) U
Return an array containing names of loaded extensions */
ZEND_FUNCTION(get_loaded_extensions)
{
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
+ zend_bool zendext = 0;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &zendext) == FAILURE) {
+ return;
}
array_init(return_value);
- zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t) add_extension_info, return_value TSRMLS_CC);
+
+ if (zendext) {
+ zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) add_zendext_info, return_value TSRMLS_CC);
+ } else {
+ zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t) add_extension_info, return_value TSRMLS_CC);
+ }
}
/* }}} */
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index ac1bdc770..e0e118424 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_constants.c,v 1.71.2.5.2.5 2007/04/04 00:42:42 iliaa Exp $ */
+/* $Id: zend_constants.c,v 1.71.2.5.2.7 2007/07/27 16:29:11 dmitry Exp $ */
#include "zend.h"
#include "zend_constants.h"
@@ -259,18 +259,19 @@ ZEND_API int zend_get_constant_ex(char *name, uint name_len, zval *result, zend_
retval = 0;
}
}
- efree(class_name);
if (retval && ce) {
if (zend_hash_find(&((*ce)->constants_table), constant_name, const_name_len+1, (void **) &ret_constant) != SUCCESS) {
retval = 0;
}
} else {
+ zend_error(E_ERROR, "Class '%s' not found", class_name);
retval = 0;
}
+ efree(class_name);
if (retval) {
- zval_update_constant(ret_constant, (void*)1 TSRMLS_CC);
+ zval_update_constant_ex(ret_constant, (void*)1, *ce TSRMLS_CC);
*result = **ret_constant;
zval_copy_ctor(result);
}
diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h
index 295121c85..04beefcf7 100644
--- a/Zend/zend_constants.h
+++ b/Zend/zend_constants.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_constants.h,v 1.31.2.2.2.2 2007/01/01 09:35:46 sebastian Exp $ */
+/* $Id: zend_constants.h,v 1.31.2.2.2.3 2007/08/02 23:54:19 stas Exp $ */
#ifndef ZEND_CONSTANTS_H
#define ZEND_CONSTANTS_H
@@ -26,7 +26,7 @@
#define CONST_CS (1<<0) /* Case Sensitive */
#define CONST_PERSISTENT (1<<1) /* Persistent */
-#define CONST_CT_SUBST (2<<1) /* Allow compile-time substitution */
+#define CONST_CT_SUBST (1<<2) /* Allow compile-time substitution */
#define PHP_USER_CONSTANT INT_MAX /* a constant defined in user space */
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 4b3631cd7..eb4616fba 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.c,v 1.716.2.12.2.19 2007/04/16 08:09:54 dmitry Exp $ */
+/* $Id: zend_execute.c,v 1.716.2.12.2.24 2007/07/19 15:29:30 jani Exp $ */
#define ZEND_INTENSIVE_DEBUGGING 0
@@ -366,7 +366,7 @@ static inline void zend_switch_free(zend_op *opline, temp_variable *Ts TSRMLS_DC
* quick & silent get_zval_ptr, and FREE_OP
*/
PZVAL_UNLOCK_FREE(T->str_offset.str);
- } else {
+ } else if (T(opline->op1.u.var).var.ptr) {
zval_ptr_dtor(&T(opline->op1.u.var).var.ptr);
if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { /* foreach() free */
zval_ptr_dtor(&T(opline->op1.u.var).var.ptr);
@@ -430,17 +430,16 @@ static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **va
}
}
+/* this should modify object only if it's empty */
static inline void make_real_object(zval **object_ptr TSRMLS_DC)
{
-/* this should modify object only if it's empty */
if (Z_TYPE_PP(object_ptr) == IS_NULL
- || (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr)==0)
- || (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRLEN_PP(object_ptr) == 0)) {
-
- if (!PZVAL_IS_REF(*object_ptr)) {
- SEPARATE_ZVAL(object_ptr);
- }
+ || (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr) == 0)
+ || (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRLEN_PP(object_ptr) == 0)
+ ) {
zend_error(E_STRICT, "Creating default object from empty value");
+
+ SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
zval_dtor(*object_ptr);
object_init(*object_ptr);
}
@@ -530,6 +529,10 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode
zval *value = get_zval_ptr(value_op, Ts, &free_value, BP_VAR_R);
zval **retval = &T(result->u.var).var.ptr;
+ if (!object_ptr) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
+ }
+
if (*object_ptr == EG(error_zval_ptr)) {
FREE_OP(free_op2);
if (!RETURN_VALUE_UNUSED(result)) {
@@ -1230,6 +1233,15 @@ static void zend_fetch_property_address(temp_variable *result, zval **container_
{
zval *container;
+ if (!container_ptr) {
+ zend_error(E_WARNING, "Cannot use string offset as an array");
+ if (result) {
+ result->var.ptr_ptr = &EG(error_zval_ptr);
+ PZVAL_LOCK(*result->var.ptr_ptr);
+ }
+ return;
+ }
+
container = *container_ptr;
if (container == EG(error_zval_ptr)) {
if (result) {
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index 38dd15204..67058e26d 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.h,v 1.84.2.4.2.7 2007/04/16 08:09:54 dmitry Exp $ */
+/* $Id: zend_execute.h,v 1.84.2.4.2.8 2007/07/21 00:35:14 jani Exp $ */
#ifndef ZEND_EXECUTE_H
#define ZEND_EXECUTE_H
@@ -186,8 +186,8 @@ ZEND_API zend_class_entry *zend_fetch_class(char *class_name, uint class_name_le
void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC);
#ifdef ZEND_WIN32
-void zend_init_timeout_thread();
-void zend_shutdown_timeout_thread();
+void zend_init_timeout_thread(void);
+void zend_shutdown_timeout_thread(void);
#define WM_REGISTER_ZEND_TIMEOUT (WM_USER+1)
#define WM_UNREGISTER_ZEND_TIMEOUT (WM_USER+2)
#endif
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 00841dc67..35c630f01 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute_API.c,v 1.331.2.20.2.21 2007/05/21 07:12:41 tony2001 Exp $ */
+/* $Id: zend_execute_API.c,v 1.331.2.20.2.24 2007/07/21 00:35:14 jani Exp $ */
#include <stdio.h>
#include <signal.h>
@@ -448,23 +448,35 @@ ZEND_API int zend_is_true(zval *op)
#include "../TSRM/tsrm_strtok_r.h"
+#define IS_VISITED_CONSTANT IS_CONSTANT_INDEX
+#define IS_CONSTANT_VISITED(p) (Z_TYPE_P(p) & IS_VISITED_CONSTANT)
+#define MARK_CONSTANT_VISITED(p) Z_TYPE_P(p) |= IS_VISITED_CONSTANT
+
ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC)
{
zval *p = *pp;
zend_bool inline_change = (zend_bool) (zend_uintptr_t) arg;
zval const_value;
+ char *colon;
- if (Z_TYPE_P(p) == IS_CONSTANT) {
+ if (IS_CONSTANT_VISITED(p)) {
+ zend_error(E_ERROR, "Cannot declare self-referencing constant '%s'", Z_STRVAL_P(p));
+ } else if (Z_TYPE_P(p) == IS_CONSTANT) {
int refcount;
zend_uchar is_ref;
SEPARATE_ZVAL_IF_NOT_REF(pp);
p = *pp;
+ MARK_CONSTANT_VISITED(p);
+
refcount = p->refcount;
is_ref = p->is_ref;
if (!zend_get_constant_ex(p->value.str.val, p->value.str.len, &const_value, scope TSRMLS_CC)) {
+ if ((colon = memchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p))) && colon[1] == ':') {
+ zend_error(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(p));
+ }
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
p->value.str.val,
p->value.str.val);
@@ -504,6 +516,9 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
continue;
}
if (!zend_get_constant_ex(str_index, str_index_len-1, &const_value, scope TSRMLS_CC)) {
+ if ((colon = memchr(str_index, ':', str_index_len-1)) && colon[1] == ':') {
+ zend_error(E_ERROR, "Undefined class constant '%s'", str_index);
+ }
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", str_index, str_index);
zend_hash_move_forward(Z_ARRVAL_P(p));
continue;
@@ -1360,7 +1375,7 @@ static unsigned __stdcall timeout_thread_proc(void *pArgs)
}
-void zend_init_timeout_thread()
+void zend_init_timeout_thread(void)
{
timeout_thread_event = CreateEvent(NULL, FALSE, FALSE, NULL);
timeout_thread_handle = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -1369,7 +1384,7 @@ void zend_init_timeout_thread()
}
-void zend_shutdown_timeout_thread()
+void zend_shutdown_timeout_thread(void)
{
if (!timeout_thread_initialized) {
return;
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index f2099fe21..61bf56ad0 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_hash.c,v 1.121.2.4.2.7 2007/02/21 14:11:00 dmitry Exp $ */
+/* $Id: zend_hash.c,v 1.121.2.4.2.8 2007/07/24 18:28:39 dmitry Exp $ */
#include "zend.h"
@@ -771,12 +771,17 @@ ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_fun
{
Bucket *p;
void *new_entry;
+ zend_bool setTargetPointer;
IS_CONSISTENT(source);
IS_CONSISTENT(target);
+ setTargetPointer = !target->pInternalPointer;
p = source->pListHead;
while (p) {
+ if (setTargetPointer && source->pInternalPointer == p) {
+ target->pInternalPointer = NULL;
+ }
if (p->nKeyLength) {
zend_hash_quick_update(target, p->arKey, p->nKeyLength, p->h, p->pData, size, &new_entry);
} else {
@@ -787,7 +792,9 @@ ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_fun
}
p = p->pListNext;
}
- target->pInternalPointer = target->pListHead;
+ if (!target->pInternalPointer) {
+ target->pInternalPointer = target->pListHead;
+ }
}
diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c
index d3311c10c..f1fc75354 100644
--- a/Zend/zend_ini.c
+++ b/Zend/zend_ini.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_ini.c,v 1.39.2.2.2.8 2007/04/16 08:09:54 dmitry Exp $ */
+/* $Id: zend_ini.c,v 1.39.2.2.2.11 2007/08/23 18:42:42 tony2001 Exp $ */
#include "zend.h"
#include "zend_qsort.h"
@@ -55,7 +55,9 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS
ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC);
} zend_end_try();
}
- efree(ini_entry->value);
+ if (ini_entry->value != ini_entry->orig_value) {
+ efree(ini_entry->value);
+ }
ini_entry->value = ini_entry->orig_value;
ini_entry->value_length = ini_entry->orig_value_length;
ini_entry->modified = 0;
@@ -234,6 +236,7 @@ ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value,
{
zend_ini_entry *ini_entry;
char *duplicate;
+ zend_bool modified;
TSRMLS_FETCH();
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) {
@@ -244,20 +247,24 @@ ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value,
return FAILURE;
}
+ modified = ini_entry->modified;
+
+ if (!EG(modified_ini_directives)) {
+ ALLOC_HASHTABLE(EG(modified_ini_directives));
+ zend_hash_init(EG(modified_ini_directives), 8, NULL, NULL, 0);
+ }
+ if (!modified) {
+ ini_entry->orig_value = ini_entry->value;
+ ini_entry->orig_value_length = ini_entry->value_length;
+ ini_entry->modified = 1;
+ zend_hash_add(EG(modified_ini_directives), name, name_length, &ini_entry, sizeof(zend_ini_entry*), NULL);
+ }
+
duplicate = estrndup(new_value, new_value_length);
-
+
if (!ini_entry->on_modify
|| ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC)==SUCCESS) {
- if (!ini_entry->modified) {
- ini_entry->orig_value = ini_entry->value;
- ini_entry->orig_value_length = ini_entry->value_length;
- ini_entry->modified = 1;
- if (!EG(modified_ini_directives)) {
- ALLOC_HASHTABLE(EG(modified_ini_directives));
- zend_hash_init(EG(modified_ini_directives), 8, NULL, NULL, 0);
- }
- zend_hash_add(EG(modified_ini_directives), name, name_length, &ini_entry, sizeof(zend_ini_entry*), NULL);
- } else { /* we already changed the value, free the changed value */
+ if (modified && ini_entry->orig_value != ini_entry->value) { /* we already changed the value, free the changed value */
efree(ini_entry->value);
}
ini_entry->value = duplicate;
diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h
index b23cca359..736cec358 100644
--- a/Zend/zend_ini.h
+++ b/Zend/zend_ini.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_ini.h,v 1.34.2.1.2.3 2007/01/01 09:35:46 sebastian Exp $ */
+/* $Id: zend_ini.h,v 1.34.2.1.2.4 2007/08/02 23:57:21 stas Exp $ */
#ifndef ZEND_INI_H
#define ZEND_INI_H
@@ -189,6 +189,7 @@ END_EXTERN_C()
#define ZEND_INI_STAGE_ACTIVATE (1<<2)
#define ZEND_INI_STAGE_DEACTIVATE (1<<3)
#define ZEND_INI_STAGE_RUNTIME (1<<4)
+#define ZEND_INI_STAGE_HTACCESS (1<<5)
/* INI parsing engine */
typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, int callback_type, void *arg);
diff --git a/Zend/zend_ini_parser.c b/Zend/zend_ini_parser.c
index f4dfc7499..c759a37aa 100644
--- a/Zend/zend_ini_parser.c
+++ b/Zend/zend_ini_parser.c
@@ -102,7 +102,7 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) 1998-2006 Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright (c) 1998-2007 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.1 2006/09/19 20:33:12 dmitry Exp $ */
+/* $Id: zend_ini_parser.y,v 1.41.2.2.2.2 2007/07/23 16:17:10 jani Exp $ */
#define DEBUG_CFG_PARSER 0
#include "zend.h"
@@ -157,11 +157,11 @@ void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
int i_op1, i_op2;
char str_result[MAX_LENGTH_OF_LONG];
- i_op1 = atoi(op1->value.str.val);
- free(op1->value.str.val);
+ i_op1 = atoi(Z_STRVAL_P(op1));
+ free(Z_STRVAL_P(op1));
if (op2) {
- i_op2 = atoi(op2->value.str.val);
- free(op2->value.str.val);
+ i_op2 = atoi(Z_STRVAL_P(op2));
+ free(Z_STRVAL_P(op2));
} else {
i_op2 = 0;
}
@@ -184,30 +184,30 @@ void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
break;
}
- result->value.str.len = zend_sprintf(str_result, "%d", i_result);
- result->value.str.val = (char *) malloc(result->value.str.len+1);
- memcpy(result->value.str.val, str_result, result->value.str.len);
- result->value.str.val[result->value.str.len] = 0;
- result->type = IS_STRING;
+ Z_STRLEN_P(result) = zend_sprintf(str_result, "%d", i_result);
+ Z_STRVAL_P(result) = (char *) malloc(Z_STRLEN_P(result)+1);
+ memcpy(Z_STRVAL_P(result), str_result, Z_STRLEN_P(result));
+ Z_STRVAL_P(result)[Z_STRLEN_P(result)] = 0;
+ Z_TYPE_P(result) = IS_STRING;
}
void zend_ini_init_string(zval *result)
{
- result->value.str.val = malloc(1);
- result->value.str.val[0] = 0;
- result->value.str.len = 0;
- result->type = IS_STRING;
+ Z_STRVAL_P(result) = malloc(1);
+ Z_STRVAL_P(result)[0] = 0;
+ Z_STRLEN_P(result) = 0;
+ Z_TYPE_P(result) = IS_STRING;
}
void zend_ini_add_string(zval *result, zval *op1, zval *op2)
-{
- int length = op1->value.str.len + op2->value.str.len;
-
- result->value.str.val = (char *) realloc(op1->value.str.val, length+1);
- memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len);
- result->value.str.val[length] = 0;
- result->value.str.len = length;
- result->type = IS_STRING;
+{
+ int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
+
+ Z_STRVAL_P(result) = (char *) realloc(Z_STRVAL_P(op1), length+1);
+ memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
+ Z_STRVAL_P(result)[length] = 0;
+ Z_STRLEN_P(result) = length;
+ Z_TYPE_P(result) = IS_STRING;
}
void zend_ini_get_constant(zval *result, zval *name)
@@ -215,15 +215,15 @@ void zend_ini_get_constant(zval *result, zval *name)
zval z_constant;
TSRMLS_FETCH();
- if (!memchr(name->value.str.val, ':', name->value.str.len)
- && zend_get_constant(name->value.str.val, name->value.str.len, &z_constant TSRMLS_CC)) {
+ if (!memchr(Z_STRVAL_P(name), ':', Z_STRLEN_P(name))
+ && zend_get_constant(Z_STRVAL_P(name), Z_STRLEN_P(name), &z_constant TSRMLS_CC)) {
/* z_constant is emalloc()'d */
convert_to_string(&z_constant);
- result->value.str.val = zend_strndup(z_constant.value.str.val, z_constant.value.str.len);
- result->value.str.len = z_constant.value.str.len;
- result->type = z_constant.type;
+ Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(z_constant), Z_STRLEN(z_constant));
+ Z_STRLEN_P(result) = Z_STRLEN(z_constant);
+ Z_TYPE_P(result) = Z_TYPE(z_constant);
zval_dtor(&z_constant);
- free(name->value.str.val);
+ free(Z_STRVAL_P(name));
} else {
*result = *name;
}
@@ -235,13 +235,13 @@ void zend_ini_get_var(zval *result, zval *name)
char *envvar;
TSRMLS_FETCH();
- if (zend_get_configuration_directive(name->value.str.val, name->value.str.len+1, &curval) == SUCCESS) {
- result->value.str.val = zend_strndup(curval.value.str.val, curval.value.str.len);
- result->value.str.len = curval.value.str.len;
- } else if ((envvar = zend_getenv(name->value.str.val, name->value.str.len TSRMLS_CC)) != NULL ||
- (envvar = getenv(name->value.str.val)) != NULL) {
- result->value.str.val = strdup(envvar);
- result->value.str.len = strlen(envvar);
+ if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRLEN_P(name)+1, &curval) == SUCCESS) {
+ Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(curval), Z_STRLEN(curval));
+ Z_STRLEN_P(result) = Z_STRLEN(curval);
+ } else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRLEN_P(name) TSRMLS_CC)) != NULL ||
+ (envvar = getenv(Z_STRVAL_P(name))) != NULL) {
+ Z_STRVAL_P(result) = strdup(envvar);
+ Z_STRLEN_P(result) = strlen(envvar);
} else {
zend_ini_init_string(result);
}
@@ -1579,11 +1579,11 @@ yyreduce:
{
#if DEBUG_CFG_PARSER
- printf("'%s' = '%s'\n", (yyvsp[(1) - (3)]).value.str.val, (yyvsp[(3) - (3)]).value.str.val);
+ printf("'%s' = '%s'\n", Z_STRVAL((yyvsp[(1) - (3)])), Z_STRVAL((yyvsp[(3) - (3)])));
#endif
ZEND_INI_PARSER_CB(&(yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)]), ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG);
- free((yyvsp[(1) - (3)]).value.str.val);
- free((yyvsp[(3) - (3)]).value.str.val);
+ free(Z_STRVAL((yyvsp[(1) - (3)])));
+ free(Z_STRVAL((yyvsp[(3) - (3)])));
}
break;
@@ -1591,22 +1591,22 @@ yyreduce:
{
#if DEBUG_CFG_PARSER
- printf("'%s'[ ] = '%s'\n", (yyvsp[(1) - (4)]).value.str.val, (yyvsp[(4) - (4)]).value.str.val);
+ printf("'%s'[ ] = '%s'\n", Z_STRVAL((yyvsp[(1) - (4)])), Z_STRVAL((yyvsp[(4) - (4)])));
#endif
ZEND_INI_PARSER_CB(&(yyvsp[(1) - (4)]), &(yyvsp[(4) - (4)]), ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG);
- free((yyvsp[(1) - (4)]).value.str.val);
- free((yyvsp[(4) - (4)]).value.str.val);
+ free(Z_STRVAL((yyvsp[(1) - (4)])));
+ free(Z_STRVAL((yyvsp[(4) - (4)])));
}
break;
case 6:
- { ZEND_INI_PARSER_CB(&(yyvsp[(1) - (1)]), NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); free((yyvsp[(1) - (1)]).value.str.val); }
+ { ZEND_INI_PARSER_CB(&(yyvsp[(1) - (1)]), NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); free(Z_STRVAL((yyvsp[(1) - (1)]))); }
break;
case 7:
- { ZEND_INI_PARSER_CB(&(yyvsp[(1) - (1)]), NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG); free((yyvsp[(1) - (1)]).value.str.val); }
+ { ZEND_INI_PARSER_CB(&(yyvsp[(1) - (1)]), NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG); free(Z_STRVAL((yyvsp[(1) - (1)]))); }
break;
case 9:
@@ -1656,7 +1656,7 @@ yyreduce:
case 18:
- { zend_ini_add_string(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)])); free((yyvsp[(2) - (2)]).value.str.val); }
+ { zend_ini_add_string(&(yyval), &(yyvsp[(1) - (2)]), &(yyvsp[(2) - (2)])); free(Z_STRVAL((yyvsp[(2) - (2)]))); }
break;
case 19:
diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y
index 1ec947d4f..a11d9114b 100644
--- a/Zend/zend_ini_parser.y
+++ b/Zend/zend_ini_parser.y
@@ -3,7 +3,7 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) 1998-2006 Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright (c) 1998-2007 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.1 2006/09/19 20:33:12 dmitry Exp $ */
+/* $Id: zend_ini_parser.y,v 1.41.2.2.2.2 2007/07/23 16:17:10 jani Exp $ */
#define DEBUG_CFG_PARSER 0
#include "zend.h"
@@ -58,11 +58,11 @@ void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
int i_op1, i_op2;
char str_result[MAX_LENGTH_OF_LONG];
- i_op1 = atoi(op1->value.str.val);
- free(op1->value.str.val);
+ i_op1 = atoi(Z_STRVAL_P(op1));
+ free(Z_STRVAL_P(op1));
if (op2) {
- i_op2 = atoi(op2->value.str.val);
- free(op2->value.str.val);
+ i_op2 = atoi(Z_STRVAL_P(op2));
+ free(Z_STRVAL_P(op2));
} else {
i_op2 = 0;
}
@@ -85,30 +85,30 @@ void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
break;
}
- result->value.str.len = zend_sprintf(str_result, "%d", i_result);
- result->value.str.val = (char *) malloc(result->value.str.len+1);
- memcpy(result->value.str.val, str_result, result->value.str.len);
- result->value.str.val[result->value.str.len] = 0;
- result->type = IS_STRING;
+ Z_STRLEN_P(result) = zend_sprintf(str_result, "%d", i_result);
+ Z_STRVAL_P(result) = (char *) malloc(Z_STRLEN_P(result)+1);
+ memcpy(Z_STRVAL_P(result), str_result, Z_STRLEN_P(result));
+ Z_STRVAL_P(result)[Z_STRLEN_P(result)] = 0;
+ Z_TYPE_P(result) = IS_STRING;
}
void zend_ini_init_string(zval *result)
{
- result->value.str.val = malloc(1);
- result->value.str.val[0] = 0;
- result->value.str.len = 0;
- result->type = IS_STRING;
+ Z_STRVAL_P(result) = malloc(1);
+ Z_STRVAL_P(result)[0] = 0;
+ Z_STRLEN_P(result) = 0;
+ Z_TYPE_P(result) = IS_STRING;
}
void zend_ini_add_string(zval *result, zval *op1, zval *op2)
-{
- int length = op1->value.str.len + op2->value.str.len;
-
- result->value.str.val = (char *) realloc(op1->value.str.val, length+1);
- memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len);
- result->value.str.val[length] = 0;
- result->value.str.len = length;
- result->type = IS_STRING;
+{
+ int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
+
+ Z_STRVAL_P(result) = (char *) realloc(Z_STRVAL_P(op1), length+1);
+ memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
+ Z_STRVAL_P(result)[length] = 0;
+ Z_STRLEN_P(result) = length;
+ Z_TYPE_P(result) = IS_STRING;
}
void zend_ini_get_constant(zval *result, zval *name)
@@ -116,15 +116,15 @@ void zend_ini_get_constant(zval *result, zval *name)
zval z_constant;
TSRMLS_FETCH();
- if (!memchr(name->value.str.val, ':', name->value.str.len)
- && zend_get_constant(name->value.str.val, name->value.str.len, &z_constant TSRMLS_CC)) {
+ if (!memchr(Z_STRVAL_P(name), ':', Z_STRLEN_P(name))
+ && zend_get_constant(Z_STRVAL_P(name), Z_STRLEN_P(name), &z_constant TSRMLS_CC)) {
/* z_constant is emalloc()'d */
convert_to_string(&z_constant);
- result->value.str.val = zend_strndup(z_constant.value.str.val, z_constant.value.str.len);
- result->value.str.len = z_constant.value.str.len;
- result->type = z_constant.type;
+ Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(z_constant), Z_STRLEN(z_constant));
+ Z_STRLEN_P(result) = Z_STRLEN(z_constant);
+ Z_TYPE_P(result) = Z_TYPE(z_constant);
zval_dtor(&z_constant);
- free(name->value.str.val);
+ free(Z_STRVAL_P(name));
} else {
*result = *name;
}
@@ -136,13 +136,13 @@ void zend_ini_get_var(zval *result, zval *name)
char *envvar;
TSRMLS_FETCH();
- if (zend_get_configuration_directive(name->value.str.val, name->value.str.len+1, &curval) == SUCCESS) {
- result->value.str.val = zend_strndup(curval.value.str.val, curval.value.str.len);
- result->value.str.len = curval.value.str.len;
- } else if ((envvar = zend_getenv(name->value.str.val, name->value.str.len TSRMLS_CC)) != NULL ||
- (envvar = getenv(name->value.str.val)) != NULL) {
- result->value.str.val = strdup(envvar);
- result->value.str.len = strlen(envvar);
+ if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRLEN_P(name)+1, &curval) == SUCCESS) {
+ Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(curval), Z_STRLEN(curval));
+ Z_STRLEN_P(result) = Z_STRLEN(curval);
+ } else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRLEN_P(name) TSRMLS_CC)) != NULL ||
+ (envvar = getenv(Z_STRVAL_P(name))) != NULL) {
+ Z_STRVAL_P(result) = strdup(envvar);
+ Z_STRLEN_P(result) = strlen(envvar);
} else {
zend_ini_init_string(result);
}
@@ -252,22 +252,22 @@ statement_list:
statement:
TC_STRING '=' string_or_value {
#if DEBUG_CFG_PARSER
- printf("'%s' = '%s'\n", $1.value.str.val, $3.value.str.val);
+ printf("'%s' = '%s'\n", Z_STRVAL($1), Z_STRVAL($3));
#endif
ZEND_INI_PARSER_CB(&$1, &$3, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG);
- free($1.value.str.val);
- free($3.value.str.val);
+ free(Z_STRVAL($1));
+ free(Z_STRVAL($3));
}
| TC_STRING BRACK '=' string_or_value {
#if DEBUG_CFG_PARSER
- printf("'%s'[ ] = '%s'\n", $1.value.str.val, $4.value.str.val);
+ printf("'%s'[ ] = '%s'\n", Z_STRVAL($1), Z_STRVAL($4));
#endif
ZEND_INI_PARSER_CB(&$1, &$4, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG);
- free($1.value.str.val);
- free($4.value.str.val);
+ free(Z_STRVAL($1));
+ free(Z_STRVAL($4));
}
- | TC_STRING { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); free($1.value.str.val); }
- | SECTION { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG); free($1.value.str.val); }
+ | TC_STRING { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); free(Z_STRVAL($1)); }
+ | SECTION { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG); free(Z_STRVAL($1)); }
| '\n'
;
@@ -286,7 +286,7 @@ var_string_list:
| TC_ENCAPSULATED_STRING { $$ = $1; }
| constant_string { $$ = $1; }
| var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); }
- | var_string_list TC_ENCAPSULATED_STRING { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); }
+ | var_string_list TC_ENCAPSULATED_STRING { zend_ini_add_string(&$$, &$1, &$2); free(Z_STRVAL($2)); }
| var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); }
;
diff --git a/Zend/zend_ini_scanner.c b/Zend/zend_ini_scanner.c
index 5c0719d18..b0baf4b6a 100644
--- a/Zend/zend_ini_scanner.c
+++ b/Zend/zend_ini_scanner.c
@@ -358,14 +358,15 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
#define YY_NUM_RULES 15
#define YY_END_OF_BUFFER 16
-static yyconst short int yy_accept[61] =
+static yyconst short int yy_accept[63] =
{ 0,
- 0, 0, 16, 9, 13, 10, 11, 9, 6, 14,
- 6, 12, 10, 14, 9, 9, 9, 9, 9, 6,
+ 0, 0, 16, 9, 13, 10, 11, 9, 8, 14,
+ 8, 12, 10, 14, 9, 9, 9, 9, 9, 7,
9, 11, 9, 0, 9, 9, 9, 9, 9, 0,
- 5, 7, 12, 12, 12, 0, 0, 1, 9, 3,
- 9, 2, 9, 9, 0, 4, 1, 1, 9, 3,
- 9, 3, 2, 9, 4, 4, 4, 1, 9, 0
+ 5, 6, 12, 12, 12, 0, 0, 1, 9, 3,
+ 9, 9, 2, 9, 9, 0, 4, 1, 1, 9,
+ 3, 9, 9, 3, 2, 9, 4, 4, 4, 1,
+ 9, 0
} ;
static yyconst int yy_ec[256] =
@@ -407,62 +408,64 @@ static yyconst int yy_meta[26] =
1, 1, 1, 2, 2
} ;
-static yyconst short int yy_base[65] =
+static yyconst short int yy_base[67] =
{ 0,
- 0, 0, 101, 0, 102, 102, 97, 21, 102, 92,
- 74, 24, 102, 25, 84, 78, 14, 76, 80, 102,
- 0, 102, 0, 28, 80, 74, 26, 72, 76, 82,
- 102, 102, 31, 102, 85, 75, 40, 81, 69, 41,
- 69, 78, 60, 61, 42, 45, 52, 75, 59, 73,
- 63, 71, 70, 60, 102, 70, 56, 59, 39, 102,
- 50, 64, 67, 70
+ 0, 0, 105, 0, 106, 106, 101, 21, 106, 96,
+ 78, 24, 106, 25, 88, 11, 26, 81, 85, 106,
+ 0, 106, 0, 35, 85, 13, 31, 78, 82, 88,
+ 106, 106, 46, 106, 91, 81, 40, 87, 75, 46,
+ 74, 74, 83, 65, 66, 48, 51, 54, 80, 64,
+ 78, 68, 65, 75, 74, 64, 106, 59, 61, 64,
+ 47, 106, 33, 69, 72, 75
} ;
-static yyconst short int yy_def[65] =
+static yyconst short int yy_def[67] =
{ 0,
- 60, 1, 60, 61, 60, 60, 60, 61, 60, 62,
- 60, 63, 60, 64, 61, 61, 61, 61, 61, 60,
- 61, 60, 8, 60, 61, 61, 61, 61, 61, 62,
- 60, 60, 63, 60, 60, 64, 64, 60, 61, 61,
- 61, 61, 61, 61, 60, 60, 60, 60, 61, 61,
- 61, 61, 61, 61, 60, 60, 60, 60, 61, 0,
- 60, 60, 60, 60
+ 62, 1, 62, 63, 62, 62, 62, 63, 62, 64,
+ 62, 65, 62, 66, 63, 63, 63, 63, 63, 62,
+ 63, 62, 8, 62, 63, 63, 63, 63, 63, 64,
+ 62, 62, 65, 62, 62, 66, 66, 62, 63, 63,
+ 63, 63, 63, 63, 63, 62, 62, 62, 62, 63,
+ 63, 63, 63, 63, 63, 63, 62, 62, 62, 62,
+ 63, 0, 62, 62, 62, 62
} ;
-static yyconst short int yy_nxt[128] =
+static yyconst short int yy_nxt[132] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 4, 4, 4, 15, 4, 16, 17, 4, 4,
- 18, 4, 19, 9, 20, 23, 34, 35, 41, 37,
- 42, 24, 45, 34, 35, 25, 38, 26, 27, 38,
- 41, 28, 42, 29, 37, 50, 45, 55, 56, 57,
- 21, 47, 52, 38, 55, 56, 58, 51, 55, 56,
- 57, 55, 56, 58, 30, 30, 30, 33, 33, 33,
- 36, 36, 55, 42, 53, 50, 52, 50, 59, 48,
- 42, 54, 53, 52, 49, 48, 46, 34, 31, 44,
- 43, 40, 39, 44, 43, 40, 39, 32, 31, 22,
-
- 60, 3, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 60
+ 18, 4, 19, 9, 20, 23, 34, 35, 40, 37,
+ 40, 24, 41, 21, 41, 25, 38, 26, 27, 46,
+ 42, 28, 43, 29, 37, 42, 38, 43, 34, 35,
+ 51, 48, 46, 57, 58, 59, 57, 58, 60, 38,
+ 54, 57, 52, 57, 58, 59, 57, 58, 60, 30,
+ 30, 30, 33, 33, 33, 36, 36, 43, 55, 51,
+ 54, 54, 51, 61, 49, 43, 56, 55, 54, 53,
+ 50, 49, 47, 34, 31, 45, 44, 39, 45, 44,
+
+ 39, 32, 31, 22, 62, 3, 62, 62, 62, 62,
+ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+ 62
} ;
-static yyconst short int yy_chk[128] =
+static yyconst short int yy_chk[132] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 8, 12, 12, 17, 14,
- 17, 8, 24, 33, 33, 8, 14, 8, 8, 24,
- 27, 8, 27, 8, 37, 40, 45, 46, 46, 46,
- 61, 37, 59, 45, 47, 47, 47, 40, 57, 57,
- 57, 58, 58, 58, 62, 62, 62, 63, 63, 63,
- 64, 64, 56, 54, 53, 52, 51, 50, 49, 48,
- 44, 43, 42, 41, 39, 38, 36, 35, 30, 29,
- 28, 26, 25, 19, 18, 16, 15, 11, 10, 7,
-
- 3, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 60
+ 1, 1, 1, 1, 1, 8, 12, 12, 16, 14,
+ 26, 8, 16, 63, 26, 8, 14, 8, 8, 24,
+ 17, 8, 17, 8, 37, 27, 24, 27, 33, 33,
+ 40, 37, 46, 47, 47, 47, 48, 48, 48, 46,
+ 61, 58, 40, 59, 59, 59, 60, 60, 60, 64,
+ 64, 64, 65, 65, 65, 66, 66, 56, 55, 54,
+ 53, 52, 51, 50, 49, 45, 44, 43, 42, 41,
+ 39, 38, 36, 35, 30, 29, 28, 25, 19, 18,
+
+ 15, 11, 10, 7, 3, 62, 62, 62, 62, 62,
+ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+ 62
} ;
static yy_state_type yy_last_accepting_state;
@@ -495,7 +498,7 @@ char *yytext;
+----------------------------------------------------------------------+
*/
-/* $Id: zend_ini_scanner.l,v 1.41.2.2.2.1 2006/09/19 20:33:12 dmitry Exp $ */
+/* $Id: zend_ini_scanner.l,v 1.41.2.2.2.2 2007/07/23 16:17:10 jani Exp $ */
#define yyleng SCNG(yy_leng)
#define yytext SCNG(yy_text)
@@ -526,6 +529,10 @@ ZEND_API ts_rsrc_id ini_scanner_globals_id;
ZEND_API zend_scanner_globals ini_scanner_globals;
#endif
+# define YY_INPUT(buf, result, max_size) \
+ if ( ((result = zend_stream_read(yyin, buf, max_size TSRMLS_CC)) == 0) \
+ && zend_stream_ferror( yyin TSRMLS_CC) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" );
static char *ini_filename;
@@ -534,19 +541,16 @@ void init_ini_scanner(TSRMLS_D)
SCNG(lineno)=1;
}
-
int zend_ini_scanner_get_lineno(TSRMLS_D)
{
return SCNG(lineno);
}
-
char *zend_ini_scanner_get_filename(TSRMLS_D)
{
return ini_filename;
}
-
int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC)
{
if (FAILURE == zend_stream_fixup(fh TSRMLS_CC)) {
@@ -560,7 +564,6 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC)
return SUCCESS;
}
-
int zend_ini_prepare_string_for_scanning(char *str TSRMLS_DC)
{
int len = strlen(str);
@@ -571,7 +574,6 @@ int zend_ini_prepare_string_for_scanning(char *str TSRMLS_DC)
return SUCCESS;
}
-
void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC)
{
zend_stream_close(fh);
@@ -816,13 +818,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 61 )
+ if ( yy_current_state >= 63 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 102 );
+ while ( yy_base[yy_current_state] != 106 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -857,18 +859,18 @@ YY_RULE_SETUP
case 2:
YY_RULE_SETUP
{
- ini_lval->value.str.val = zend_strndup("1", 1);
- ini_lval->value.str.len = 1;
- ini_lval->type = IS_STRING;
+ Z_STRVAL_P(ini_lval) = zend_strndup("1", 1);
+ Z_STRLEN_P(ini_lval) = 1;
+ Z_TYPE_P(ini_lval) = IS_STRING;
return CFG_TRUE;
}
YY_BREAK
case 3:
YY_RULE_SETUP
{
- ini_lval->value.str.val = zend_strndup("", 0);
- ini_lval->value.str.len = 0;
- ini_lval->type = IS_STRING;
+ Z_STRVAL_P(ini_lval) = zend_strndup("", 0);
+ Z_STRLEN_P(ini_lval) = 0;
+ Z_TYPE_P(ini_lval) = IS_STRING;
return CFG_FALSE;
}
YY_BREAK
@@ -889,9 +891,9 @@ YY_RULE_SETUP
yytext++;
yyleng--;
- ini_lval->value.str.val = zend_strndup(yytext, yyleng);
- ini_lval->value.str.len = yyleng;
- ini_lval->type = IS_STRING;
+ Z_STRVAL_P(ini_lval) = zend_strndup(yytext, yyleng);
+ Z_STRLEN_P(ini_lval) = yyleng;
+ Z_TYPE_P(ini_lval) = IS_STRING;
return SECTION;
}
YY_BREAK
@@ -916,28 +918,28 @@ YY_RULE_SETUP
/* eat leading " */
yytext++;
- ini_lval->value.str.val = zend_strndup(yytext, yyleng - 2);
- ini_lval->value.str.len = yyleng - 2;
- ini_lval->type = IS_STRING;
+ Z_STRVAL_P(ini_lval) = zend_strndup(yytext, yyleng - 2);
+ Z_STRLEN_P(ini_lval) = yyleng - 2;
+ Z_TYPE_P(ini_lval) = IS_STRING;
return TC_ENCAPSULATED_STRING;
}
YY_BREAK
case 6:
YY_RULE_SETUP
{
- return yytext[0];
+ return TC_DOLLAR_CURLY;
}
YY_BREAK
case 7:
YY_RULE_SETUP
{
- return TC_DOLLAR_CURLY;
+ Z_LVAL_P(ini_lval) = (long) yytext[0];
+ return yytext[0];
}
YY_BREAK
case 8:
YY_RULE_SETUP
{
- ini_lval->value.lval = (long) yytext[0];
return yytext[0];
}
YY_BREAK
@@ -966,9 +968,9 @@ YY_RULE_SETUP
}
}
if (yyleng!=0) {
- ini_lval->value.str.val = zend_strndup(yytext, yyleng);
- ini_lval->value.str.len = yyleng;
- ini_lval->type = IS_STRING;
+ Z_STRVAL_P(ini_lval) = zend_strndup(yytext, yyleng);
+ Z_STRLEN_P(ini_lval) = yyleng;
+ Z_TYPE_P(ini_lval) = IS_STRING;
return TC_STRING;
} else {
/* whitespace */
@@ -1311,7 +1313,7 @@ static yy_state_type yy_get_previous_state(TSRMLS_D)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 61 )
+ if ( yy_current_state >= 63 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1349,11 +1351,11 @@ void ***tsrm_ls;
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 61 )
+ if ( yy_current_state >= 63 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 60);
+ yy_is_jam = (yy_current_state == 62);
return yy_is_jam ? 0 : yy_current_state;
}
diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l
index 36fd8f947..6546e4788 100644
--- a/Zend/zend_ini_scanner.l
+++ b/Zend/zend_ini_scanner.l
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_ini_scanner.l,v 1.41.2.2.2.1 2006/09/19 20:33:12 dmitry Exp $ */
+/* $Id: zend_ini_scanner.l,v 1.41.2.2.2.2 2007/07/23 16:17:10 jani Exp $ */
#define yyleng SCNG(yy_leng)
#define yytext SCNG(yy_text)
@@ -48,6 +48,10 @@ ZEND_API ts_rsrc_id ini_scanner_globals_id;
ZEND_API zend_scanner_globals ini_scanner_globals;
#endif
+# define YY_INPUT(buf, result, max_size) \
+ if ( ((result = zend_stream_read(yyin, buf, max_size TSRMLS_CC)) == 0) \
+ && zend_stream_ferror( yyin TSRMLS_CC) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" );
static char *ini_filename;
@@ -56,19 +60,16 @@ void init_ini_scanner(TSRMLS_D)
SCNG(lineno)=1;
}
-
int zend_ini_scanner_get_lineno(TSRMLS_D)
{
return SCNG(lineno);
}
-
char *zend_ini_scanner_get_filename(TSRMLS_D)
{
return ini_filename;
}
-
int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC)
{
if (FAILURE == zend_stream_fixup(fh TSRMLS_CC)) {
@@ -82,7 +83,6 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC)
return SUCCESS;
}
-
int zend_ini_prepare_string_for_scanning(char *str TSRMLS_DC)
{
int len = strlen(str);
@@ -93,7 +93,6 @@ int zend_ini_prepare_string_for_scanning(char *str TSRMLS_DC)
return SUCCESS;
}
-
void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC)
{
zend_stream_close(fh);
@@ -113,17 +112,17 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<INITIAL>[ ]*("true"|"on"|"yes")[ ]* {
- ini_lval->value.str.val = zend_strndup("1", 1);
- ini_lval->value.str.len = 1;
- ini_lval->type = IS_STRING;
+ Z_STRVAL_P(ini_lval) = zend_strndup("1", 1);
+ Z_STRLEN_P(ini_lval) = 1;
+ Z_TYPE_P(ini_lval) = IS_STRING;
return CFG_TRUE;
}
-<INITIAL>[ ]*("false"|"off"|"no"|"none")[ ]* {
- ini_lval->value.str.val = zend_strndup("", 0);
- ini_lval->value.str.len = 0;
- ini_lval->type = IS_STRING;
+<INITIAL>[ ]*("false"|"off"|"no"|"none"|"null")[ ]* {
+ Z_STRVAL_P(ini_lval) = zend_strndup("", 0);
+ Z_STRLEN_P(ini_lval) = 0;
+ Z_TYPE_P(ini_lval) = IS_STRING;
return CFG_FALSE;
}
@@ -142,13 +141,12 @@ NEWLINE ("\r"|"\n"|"\r\n")
yytext++;
yyleng--;
- ini_lval->value.str.val = zend_strndup(yytext, yyleng);
- ini_lval->value.str.len = yyleng;
- ini_lval->type = IS_STRING;
+ Z_STRVAL_P(ini_lval) = zend_strndup(yytext, yyleng);
+ Z_STRLEN_P(ini_lval) = yyleng;
+ Z_TYPE_P(ini_lval) = IS_STRING;
return SECTION;
}
-
<INITIAL>["][^"]*["] {
char *p = yytext;
@@ -168,22 +166,22 @@ NEWLINE ("\r"|"\n"|"\r\n")
/* eat leading " */
yytext++;
- ini_lval->value.str.val = zend_strndup(yytext, yyleng - 2);
- ini_lval->value.str.len = yyleng - 2;
- ini_lval->type = IS_STRING;
+ Z_STRVAL_P(ini_lval) = zend_strndup(yytext, yyleng - 2);
+ Z_STRLEN_P(ini_lval) = yyleng - 2;
+ Z_TYPE_P(ini_lval) = IS_STRING;
return TC_ENCAPSULATED_STRING;
}
-<INITIAL>[&|~$(){}!] {
- return yytext[0];
-}
-
<INITIAL>"${" {
return TC_DOLLAR_CURLY;
}
<INITIAL>"}" {
- ini_lval->value.lval = (long) yytext[0];
+ Z_LVAL_P(ini_lval) = (long) yytext[0];
+ return yytext[0];
+}
+
+<INITIAL>[&|~$(){}!] {
return yytext[0];
}
@@ -210,9 +208,9 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
}
if (yyleng!=0) {
- ini_lval->value.str.val = zend_strndup(yytext, yyleng);
- ini_lval->value.str.len = yyleng;
- ini_lval->type = IS_STRING;
+ Z_STRVAL_P(ini_lval) = zend_strndup(yytext, yyleng);
+ Z_STRLEN_P(ini_lval) = yyleng;
+ Z_TYPE_P(ini_lval) = IS_STRING;
return TC_STRING;
} else {
/* whitespace */
diff --git a/Zend/zend_language_parser.c b/Zend/zend_language_parser.c
index c793b56cc..414b511ff 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.6 2007/05/18 18:36:04 stas Exp $ */
+/* $Id: zend_language_parser.y,v 1.160.2.4.2.8 2007/08/13 21:16:57 stas Exp $ */
/*
* LALR shift/reduce conflicts and how they are resolved:
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index 95f7e48d4..c15cda994 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.6 2007/05/18 18:36:04 stas Exp $ */
+/* $Id: zend_language_parser.y,v 1.160.2.4.2.8 2007/08/13 21:16:57 stas Exp $ */
/*
* LALR shift/reduce conflicts and how they are resolved:
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 68c7e122b..18e1b5569 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_object_handlers.c,v 1.135.2.6.2.20 2007/03/23 17:16:55 stas Exp $ */
+/* $Id: zend_object_handlers.c,v 1.135.2.6.2.22 2007/07/24 11:39:55 dmitry Exp $ */
#include "zend.h"
#include "zend_globals.h"
@@ -152,7 +152,7 @@ static int zend_verify_property_access(zend_property_info *property_info, zend_c
case ZEND_ACC_PROTECTED:
return zend_check_protected(property_info->ce, EG(scope));
case ZEND_ACC_PRIVATE:
- if (ce==EG(scope) && EG(scope)) {
+ if ((ce==EG(scope) || property_info->ce == EG(scope)) && EG(scope)) {
return 1;
} else {
return 0;
@@ -800,7 +800,9 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method
/* Ensure that we haven't overridden a private function and end up calling
* the overriding public function...
*/
- if (EG(scope) && fbc->op_array.fn_flags & ZEND_ACC_CHANGED) {
+ if (EG(scope) &&
+ is_derived_class(fbc->common.scope, EG(scope)) &&
+ fbc->op_array.fn_flags & ZEND_ACC_CHANGED) {
zend_function *priv_fbc;
if (zend_hash_find(&EG(scope)->function_table, lc_method_name, method_len+1, (void **) &priv_fbc)==SUCCESS
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c
index 0cd1f6a47..22998c559 100644
--- a/Zend/zend_objects_API.c
+++ b/Zend/zend_objects_API.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_objects_API.c,v 1.47.2.6.2.5 2007/01/01 09:35:47 sebastian Exp $ */
+/* $Id: zend_objects_API.c,v 1.47.2.6.2.6 2007/07/21 00:35:14 jani Exp $ */
#include "zend.h"
#include "zend_globals.h"
@@ -353,7 +353,7 @@ ZEND_API zval* zend_object_proxy_get(zval *property TSRMLS_DC)
return NULL;
}
-ZEND_API zend_object_handlers *zend_get_std_object_handlers()
+ZEND_API zend_object_handlers *zend_get_std_object_handlers(void)
{
return &std_object_handlers;
}
diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h
index bd05bbde9..90c02d599 100644
--- a/Zend/zend_objects_API.h
+++ b/Zend/zend_objects_API.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_objects_API.h,v 1.20.2.1.2.3 2007/01/01 09:35:47 sebastian Exp $ */
+/* $Id: zend_objects_API.h,v 1.20.2.1.2.4 2007/07/21 00:35:14 jani Exp $ */
#ifndef ZEND_OBJECTS_API_H
#define ZEND_OBJECTS_API_H
@@ -80,7 +80,7 @@ ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects
ZEND_API zval *zend_object_create_proxy(zval *object, zval *member TSRMLS_DC);
-ZEND_API zend_object_handlers *zend_get_std_object_handlers();
+ZEND_API zend_object_handlers *zend_get_std_object_handlers(void);
END_EXTERN_C()
#endif /* ZEND_OBJECTS_H */
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index b90fe47b6..4491eca41 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_operators.c,v 1.208.2.4.2.21 2007/04/23 09:56:30 dmitry Exp $ */
+/* $Id: zend_operators.c,v 1.208.2.4.2.23 2007/07/21 00:35:14 jani Exp $ */
#include <ctype.h>
@@ -1402,6 +1402,11 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
/* If both are objects sharing the same comparision handler then use is */
if (eq_comp) {
+ if (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)) {
+ /* object handles are identical, apprently this is the same object */
+ ZVAL_LONG(result, 0);
+ COMPARE_RETURN_AND_FREE(SUCCESS);
+ }
ZVAL_LONG(result, Z_OBJ_HT_P(op1)->compare_objects(op1, op2 TSRMLS_CC));
COMPARE_RETURN_AND_FREE(SUCCESS);
}
@@ -1837,7 +1842,7 @@ ZEND_API int zval_is_true(zval *op)
}
#ifdef ZEND_USE_TOLOWER_L
-ZEND_API void zend_update_current_locale()
+ZEND_API void zend_update_current_locale(void)
{
current_locale = _get_current_locale();
}
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index 55710116d..95908e803 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_operators.h,v 1.94.2.4.2.9 2007/01/01 09:35:47 sebastian Exp $ */
+/* $Id: zend_operators.h,v 1.94.2.4.2.10 2007/07/21 00:35:14 jani Exp $ */
#ifndef ZEND_OPERATORS_H
#define ZEND_OPERATORS_H
@@ -428,7 +428,7 @@ END_EXTERN_C()
#endif
#ifdef ZEND_USE_TOLOWER_L
-ZEND_API void zend_update_current_locale();
+ZEND_API void zend_update_current_locale(void);
#else
#define zend_update_current_locale()
#endif
diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c
index 0be3ffc5d..16dd509ef 100644
--- a/Zend/zend_strtod.c
+++ b/Zend/zend_strtod.c
@@ -89,8 +89,9 @@
* directly -- and assumed always to succeed.
*/
-/* $Id: zend_strtod.c,v 1.17.2.2.2.11 2007/05/04 16:19:57 tony2001 Exp $ */
+/* $Id: zend_strtod.c,v 1.17.2.2.2.12 2007/07/23 16:17:10 jani Exp $ */
+#include <zend_operators.h>
#include <zend_strtod.h>
#ifdef ZTS
diff --git a/Zend/zend_vm.h b/Zend/zend_vm.h
index 158d8afb2..4d6bdc08f 100644
--- a/Zend/zend_vm.h
+++ b/Zend/zend_vm.h
@@ -16,12 +16,12 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_vm.h,v 1.7.2.1.2.1 2007/01/01 09:35:47 sebastian Exp $ */
+/* $Id: zend_vm.h,v 1.7.2.1.2.2 2007/07/21 00:35:14 jani Exp $ */
#ifndef ZEND_VM_H
#define ZEND_VM_H
-ZEND_API void zend_vm_use_old_executor();
+ZEND_API void zend_vm_use_old_executor(void);
ZEND_API void zend_vm_set_opcode_handler(zend_op* opcode);
#define ZEND_VM_SET_OPCODE_HANDLER(opline) zend_vm_set_opcode_handler(opline)
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 419d2e19c..20319c455 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_vm_def.h,v 1.59.2.29.2.45 2007/05/18 13:12:04 dmitry Exp $ */
+/* $Id: zend_vm_def.h,v 1.59.2.29.2.47 2007/07/24 19:24:39 dmitry Exp $ */
/* If you change this file, please regenerate the zend_vm_execute.h and
* zend_vm_opcodes.h files by running:
@@ -2613,7 +2613,11 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, CONST|UNUSED, CONST)
ce = EX_T(opline->op1.u.var).class_entry;
if (zend_hash_find(&ce->constants_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) {
+ zend_class_entry *old_scope = EG(scope);
+
+ EG(scope) = ce;
zval_update_constant(value, (void *) 1 TSRMLS_CC);
+ EG(scope) = old_scope;
EX_T(opline->result.u.var).tmp_var = **value;
zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);
} else {
@@ -3123,11 +3127,9 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
array_ptr->refcount++;
}
} else {
- if (OP1_TYPE == IS_VAR &&
- free_op1.var == NULL &&
+ if ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) &&
!array_ptr->is_ref &&
array_ptr->refcount > 1) {
- /* non-separated return value from function */
zval *tmp;
ALLOC_ZVAL(tmp);
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 0307dae99..51e18469e 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -2122,7 +2122,7 @@ static int ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
- zend_free_op free_op1;
+
zval *array_ptr, **array_ptr_ptr;
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
@@ -2169,11 +2169,9 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
array_ptr->refcount++;
}
} else {
- if (IS_CONST == IS_VAR &&
- free_op1.var == NULL &&
+ if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) &&
!array_ptr->is_ref &&
array_ptr->refcount > 1) {
- /* non-separated return value from function */
zval *tmp;
ALLOC_ZVAL(tmp);
@@ -2694,7 +2692,11 @@ static int ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ce = EX_T(opline->op1.u.var).class_entry;
if (zend_hash_find(&ce->constants_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) {
+ zend_class_entry *old_scope = EG(scope);
+
+ EG(scope) = ce;
zval_update_constant(value, (void *) 1 TSRMLS_CC);
+ EG(scope) = old_scope;
EX_T(opline->result.u.var).tmp_var = **value;
zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);
} else {
@@ -4733,11 +4735,9 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
array_ptr->refcount++;
}
} else {
- if (IS_TMP_VAR == IS_VAR &&
- free_op1.var == NULL &&
+ if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) &&
!array_ptr->is_ref &&
array_ptr->refcount > 1) {
- /* non-separated return value from function */
zval *tmp;
ALLOC_ZVAL(tmp);
@@ -7873,11 +7873,9 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
array_ptr->refcount++;
}
} else {
- if (IS_VAR == IS_VAR &&
- free_op1.var == NULL &&
+ if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) &&
!array_ptr->is_ref &&
array_ptr->refcount > 1) {
- /* non-separated return value from function */
zval *tmp;
ALLOC_ZVAL(tmp);
@@ -15486,7 +15484,11 @@ static int ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
ce = EX_T(opline->op1.u.var).class_entry;
if (zend_hash_find(&ce->constants_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) {
+ zend_class_entry *old_scope = EG(scope);
+
+ EG(scope) = ce;
zval_update_constant(value, (void *) 1 TSRMLS_CC);
+ EG(scope) = old_scope;
EX_T(opline->result.u.var).tmp_var = **value;
zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);
} else {
@@ -19887,7 +19889,7 @@ static int ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
- zend_free_op free_op1;
+
zval *array_ptr, **array_ptr_ptr;
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
@@ -19934,11 +19936,9 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
array_ptr->refcount++;
}
} else {
- if (IS_CV == IS_VAR &&
- free_op1.var == NULL &&
+ if ((IS_CV == IS_CV || IS_CV == IS_VAR) &&
!array_ptr->is_ref &&
array_ptr->refcount > 1) {
- /* non-separated return value from function */
zval *tmp;
ALLOC_ZVAL(tmp);
@@ -26569,7 +26569,7 @@ static int ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
-void zend_init_opcodes_handlers()
+void zend_init_opcodes_handlers(void)
{
static const opcode_handler_t labels[] = {
ZEND_NOP_SPEC_HANDLER,
diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl
index 9a3bd5038..e1924a90c 100644
--- a/Zend/zend_vm_execute.skl
+++ b/Zend/zend_vm_execute.skl
@@ -71,7 +71,7 @@ ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC)
{%EXTERNAL_EXECUTOR%}
-void {%INITIALIZER_NAME%}()
+void {%INITIALIZER_NAME%}(void)
{
{%EXTERNAL_LABELS%}
}