pollita         Mon Sep 25 01:37:55 2006 UTC

  Modified files:              
    /php-src/ext/standard       type.c 
  Log:
  Make settype($var, 'string'); behave like $var = (string)$var;
  e.g. switch between (binary) and (unicode) depending on UG(unicode)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.43&r2=1.44&diff_format=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.43 php-src/ext/standard/type.c:1.44
--- php-src/ext/standard/type.c:1.43    Sun Sep 24 18:23:47 2006
+++ php-src/ext/standard/type.c Mon Sep 25 01:37:55 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: type.c,v 1.43 2006/09/24 18:23:47 pollita Exp $ */
+/* $Id: type.c,v 1.44 2006/09/25 01:37:55 pollita Exp $ */
 
 #include "php.h"
 #include "php_incomplete_class.h"
@@ -113,9 +113,15 @@
                convert_to_double(*var);
        } else if (!strcasecmp(new_type, "double")) { /* deprecated */
                convert_to_double(*var);
-       } else if (!strcasecmp(new_type, "string")) {
+       } else if (!strcasecmp(new_type, "binary")) { /* explicit binary cast */
                convert_to_string(*var);
-       } else if (!strcasecmp(new_type, "unicode")) {
+       } else if (!strcasecmp(new_type, "string")) { /* runtime string type */
+               if (UG(unicode)) {
+                       convert_to_unicode(*var);
+               } else {
+                       convert_to_string(*var);
+               }
+       } else if (!strcasecmp(new_type, "unicode")) { /* explicit unicode cast 
*/
                convert_to_unicode(*var);
        } else if (!strcasecmp(new_type, "array")) {
                convert_to_array(*var);

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

Reply via email to