wharmby         Mon Jan 26 22:27:06 2009 UTC

  Removed files:               
    /php-src/ext/standard/tests/general_functions       var_export.phpt 

  Modified files:              
    /php-src/ext/standard/tests/general_functions       
                                                        var_export_error2.phpt 
                                                        var_export_error1.phpt 
                                                        var_export_basic4.phpt 
                                                        var_export_basic8.phpt 
                                                        var_export_basic5.phpt 
                                                        var_export_error3.phpt 
                                                        var_export_basic1.phpt 
                                                        var_export_basic7.phpt 
                                                        var_export_basic6.phpt 
                                                        var_export_basic2.phpt 
                                                        var_export_basic3.phpt 
  Log:
  Split-ip  var_export.phpt and add new error tests. Tested on Windows, Linux 
and Linux 64 bit
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/var_export_error2.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/general_functions/var_export_error2.phpt
diff -u /dev/null 
php-src/ext/standard/tests/general_functions/var_export_error2.phpt:1.2
--- /dev/null   Mon Jan 26 22:27:04 2009
+++ php-src/ext/standard/tests/general_functions/var_export_error2.phpt Mon Jan 
26 22:27:03 2009
@@ -0,0 +1,25 @@
+--TEST--
+Test var_export() function : error conditions - recursive object
+--FILE--
+<?php
+/* Prototype  : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable 
+ * Source code: ext/standard/var.c
+ * Alias to functions: 
+ */
+
+...@$obj->p =& $obj;
+var_export($obj, true);
+
+?>
+===DONE===
+--EXPECTF--
+stdClass::__set_state(array(
+   'p' => 
+  stdClass::__set_state(array(
+     'p' => 
+    stdClass::__set_state(array(
+       'p' => 
+      stdClass::__set_state(array(
+
+Fatal error: Nesting level too deep - recursive dependency? in %s on line 9
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/var_export_error1.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/general_functions/var_export_error1.phpt
diff -u /dev/null 
php-src/ext/standard/tests/general_functions/var_export_error1.phpt:1.2
--- /dev/null   Mon Jan 26 22:27:04 2009
+++ php-src/ext/standard/tests/general_functions/var_export_error1.phpt Mon Jan 
26 22:27:03 2009
@@ -0,0 +1,38 @@
+--TEST--
+Test var_export() function : error conditions 
+--FILE--
+<?php
+/* Prototype  : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable 
+ * Source code: ext/standard/var.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing var_export() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing var_export() function with Zero arguments --\n";
+var_dump( var_export() );
+
+//Test var_export with one more than the expected number of arguments
+echo "\n-- Testing var_export() function with more than expected no. of 
arguments --\n";
+$var = 1;
+$return = true;
+$extra_arg = 10;
+var_dump( var_export($var, $return, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing var_export() : error conditions ***
+
+-- Testing var_export() function with Zero arguments --
+
+Warning: var_export() expects at least 1 parameter, 0 given in %s on line 12
+NULL
+
+-- Testing var_export() function with more than expected no. of arguments --
+
+Warning: var_export() expects at most 2 parameters, 3 given in %s on line 19
+NULL
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/var_export_basic4.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/general_functions/var_export_basic4.phpt
diff -u /dev/null 
php-src/ext/standard/tests/general_functions/var_export_basic4.phpt:1.2
--- /dev/null   Mon Jan 26 22:27:04 2009
+++ php-src/ext/standard/tests/general_functions/var_export_basic4.phpt Mon Jan 
26 22:27:04 2009
@@ -0,0 +1,147 @@
+--TEST--
+Test var_export() function with valid strings
+--FILE--
+<?php
+/* Prototype  : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable 
+ * Source code: ext/standard/var.c
+ * Alias to functions: 
+ */
+
+
+echo "*** Testing var_export() with valid strings ***\n";
+// different valid  string 
+$valid_strings = array(
+            "\"\"" => "",
+            "\" \"" => " ",
+            "''" => '',
+            "' '" => ' ',
+            "\"string\"" => "string",
+            "'string'" => 'string',
+            "\"\\0Hello\\0 World\\0\"" => "\0Hello\0 World\0",
+            "\"NULL\"" => "NULL",
+            "'null'" => 'null',
+            "\"FALSE\"" => "FALSE",
+            "'false'" => 'false',
+            "\"\\x0b\"" => "\x0b",
+            "\"\\0\"" => "\0",
+            "'\\0'" => '\0',
+            "'\\060'" => '\060',
+            "\"\\070\"" => "\070"
+);
+
+/* Loop to check for above strings with var_export() */
+echo "\n*** Output for strings ***\n";
+foreach($valid_strings as $key => $str) {
+       echo "\n-- Iteration: $key --\n";
+       var_export( $str );
+       echo "\n";
+       var_export( $str, FALSE);
+       echo "\n";
+       var_dump( var_export( $str, TRUE) );
+       echo "\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid strings ***
+
+*** Output for strings ***
+
+-- Iteration: "" --
+''
+''
+string(2) "''"
+
+
+-- Iteration: " " --
+' '
+' '
+string(3) "' '"
+
+
+-- Iteration: '' --
+''
+''
+string(2) "''"
+
+
+-- Iteration: ' ' --
+' '
+' '
+string(3) "' '"
+
+
+-- Iteration: "string" --
+'string'
+'string'
+string(8) "'string'"
+
+
+-- Iteration: 'string' --
+'string'
+'string'
+string(8) "'string'"
+
+
+-- Iteration: "\0Hello\0 World\0" --
+'' . "\0" . 'Hello' . "\0" . ' World' . "\0" . ''
+'' . "\0" . 'Hello' . "\0" . ' World' . "\0" . ''
+string(49) "'' . "\0" . 'Hello' . "\0" . ' World' . "\0" . ''"
+
+
+-- Iteration: "NULL" --
+'NULL'
+'NULL'
+string(6) "'NULL'"
+
+
+-- Iteration: 'null' --
+'null'
+'null'
+string(6) "'null'"
+
+
+-- Iteration: "FALSE" --
+'FALSE'
+'FALSE'
+string(7) "'FALSE'"
+
+
+-- Iteration: 'false' --
+'false'
+'false'
+string(7) "'false'"
+
+
+-- Iteration: "\x0b" --
+''
+''
+string(3) "''"
+
+
+-- Iteration: "\0" --
+'' . "\0" . ''
+'' . "\0" . ''
+string(14) "'' . "\0" . ''"
+
+
+-- Iteration: '\0' --
+'\\0'
+'\\0'
+string(5) "'\\0'"
+
+
+-- Iteration: '\060' --
+'\\060'
+'\\060'
+string(7) "'\\060'"
+
+
+-- Iteration: "\070" --
+'8'
+'8'
+string(3) "'8'"
+
+===DONE===
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/var_export_basic8.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/general_functions/var_export_basic8.phpt
diff -u /dev/null 
php-src/ext/standard/tests/general_functions/var_export_basic8.phpt:1.2
--- /dev/null   Mon Jan 26 22:27:05 2009
+++ php-src/ext/standard/tests/general_functions/var_export_basic8.phpt Mon Jan 
26 22:27:04 2009
@@ -0,0 +1,71 @@
+--TEST--
+var_export(): simple test with arrays and objects
+--FILE--
+<?php
+/* Prototype  : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable 
+ * Source code: ext/standard/var.c
+ * Alias to functions: 
+ */
+ 
+echo "\n\n-- Var export on a simple  object --\n";
+$o1 = new stdclass;
+$o1->p = '22';
+$o2 = new stdclass;
+$o2->a = 1;
+$o2->b = array('k'=>2); 
+$o2->x = $o1; 
+var_export($o2);
+
+echo "\n\n-- Var export on an simple array --\n";
+$a = array(1,2,3,4);
+var_export($a);
+
+echo "\n\n-- Var export on an nested array --\n";
+$a = array('one' => 'first');
+$b = array('foo' => $a, 'bar' => $o2);
+var_export($b);
+
+?>
+===DONE===
+--EXPECTF--
+-- Var export on a simple  object --
+stdClass::__set_state(array(
+   'a' => 1,
+   'b' => 
+  array (
+    'k' => 2,
+  ),
+   'x' => 
+  stdClass::__set_state(array(
+     'p' => '22',
+  )),
+))
+
+-- Var export on an simple array --
+array (
+  0 => 1,
+  1 => 2,
+  2 => 3,
+  3 => 4,
+)
+
+-- Var export on an nested array --
+array (
+  'foo' => 
+  array (
+    'one' => 'first',
+  ),
+  'bar' => 
+  stdClass::__set_state(array(
+     'a' => 1,
+     'b' => 
+    array (
+      'k' => 2,
+    ),
+     'x' => 
+    stdClass::__set_state(array(
+       'p' => '22',
+    )),
+  )),
+)===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/var_export_basic5.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/general_functions/var_export_basic5.phpt
diff -u /dev/null 
php-src/ext/standard/tests/general_functions/var_export_basic5.phpt:1.2
--- /dev/null   Mon Jan 26 22:27:05 2009
+++ php-src/ext/standard/tests/general_functions/var_export_basic5.phpt Mon Jan 
26 22:27:04 2009
@@ -0,0 +1,277 @@
+--TEST--
+Test var_export() function with valid arrays
+--FILE--
+<?php
+/* Prototype  : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable 
+ * Source code: ext/standard/var.c
+ * Alias to functions: 
+ */
+
+
+echo "*** Testing var_export() with valid arrays ***\n";
+// different valid  arrays 
+$valid_arrays = array(
+           "array()" => array(),
+           "array(NULL)" => array(NULL),
+           "array(null)" => array(null),
+           "array(true)" => array(true),
+           "array(\"\")" => array(""),
+           "array('')" => array(''),
+           "array(array(), array())" => array(array(), array()),
+           "array(array(1, 2), array('a', 'b'))" => array(array(1, 2), 
array('a', 'b')),
+           "array(1 => 'One')" => array(1 => 'One'),
+           "array(\"test\" => \"is_array\")" => array("test" => "is_array"),
+           "array(0)" => array(0),
+           "array(-1)" => array(-1),
+           "array(10.5, 5.6)" => array(10.5, 5.6),
+           "array(\"string\", \"test\")" => array("string", "test"),
+           "array('string', 'test')" => array('string', 'test')
+);
+
+/* Loop to check for above arrays with var_export() */
+echo "\n*** Output for arrays ***\n";
+foreach($valid_arrays as $key => $arr) {
+       echo "\n--Iteration: $key --\n";
+       var_export( $arr );
+       echo "\n";
+       var_export( $arr, FALSE);
+       echo "\n";
+       var_dump( var_export( $arr, TRUE) );
+       echo "\n";
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid arrays ***
+
+*** Output for arrays ***
+
+--Iteration: array() --
+array (
+)
+array (
+)
+string(9) "array (
+)"
+
+
+--Iteration: array(NULL) --
+array (
+  0 => NULL,
+)
+array (
+  0 => NULL,
+)
+string(22) "array (
+  0 => NULL,
+)"
+
+
+--Iteration: array(null) --
+array (
+  0 => NULL,
+)
+array (
+  0 => NULL,
+)
+string(22) "array (
+  0 => NULL,
+)"
+
+
+--Iteration: array(true) --
+array (
+  0 => true,
+)
+array (
+  0 => true,
+)
+string(22) "array (
+  0 => true,
+)"
+
+
+--Iteration: array("") --
+array (
+  0 => '',
+)
+array (
+  0 => '',
+)
+string(20) "array (
+  0 => '',
+)"
+
+
+--Iteration: array('') --
+array (
+  0 => '',
+)
+array (
+  0 => '',
+)
+string(20) "array (
+  0 => '',
+)"
+
+
+--Iteration: array(array(), array()) --
+array (
+  0 => 
+  array (
+  ),
+  1 => 
+  array (
+  ),
+)
+array (
+  0 => 
+  array (
+  ),
+  1 => 
+  array (
+  ),
+)
+string(55) "array (
+  0 => 
+  array (
+  ),
+  1 => 
+  array (
+  ),
+)"
+
+
+--Iteration: array(array(1, 2), array('a', 'b')) --
+array (
+  0 => 
+  array (
+    0 => 1,
+    1 => 2,
+  ),
+  1 => 
+  array (
+    0 => 'a',
+    1 => 'b',
+  ),
+)
+array (
+  0 => 
+  array (
+    0 => 1,
+    1 => 2,
+  ),
+  1 => 
+  array (
+    0 => 'a',
+    1 => 'b',
+  ),
+)
+string(107) "array (
+  0 => 
+  array (
+    0 => 1,
+    1 => 2,
+  ),
+  1 => 
+  array (
+    0 => 'a',
+    1 => 'b',
+  ),
+)"
+
+
+--Iteration: array(1 => 'One') --
+array (
+  1 => 'One',
+)
+array (
+  1 => 'One',
+)
+string(23) "array (
+  1 => 'One',
+)"
+
+
+--Iteration: array("test" => "is_array") --
+array (
+  'test' => 'is_array',
+)
+array (
+  'test' => 'is_array',
+)
+string(33) "array (
+  'test' => 'is_array',
+)"
+
+
+--Iteration: array(0) --
+array (
+  0 => 0,
+)
+array (
+  0 => 0,
+)
+string(19) "array (
+  0 => 0,
+)"
+
+
+--Iteration: array(-1) --
+array (
+  0 => -1,
+)
+array (
+  0 => -1,
+)
+string(20) "array (
+  0 => -1,
+)"
+
+
+--Iteration: array(10.5, 5.6) --
+array (
+  0 => 10.5,
+  1 => 5.6,
+)
+array (
+  0 => 10.5,
+  1 => 5.6,
+)
+string(34) "array (
+  0 => 10.5,
+  1 => 5.6,
+)"
+
+
+--Iteration: array("string", "test") --
+array (
+  0 => 'string',
+  1 => 'test',
+)
+array (
+  0 => 'string',
+  1 => 'test',
+)
+string(41) "array (
+  0 => 'string',
+  1 => 'test',
+)"
+
+
+--Iteration: array('string', 'test') --
+array (
+  0 => 'string',
+  1 => 'test',
+)
+array (
+  0 => 'string',
+  1 => 'test',
+)
+string(41) "array (
+  0 => 'string',
+  1 => 'test',
+)"
+
+===DONE===
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/var_export_error3.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/general_functions/var_export_error3.phpt
diff -u /dev/null 
php-src/ext/standard/tests/general_functions/var_export_error3.phpt:1.2
--- /dev/null   Mon Jan 26 22:27:05 2009
+++ php-src/ext/standard/tests/general_functions/var_export_error3.phpt Mon Jan 
26 22:27:04 2009
@@ -0,0 +1,27 @@
+--TEST--
+Test var_export() function : error conditions - recursive array
+--FILE--
+<?php
+/* Prototype  : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable 
+ * Source code: ext/standard/var.c
+ * Alias to functions: 
+ */
+
+$a[] =& $a;
+var_export($a, true);
+
+?>
+===DONE===
+--EXPECTF--
+array (
+  0 => 
+  array (
+    0 => 
+    array (
+      0 => 
+      array (
+        0 => 
+        array (
+
+Fatal error: Nesting level too deep - recursive dependency? in %s on line 9
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/var_export_basic1.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/general_functions/var_export_basic1.phpt
diff -u /dev/null 
php-src/ext/standard/tests/general_functions/var_export_basic1.phpt:1.2
--- /dev/null   Mon Jan 26 22:27:06 2009
+++ php-src/ext/standard/tests/general_functions/var_export_basic1.phpt Mon Jan 
26 22:27:04 2009
@@ -0,0 +1,141 @@
+--TEST--
+Test var_export() function with integer values
+--FILE--
+<?php
+/* Prototype  : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable 
+ * Source code: ext/standard/var.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing var_export() with integer values ***\n";
+// different integer vlaues 
+$valid_ints = array(
+                '0' => '0',
+                '1' => '1',
+                '-1' => '-1',
+                '-2147483648' => '-2147483648', // max negative integer value
+                '-2147483647' => '-2147483647', 
+                '2147483647' => 2147483647,  // max positive integer value
+                '2147483640' => 2147483640,
+                '0x123B' => 0x123B,      // integer as hexadecimal
+                "'0x12ab'" => '0x12ab',
+                "'0Xfff'" => '0Xfff',
+                "'0XFA'" => '0XFA',
+                "-0x80000000" => -0x80000000, // max negative integer as 
hexadecimal
+                "'0x7fffffff'" => '0x7fffffff',  // max postive integer as 
hexadecimal
+                "0x7FFFFFFF" => 0x7FFFFFFF,  // max postive integer as 
hexadecimal
+                "'0123'" => '0123',        // integer as octal
+                "01912" => 01912,       // should be quivalent to octal 1
+                "-020000000000" => -020000000000, // max negative integer as 
octal
+                "017777777777" => 017777777777,  // max positive integer as 
octal
+);
+
+/* Loop to check for above integer values with var_export() */
+echo "\n*** Output for integer values ***\n";
+foreach($valid_ints as $key => $int_value) {
+       echo "\n-- Iteration: $key --\n";
+       var_export( $int_value );
+       echo "\n";
+       var_export( $int_value, FALSE);
+       echo "\n";
+       var_dump( var_export( $int_value, TRUE) );
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with integer values ***
+
+*** Output for integer values ***
+
+-- Iteration: 0 --
+'0'
+'0'
+string(3) "'0'"
+
+-- Iteration: 1 --
+'1'
+'1'
+string(3) "'1'"
+
+-- Iteration: -1 --
+'-1'
+'-1'
+string(4) "'-1'"
+
+-- Iteration: -2147483648 --
+'-2147483648'
+'-2147483648'
+string(13) "'-2147483648'"
+
+-- Iteration: -2147483647 --
+'-2147483647'
+'-2147483647'
+string(13) "'-2147483647'"
+
+-- Iteration: 2147483647 --
+2147483647
+2147483647
+string(10) "2147483647"
+
+-- Iteration: 2147483640 --
+2147483640
+2147483640
+string(10) "2147483640"
+
+-- Iteration: 0x123B --
+4667
+4667
+string(4) "4667"
+
+-- Iteration: '0x12ab' --
+'0x12ab'
+'0x12ab'
+string(8) "'0x12ab'"
+
+-- Iteration: '0Xfff' --
+'0Xfff'
+'0Xfff'
+string(7) "'0Xfff'"
+
+-- Iteration: '0XFA' --
+'0XFA'
+'0XFA'
+string(6) "'0XFA'"
+
+-- Iteration: -0x80000000 --
+-2147483648
+-2147483648
+string(11) "-2147483648"
+
+-- Iteration: '0x7fffffff' --
+'0x7fffffff'
+'0x7fffffff'
+string(12) "'0x7fffffff'"
+
+-- Iteration: 0x7FFFFFFF --
+2147483647
+2147483647
+string(10) "2147483647"
+
+-- Iteration: '0123' --
+'0123'
+'0123'
+string(6) "'0123'"
+
+-- Iteration: 01912 --
+1
+1
+string(1) "1"
+
+-- Iteration: -020000000000 --
+-2147483648
+-2147483648
+string(11) "-2147483648"
+
+-- Iteration: 017777777777 --
+2147483647
+2147483647
+string(10) "2147483647"
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/var_export_basic7.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/general_functions/var_export_basic7.phpt
diff -u /dev/null 
php-src/ext/standard/tests/general_functions/var_export_basic7.phpt:1.2
--- /dev/null   Mon Jan 26 22:27:06 2009
+++ php-src/ext/standard/tests/general_functions/var_export_basic7.phpt Mon Jan 
26 22:27:04 2009
@@ -0,0 +1,59 @@
+--TEST--
+Test var_export() function with valid null values
+--FILE--
+<?php
+/* Prototype  : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable 
+ * Source code: ext/standard/var.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing var_export() with valid null values ***\n";
+
+// different valid  null vlaues 
+$unset_var = array();
+unset ($unset_var); // now a null
+$null_var = NULL;
+
+$valid_nulls = array(
+                "NULL" =>  NULL,
+                "null" => null,
+                "null_var" => $null_var,
+);
+
+/* Loop to check for above null values with var_export() */
+echo "\n*** Output for null values ***\n";
+foreach($valid_nulls as $key => $null_value) {
+       echo "\n-- Iteration: $key --\n";
+       var_export( $null_value );
+       echo "\n";
+       var_export( $null_value, FALSE);
+       echo "\n";
+       var_dump( var_export( $null_value, true) );
+       echo "\n";
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid null values ***
+
+*** Output for null values ***
+
+-- Iteration: NULL --
+NULL
+NULL
+string(4) "NULL"
+
+
+-- Iteration: null --
+NULL
+NULL
+string(4) "NULL"
+
+
+-- Iteration: null_var --
+NULL
+NULL
+string(4) "NULL"
+
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/var_export_basic6.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/general_functions/var_export_basic6.phpt
diff -u /dev/null 
php-src/ext/standard/tests/general_functions/var_export_basic6.phpt:1.2
--- /dev/null   Mon Jan 26 22:27:06 2009
+++ php-src/ext/standard/tests/general_functions/var_export_basic6.phpt Mon Jan 
26 22:27:04 2009
@@ -0,0 +1,310 @@
+--TEST--
+Test var_export() function with valid objects
+--FILE--
+<?php
+/* Prototype  : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable 
+ * Source code: ext/standard/var.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing var_export() with valid objects ***\n";
+
+// class with no members
+class foo
+{
+// no members 
+}
+
+// abstract class
+abstract class abstractClass
+{
+  abstract protected function getClassName();
+  public function printClassName () {
+    echo $this->getClassName() . "\n";
+  }
+}
+// implement abstract class
+class concreteClass extends abstractClass
+{
+  protected function getClassName() {
+    return "concreteClass";
+  }
+}
+
+// interface class 
+interface iValue
+{
+   public function setVal ($name, $val); 
+   public function dumpVal ();
+}
+// implement the interface
+class Value implements iValue
+{
+  private $vars = array ();
+  
+  public function setVal ( $name, $val ) {
+    $this->vars[$name] = $val;
+  }
+  
+  public function dumpVal () {
+    var_export ( $vars );
+  }
+}
+
+// a gereral class 
+class myClass 
+{
+  var $foo_object;
+  public $public_var;
+  public $public_var1;
+  private $private_var;
+  protected $protected_var;
+
+  function myClass ( ) {
+    $this->foo_object = new foo();
+    $this->public_var = 10;
+    $this->public_var1 = new foo();
+    $this->private_var = new foo();
+    $this->proected_var = new foo();
+  }  
+}
+
+// create a object of each class defined above
+$myClass_object = new myClass();
+$foo_object = new foo();
+$Value_object = new Value();
+$concreteClass_object = new concreteClass();
+
+$valid_objects = array(
+                  "new stdclass" => new stdclass,
+                  "new foo" => new foo,
+                  "new concreteClass" => new concreteClass,
+                  "new Value" => new Value,
+                  "new myClass" => new myClass,
+                  "myClass_object" => $myClass_object,
+                  "myClass_object->foo_object" => $myClass_object->foo_object,
+                  "myClass_object->public_var1" => 
$myClass_object->public_var1,
+                  "foo_object" => $foo_object,
+                  "Value_object" => $Value_object,
+                  "concreteClass_object" => $concreteClass_object
+                 ); 
+/* Loop to check for above objects with var_export() */
+echo "\n*** Output for objects ***\n";
+foreach($valid_objects as $key => $obj) {
+       echo "\n-- Iteration: $key --\n";
+       var_export( $obj );
+       echo "\n";
+       var_export( $obj, FALSE);
+       echo "\n";
+       var_dump( var_export( $obj, TRUE) );
+       echo "\n";
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid objects ***
+
+*** Output for objects ***
+
+-- Iteration: new stdclass --
+stdClass::__set_state(array(
+))
+stdClass::__set_state(array(
+))
+string(31) "stdClass::__set_state(array(
+))"
+
+
+-- Iteration: new foo --
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+-- Iteration: new concreteClass --
+concreteClass::__set_state(array(
+))
+concreteClass::__set_state(array(
+))
+string(36) "concreteClass::__set_state(array(
+))"
+
+
+-- Iteration: new Value --
+Value::__set_state(array(
+   'vars' => 
+  array (
+  ),
+))
+Value::__set_state(array(
+   'vars' => 
+  array (
+  ),
+))
+string(57) "Value::__set_state(array(
+   'vars' => 
+  array (
+  ),
+))"
+
+
+-- Iteration: new myClass --
+myClass::__set_state(array(
+   'foo_object' => 
+  foo::__set_state(array(
+  )),
+   'public_var' => 10,
+   'public_var1' => 
+  foo::__set_state(array(
+  )),
+   'private_var' => 
+  foo::__set_state(array(
+  )),
+   'protected_var' => NULL,
+   'proected_var' => 
+  foo::__set_state(array(
+  )),
+))
+myClass::__set_state(array(
+   'foo_object' => 
+  foo::__set_state(array(
+  )),
+   'public_var' => 10,
+   'public_var1' => 
+  foo::__set_state(array(
+  )),
+   'private_var' => 
+  foo::__set_state(array(
+  )),
+   'protected_var' => NULL,
+   'proected_var' => 
+  foo::__set_state(array(
+  )),
+))
+string(293) "myClass::__set_state(array(
+   'foo_object' => 
+  foo::__set_state(array(
+  )),
+   'public_var' => 10,
+   'public_var1' => 
+  foo::__set_state(array(
+  )),
+   'private_var' => 
+  foo::__set_state(array(
+  )),
+   'protected_var' => NULL,
+   'proected_var' => 
+  foo::__set_state(array(
+  )),
+))"
+
+
+-- Iteration: myClass_object --
+myClass::__set_state(array(
+   'foo_object' => 
+  foo::__set_state(array(
+  )),
+   'public_var' => 10,
+   'public_var1' => 
+  foo::__set_state(array(
+  )),
+   'private_var' => 
+  foo::__set_state(array(
+  )),
+   'protected_var' => NULL,
+   'proected_var' => 
+  foo::__set_state(array(
+  )),
+))
+myClass::__set_state(array(
+   'foo_object' => 
+  foo::__set_state(array(
+  )),
+   'public_var' => 10,
+   'public_var1' => 
+  foo::__set_state(array(
+  )),
+   'private_var' => 
+  foo::__set_state(array(
+  )),
+   'protected_var' => NULL,
+   'proected_var' => 
+  foo::__set_state(array(
+  )),
+))
+string(293) "myClass::__set_state(array(
+   'foo_object' => 
+  foo::__set_state(array(
+  )),
+   'public_var' => 10,
+   'public_var1' => 
+  foo::__set_state(array(
+  )),
+   'private_var' => 
+  foo::__set_state(array(
+  )),
+   'protected_var' => NULL,
+   'proected_var' => 
+  foo::__set_state(array(
+  )),
+))"
+
+
+-- Iteration: myClass_object->foo_object --
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+-- Iteration: myClass_object->public_var1 --
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+-- Iteration: foo_object --
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+-- Iteration: Value_object --
+Value::__set_state(array(
+   'vars' => 
+  array (
+  ),
+))
+Value::__set_state(array(
+   'vars' => 
+  array (
+  ),
+))
+string(57) "Value::__set_state(array(
+   'vars' => 
+  array (
+  ),
+))"
+
+
+-- Iteration: concreteClass_object --
+concreteClass::__set_state(array(
+))
+concreteClass::__set_state(array(
+))
+string(36) "concreteClass::__set_state(array(
+))"
+
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/var_export_basic2.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/general_functions/var_export_basic2.phpt
diff -u /dev/null 
php-src/ext/standard/tests/general_functions/var_export_basic2.phpt:1.2
--- /dev/null   Mon Jan 26 22:27:06 2009
+++ php-src/ext/standard/tests/general_functions/var_export_basic2.phpt Mon Jan 
26 22:27:04 2009
@@ -0,0 +1,76 @@
+--TEST--
+Test var_export() function with valid boolean values
+--FILE--
+<?php
+
+/* Prototype  : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable 
+ * Source code: ext/standard/var.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing var_export() with valid boolean values ***\n";
+// different valid  boolean vlaues 
+$valid_bool = array(
+                   "1" => 1,
+                   "TRUE" => TRUE,
+            "true" => true, 
+            "0" => 0,
+                   "FALSE" => FALSE,
+                   "false" => false
+);
+               
+/* Loop to check for above boolean values with var_export() */
+echo "\n*** Output for boolean values ***\n";
+foreach($valid_bool as $key => $bool_value) {
+       echo "\n-- Iteration: $key --\n";
+       var_export( $bool_value );
+       echo "\n";
+       var_export( $bool_value, FALSE);
+       echo "\n";
+       var_dump( var_export( $bool_value, TRUE) );
+       echo "\n";
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid boolean values ***
+
+*** Output for boolean values ***
+
+-- Iteration: 1 --
+1
+1
+string(1) "1"
+
+
+-- Iteration: TRUE --
+true
+true
+string(4) "true"
+
+
+-- Iteration: true --
+true
+true
+string(4) "true"
+
+
+-- Iteration: 0 --
+0
+0
+string(1) "0"
+
+
+-- Iteration: FALSE --
+false
+false
+string(5) "false"
+
+
+-- Iteration: false --
+false
+false
+string(5) "false"
+
+===DONE===
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/var_export_basic3.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/general_functions/var_export_basic3.phpt
diff -u /dev/null 
php-src/ext/standard/tests/general_functions/var_export_basic3.phpt:1.2
--- /dev/null   Mon Jan 26 22:27:06 2009
+++ php-src/ext/standard/tests/general_functions/var_export_basic3.phpt Mon Jan 
26 22:27:04 2009
@@ -0,0 +1,175 @@
+--TEST--
+Test var_export() function with valid float values
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype  : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable 
+ * Source code: ext/standard/var.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing var_export() with valid float values ***\n";
+// different valid  float vlaues 
+$valid_floats = array(
+         "-2147483649" => -2147483649, // float value
+         "2147483648" => 2147483648,  // float value
+         "-0x80000001" => -0x80000001, // float value, beyond max negative int
+         "0x800000001" => 0x800000001, // float value, beyond max positive int
+         "020000000001" => 020000000001, // float value, beyond max positive 
int
+         "-020000000001" => -020000000001, // float value, beyond max negative 
int
+         "0.0" => 0.0,
+         "-0.1" => -0.1,
+         "10.0000000000000000005" => 10.0000000000000000005,
+         "10.5e+5" => 10.5e+5,
+         "1e5" => 1e5,
+         "1e-5" => 1e-5,
+         "1e+5" => 1e+5,
+         "1E5" => 1E5,
+         "1E+5" => 1E+5,
+         "1E-5" => 1E-5,
+         ".5e+7" => .5e+7,
+         ".6e-19" => .6e-19,
+         ".05E+44" => .05E+44,
+         ".0034E-30" => .0034E-30
+);
+/* Loop to check for above float values with var_export() */
+echo "\n*** Output for float values ***\n";
+foreach($valid_floats as $key => $float_value) {
+       echo "\n-- Iteration: $key --\n";
+       var_export( $float_value );
+       echo "\n";
+       var_export( $float_value, FALSE);
+       echo "\n";
+       var_dump( var_export( $float_value, TRUE) );
+       echo "\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid float values ***
+
+*** Output for float values ***
+
+-- Iteration: -2147483649 --
+-2147483649
+-2147483649
+string(11) "-2147483649"
+
+
+-- Iteration: 2147483648 --
+2147483648
+2147483648
+string(10) "2147483648"
+
+
+-- Iteration: -0x80000001 --
+-2147483649
+-2147483649
+string(11) "-2147483649"
+
+
+-- Iteration: 0x800000001 --
+34359738369
+34359738369
+string(11) "34359738369"
+
+
+-- Iteration: 020000000001 --
+2147483649
+2147483649
+string(10) "2147483649"
+
+
+-- Iteration: -020000000001 --
+-2147483649
+-2147483649
+string(11) "-2147483649"
+
+
+-- Iteration: 0.0 --
+0
+0
+string(1) "0"
+
+
+-- Iteration: -0.1 --
+-0.1
+-0.1
+string(4) "-0.1"
+
+
+-- Iteration: 10.0000000000000000005 --
+10
+10
+string(2) "10"
+
+
+-- Iteration: 10.5e+5 --
+1050000
+1050000
+string(7) "1050000"
+
+
+-- Iteration: 1e5 --
+100000
+100000
+string(6) "100000"
+
+
+-- Iteration: 1e-5 --
+1.0E-5
+1.0E-5
+string(6) "1.0E-5"
+
+
+-- Iteration: 1e+5 --
+100000
+100000
+string(6) "100000"
+
+
+-- Iteration: 1E5 --
+100000
+100000
+string(6) "100000"
+
+
+-- Iteration: 1E+5 --
+100000
+100000
+string(6) "100000"
+
+
+-- Iteration: 1E-5 --
+1.0E-5
+1.0E-5
+string(6) "1.0E-5"
+
+
+-- Iteration: .5e+7 --
+5000000
+5000000
+string(7) "5000000"
+
+
+-- Iteration: .6e-19 --
+6.0E-20
+6.0E-20
+string(7) "6.0E-20"
+
+
+-- Iteration: .05E+44 --
+5.0E+42
+5.0E+42
+string(7) "5.0E+42"
+
+
+-- Iteration: .0034E-30 --
+3.4E-33
+3.4E-33
+string(7) "3.4E-33"
+
+===DONE===

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to