cvs: ZendEngine2(PHP_5_3) / zend_closures.c /tests closure_015.phpt

"Dmitry Stogov" <[email protected]>
Newsgroups gmane.comp.php.cvs.zend
Message-ID <cvsdmitry1217488233@cvsserver>
dmitry		Thu Jul 31 07:10:33 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /ZendEngine2	zend_closures.c 
    /ZendEngine2/tests	closure_015.phpt 
  Log:
  Removed Closure::__toString()
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_closures.c?r1=1.3.2.8&r2=1.3.2.9&diff_format=u
Index: ZendEngine2/zend_closures.c
diff -u ZendEngine2/zend_closures.c:1.3.2.8 ZendEngine2/zend_closures.c:1.3.2.9
--- ZendEngine2/zend_closures.c:1.3.2.8	Sat Jul 26 14:15:19 2008
+++ ZendEngine2/zend_closures.c	Thu Jul 31 07:10:33 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_closures.c,v 1.3.2.8 2008/07/26 14:15:19 dmitry Exp $ */
+/* $Id: zend_closures.c,v 1.3.2.9 2008/07/31 07:10:33 dmitry Exp $ */
 
 #include "zend.h"
 #include "zend_API.h"
@@ -85,26 +85,6 @@
 }
 /* }}} */
 
-static int zend_closure_cast_object_tostring(zval *readobj, zval *writeobj, int type TSRMLS_DC) /* {{{ */
-{
-	zend_class_entry *ce;
-
-	switch (type) {
-		case IS_STRING:
-			INIT_PZVAL(writeobj);
-			ZVAL_STRINGL(writeobj, ZEND_CLOSURE_PRINT_NAME, sizeof(ZEND_CLOSURE_PRINT_NAME)-1, 1);
-			return SUCCESS;
-		default:
-			ce = Z_OBJCE_P(readobj);
-			zend_error(E_NOTICE, "Object of class %s could not be converted to %s", ce->name, zend_get_type_by_const(type));
-			INIT_PZVAL(writeobj);
-			Z_TYPE_P(writeobj) = IS_NULL;
-			break;
-	}
-	return FAILURE;
-}
-/* }}} */
-
 static zend_function *zend_closure_get_method(zval **object_ptr, char *method_name, int method_len TSRMLS_DC) /* {{{ */
 {
 	char *lc_name;
@@ -226,7 +206,6 @@
 	closure_handlers.has_property = zend_closure_has_property;
 	closure_handlers.unset_property = zend_closure_unset_property;
 	closure_handlers.compare_objects = zend_closure_compare_objects;
-	closure_handlers.cast_object = zend_closure_cast_object_tostring;
 	closure_handlers.clone_obj = NULL;
 }
 /* }}} */
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/closure_015.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: ZendEngine2/tests/closure_015.phpt
diff -u ZendEngine2/tests/closure_015.phpt:1.1.2.2 ZendEngine2/tests/closure_015.phpt:1.1.2.3
--- ZendEngine2/tests/closure_015.phpt:1.1.2.2	Mon Jul 14 09:49:02 2008
+++ ZendEngine2/tests/closure_015.phpt	Thu Jul 31 07:10:33 2008
@@ -2,12 +2,18 @@
 Closure 015: converting to string/unicode
 --FILE--
 <?php
+set_error_handler('myErrorHandler', E_RECOVERABLE_ERROR);
+function myErrorHandler($errno, $errstr, $errfile, $errline) {
+  echo "Error: $errstr at $errfile($errline)\n";
+  return true;
+}
 $x = function() { return 1; };
 print (string) $x;
 print "\n";
 print $x;
 print "\n";
 ?>
---EXPECT--
-Closure object
-Closure object
+--EXPECTF--
+Error: Object of class Closure could not be converted to string at %sclosure_015.php(8)
+
+Error: Object of class Closure could not be converted to string at %sclosure_015.php(10)



-- 
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.