uw                                       Mon, 25 Jul 2011 14:53:01 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=313673

Log:
Test update. 5.4+ throws a catchable fatal error, 5.3 does not.

Changed paths:
    U   php/php-src/branches/PHP_5_4/ext/mysqli/tests/connect.inc
    U   php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_fetch_object.phpt
    U   
php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_fetch_object_oo.phpt
    U   php/php-src/trunk/ext/mysqli/tests/connect.inc
    U   php/php-src/trunk/ext/mysqli/tests/mysqli_fetch_object.phpt
    U   php/php-src/trunk/ext/mysqli/tests/mysqli_fetch_object_oo.phpt

Modified: php/php-src/branches/PHP_5_4/ext/mysqli/tests/connect.inc
===================================================================
--- php/php-src/branches/PHP_5_4/ext/mysqli/tests/connect.inc	2011-07-25 14:38:26 UTC (rev 313672)
+++ php/php-src/branches/PHP_5_4/ext/mysqli/tests/connect.inc	2011-07-25 14:53:01 UTC (rev 313673)
@@ -225,4 +225,20 @@
 	} else {
 		printf("skip Eeeek/BUG/FIXME - connect.inc included twice! skipif bug?\n");
 	}
-?>
\ No newline at end of file
+
+	function handle_catchable_fatal($errno, $error, $file, $line) {
+		static $errcodes = array();
+		if (empty($errcodes)) {
+			$constants = get_defined_constants();
+			foreach ($constants as $name => $value) {
+				if (substr($name, 0, 2) == "E_")
+					$errcodes[$value] = $name;
+			}
+		}
+		printf("[%s] %s in %s on line %s\n",
+			(isset($errcodes[$errno])) ? $errcodes[$errno] : $errno,
+			 $error, $file, $line);
+
+		return true;
+	}
+?>

Modified: php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_fetch_object.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_fetch_object.phpt	2011-07-25 14:38:26 UTC (rev 313672)
+++ php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_fetch_object.phpt	2011-07-25 14:53:01 UTC (rev 313673)
@@ -10,6 +10,8 @@
 <?php
 	include_once("connect.inc");

+	set_error_handler('handle_catchable_fatal');
+
 	$tmp    = NULL;
 	$link   = NULL;

@@ -57,7 +59,7 @@

 	}

-	$obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', null);
+	$obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array());

 	if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
 		printf("[006] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
@@ -97,7 +99,7 @@
 	Also, I did not ask to get exceptions using the mysqli_options()
 	*/
 	try {
-		if (false !== ($obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', 'a')))
+		if (false !== ($obj = @mysqli_fetch_object($res, 'mysqli_fetch_object_construct', 'a')))
 			printf("[011] Should have failed\n");
 	} catch (Exception $e) {
 		printf("%s\n", $e->getMessage());
@@ -136,22 +138,19 @@
 	require_once("clean_table.inc");
 ?>
 --EXPECTF--
-Warning: Missing argument 1 for mysqli_fetch_object_construct::__construct() in %s on line %d
-
-Warning: Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
-
-Notice: Undefined variable: a in %s on line %d
-
-Notice: Undefined variable: b in %s on line %d
-
-Warning: Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
-
-Notice: Undefined variable: b in %s on line %d
+[E_WARNING] mysqli_fetch_object() expects at least 1 parameter, 0 given in %s on line %d
+[E_WARNING] mysqli_fetch_object() expects parameter 1 to be mysqli_result, null given in %s on line %d
+[E_WARNING] Missing argument 1 for mysqli_fetch_object_construct::__construct() in %s on line %d
+[E_WARNING] Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
+[E_NOTICE] Undefined variable: a in %s on line %d
+[E_NOTICE] Undefined variable: b in %s on line %d
+[E_WARNING] Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
+[E_NOTICE] Undefined variable: b in %s on line %d
 NULL
 NULL
-
-Warning: mysqli_fetch_object(): Couldn't fetch mysqli_result in %s on line %d
+[E_WARNING] mysqli_fetch_object(): Couldn't fetch mysqli_result in %s on line %d
 NULL
+[E_RECOVERABLE_ERROR] Argument 3 passed to mysqli_fetch_object() must be of the type array, string given in %s on line %d
 Parameter ctor_params must be an array

 Fatal error: Class 'this_class_does_not_exist' not found in %s on line %d
\ No newline at end of file

Modified: php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_fetch_object_oo.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_fetch_object_oo.phpt	2011-07-25 14:38:26 UTC (rev 313672)
+++ php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_fetch_object_oo.phpt	2011-07-25 14:53:01 UTC (rev 313673)
@@ -9,6 +9,7 @@
 --FILE--
 <?php
 	require_once("connect.inc");
+	set_error_handler('handle_catchable_fatal');

 	$tmp    = NULL;
 	$link   = NULL;
@@ -110,21 +111,24 @@
 	require_once("clean_table.inc");
 ?>
 --EXPECTF--
-Warning: Missing argument 1 for mysqli_fetch_object_construct::__construct() in %s on line %d
-
-Warning: Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
-
-Notice: Undefined variable: a in %s on line %d
-
-Notice: Undefined variable: b in %s on line %d
-
-Warning: Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
-
-Notice: Undefined variable: b in %s on line %d
+[E_WARNING] mysqli_result::__construct(): invalid object or resource mysql%s
+%s on line %d
+[E_WARNING] mysqli_result::fetch_object(): Couldn't fetch mysqli_result in %s on line %d
+[E_WARNING] mysqli_result::fetch_object() expects parameter 1 to be string, object given in %s on line %d
+[E_RECOVERABLE_ERROR] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, object given in %s on line %d
+[E_WARNING] mysqli_result::fetch_object() expects parameter 1 to be string, object given in %s on line %d
+[E_RECOVERABLE_ERROR] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, object given in %s on line %d
+[E_WARNING] mysqli_result::fetch_object() expects at most 2 parameters, 3 given in %s on line %d
+[E_RECOVERABLE_ERROR] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, null given in %s on line %d
+[E_WARNING] Missing argument 1 for mysqli_fetch_object_construct::__construct() in %s on line %d
+[E_WARNING] Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
+[E_NOTICE] Undefined variable: a in %s on line %d
+[E_NOTICE] Undefined variable: b in %s on line %d
+[E_WARNING] Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
+[E_NOTICE] Undefined variable: b in %s on line %d
 NULL
 NULL
-
-Warning: mysqli_fetch_object(): Couldn't fetch mysqli_result in %s on line %d
+[E_WARNING] mysqli_fetch_object(): Couldn't fetch mysqli_result in %s on line %d
 NULL

 Fatal error: Class 'this_class_does_not_exist' not found in %s on line %d
\ No newline at end of file

Modified: php/php-src/trunk/ext/mysqli/tests/connect.inc
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/connect.inc	2011-07-25 14:38:26 UTC (rev 313672)
+++ php/php-src/trunk/ext/mysqli/tests/connect.inc	2011-07-25 14:53:01 UTC (rev 313673)
@@ -225,4 +225,20 @@
 	} else {
 		printf("skip Eeeek/BUG/FIXME - connect.inc included twice! skipif bug?\n");
 	}
-?>
\ No newline at end of file
+
+	function handle_catchable_fatal($errno, $error, $file, $line) {
+		static $errcodes = array();
+		if (empty($errcodes)) {
+			$constants = get_defined_constants();
+			foreach ($constants as $name => $value) {
+				if (substr($name, 0, 2) == "E_")
+					$errcodes[$value] = $name;
+			}
+		}
+		printf("[%s] %s in %s on line %s\n",
+			(isset($errcodes[$errno])) ? $errcodes[$errno] : $errno,
+			 $error, $file, $line);
+
+		return true;
+	}
+?>

Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_fetch_object.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/mysqli_fetch_object.phpt	2011-07-25 14:38:26 UTC (rev 313672)
+++ php/php-src/trunk/ext/mysqli/tests/mysqli_fetch_object.phpt	2011-07-25 14:53:01 UTC (rev 313673)
@@ -10,6 +10,8 @@
 <?php
 	include_once("connect.inc");

+	set_error_handler('handle_catchable_fatal');
+
 	$tmp    = NULL;
 	$link   = NULL;

@@ -57,7 +59,7 @@

 	}

-	$obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', null);
+	$obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array());

 	if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
 		printf("[006] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
@@ -97,7 +99,7 @@
 	Also, I did not ask to get exceptions using the mysqli_options()
 	*/
 	try {
-		if (false !== ($obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', 'a')))
+		if (false !== ($obj = @mysqli_fetch_object($res, 'mysqli_fetch_object_construct', 'a')))
 			printf("[011] Should have failed\n");
 	} catch (Exception $e) {
 		printf("%s\n", $e->getMessage());
@@ -136,22 +138,19 @@
 	require_once("clean_table.inc");
 ?>
 --EXPECTF--
-Warning: Missing argument 1 for mysqli_fetch_object_construct::__construct() in %s on line %d
-
-Warning: Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
-
-Notice: Undefined variable: a in %s on line %d
-
-Notice: Undefined variable: b in %s on line %d
-
-Warning: Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
-
-Notice: Undefined variable: b in %s on line %d
+[E_WARNING] mysqli_fetch_object() expects at least 1 parameter, 0 given in %s on line %d
+[E_WARNING] mysqli_fetch_object() expects parameter 1 to be mysqli_result, null given in %s on line %d
+[E_WARNING] Missing argument 1 for mysqli_fetch_object_construct::__construct() in %s on line %d
+[E_WARNING] Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
+[E_NOTICE] Undefined variable: a in %s on line %d
+[E_NOTICE] Undefined variable: b in %s on line %d
+[E_WARNING] Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
+[E_NOTICE] Undefined variable: b in %s on line %d
 NULL
 NULL
-
-Warning: mysqli_fetch_object(): Couldn't fetch mysqli_result in %s on line %d
+[E_WARNING] mysqli_fetch_object(): Couldn't fetch mysqli_result in %s on line %d
 NULL
+[E_RECOVERABLE_ERROR] Argument 3 passed to mysqli_fetch_object() must be of the type array, string given in %s on line %d
 Parameter ctor_params must be an array

 Fatal error: Class 'this_class_does_not_exist' not found in %s on line %d
\ No newline at end of file

Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_fetch_object_oo.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/mysqli_fetch_object_oo.phpt	2011-07-25 14:38:26 UTC (rev 313672)
+++ php/php-src/trunk/ext/mysqli/tests/mysqli_fetch_object_oo.phpt	2011-07-25 14:53:01 UTC (rev 313673)
@@ -9,6 +9,7 @@
 --FILE--
 <?php
 	require_once("connect.inc");
+	set_error_handler('handle_catchable_fatal');

 	$tmp    = NULL;
 	$link   = NULL;
@@ -110,21 +111,24 @@
 	require_once("clean_table.inc");
 ?>
 --EXPECTF--
-Warning: Missing argument 1 for mysqli_fetch_object_construct::__construct() in %s on line %d
-
-Warning: Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
-
-Notice: Undefined variable: a in %s on line %d
-
-Notice: Undefined variable: b in %s on line %d
-
-Warning: Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
-
-Notice: Undefined variable: b in %s on line %d
+[E_WARNING] mysqli_result::__construct(): invalid object or resource mysql%s
+%s on line %d
+[E_WARNING] mysqli_result::fetch_object(): Couldn't fetch mysqli_result in %s on line %d
+[E_WARNING] mysqli_result::fetch_object() expects parameter 1 to be string, object given in %s on line %d
+[E_RECOVERABLE_ERROR] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, object given in %s on line %d
+[E_WARNING] mysqli_result::fetch_object() expects parameter 1 to be string, object given in %s on line %d
+[E_RECOVERABLE_ERROR] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, object given in %s on line %d
+[E_WARNING] mysqli_result::fetch_object() expects at most 2 parameters, 3 given in %s on line %d
+[E_RECOVERABLE_ERROR] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, null given in %s on line %d
+[E_WARNING] Missing argument 1 for mysqli_fetch_object_construct::__construct() in %s on line %d
+[E_WARNING] Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
+[E_NOTICE] Undefined variable: a in %s on line %d
+[E_NOTICE] Undefined variable: b in %s on line %d
+[E_WARNING] Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d
+[E_NOTICE] Undefined variable: b in %s on line %d
 NULL
 NULL
-
-Warning: mysqli_fetch_object(): Couldn't fetch mysqli_result in %s on line %d
+[E_WARNING] mysqli_fetch_object(): Couldn't fetch mysqli_result in %s on line %d
 NULL

 Fatal error: Class 'this_class_does_not_exist' not found in %s on line %d
\ No newline at end of file
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to