summaryrefslogtreecommitdiffstats
path: root/php_common_handlers.c
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-07-28 10:38:20 +0200
committerRemi Collet <fedora@famillecollet.com>2016-07-28 10:38:20 +0200
commit0264677c23fb5e1c9fdfc38da6bcfdf033ed0f9d (patch)
treeab9e62e9fe00705f1f30b303f36a743c7600cb38 /php_common_handlers.c
php-pecl-fs: 1.0.0 (devel, new package)
Diffstat (limited to 'php_common_handlers.c')
-rw-r--r--php_common_handlers.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/php_common_handlers.c b/php_common_handlers.c
new file mode 100644
index 0000000..73e5006
--- /dev/null
+++ b/php_common_handlers.c
@@ -0,0 +1,21 @@
+#include "php_common_handlers.h"
+#include "zend_smart_str.h"
+
+int ds_default_cast_object(zval *obj, zval *return_value, int type)
+{
+ switch (type) {
+ case IS_STRING: {
+ smart_str buffer = {0};
+
+ smart_str_appendl(&buffer, "object(", 7);
+ smart_str_append (&buffer, Z_OBJCE_P(obj)->name);
+ smart_str_appendc(&buffer, ')');
+
+ smart_str_0(&buffer);
+ ZVAL_STR(return_value, buffer.s);
+ return SUCCESS;
+ }
+ }
+
+ return FAILURE;
+}