cvs: php-src /ext/standard type.c
| From: | Sara Golemon | Date: | Mon, 25 Sep 2006 01:37:55 +0000 |
| Subject: | cvs: php-src /ext/standard type.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-40690@lists.php.net to get a copy of this message | ||
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);