cvs: ZendEngine2 / zend_closures.c /tests closure_015.phpt

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

  Modified files:              
    /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.9&r2=1.10&diff_format=u
Index: ZendEngine2/zend_closures.c
diff -u ZendEngine2/zend_closures.c:1.9 ZendEngine2/zend_closures.c:1.10
--- ZendEngine2/zend_closures.c:1.9	Sat Jul 26 14:15:44 2008
+++ ZendEngine2/zend_closures.c	Thu Jul 31 07:10:42 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_closures.c,v 1.9 2008/07/26 14:15:44 dmitry Exp $ */
+/* $Id: zend_closures.c,v 1.10 2008/07/31 07:10:42 dmitry Exp $ */
 
 #include "zend.h"
 #include "zend_API.h"
@@ -85,30 +85,6 @@
 }
 /* }}} */
 
-static int zend_closure_cast_object_tostring(zval *readobj, zval *writeobj, int type, void *extra 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;
-		case IS_UNICODE:
-			INIT_PZVAL(writeobj);
-			ZVAL_UNICODEL(writeobj, USTR_MAKE(ZEND_CLOSURE_PRINT_NAME), sizeof(ZEND_CLOSURE_PRINT_NAME)-1, 0);
-			return SUCCESS;
-		default:
-			ce = Z_OBJCE_P(readobj);
-			zend_error(E_NOTICE, "Object of class %v 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, zstr method_name, int method_len TSRMLS_DC) /* {{{ */
 {
 	unsigned int lc_name_len;
@@ -235,7 +211,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&r2=1.2&diff_format=u
Index: ZendEngine2/tests/closure_015.phpt
diff -u ZendEngine2/tests/closure_015.phpt:1.1 ZendEngine2/tests/closure_015.phpt:1.2
--- ZendEngine2/tests/closure_015.phpt:1.1	Thu Jul 10 07:55:48 2008
+++ ZendEngine2/tests/closure_015.phpt	Thu Jul 31 07:10:43 2008
@@ -2,6 +2,11 @@
 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";
@@ -10,7 +15,9 @@
 print $x;
 print "\n";
 ?>
---EXPECT--
-Closure object
-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)
+
+Error: Object of class Closure could not be converted to string at %sclosure_015.php(12)



-- 
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.