summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2013-01-29 19:49:13 +0100
committerJohannes Schlüter <johannes@php.net>2013-01-29 19:49:13 +0100
commitec53b60072799704a0d94cdd935bdf54bd5e5344 (patch)
treee59c83f258341a21a85522dd9b7b6ae7b73ccdae /ext
parent93fd9c704b9aae141008274e9f3bd2775116a83a (diff)
parent38bf6951b3615775cc91955ca71c07ecbf50120f (diff)
downloadphp-git-ec53b60072799704a0d94cdd935bdf54bd5e5344.tar.gz
Merge branch 'PHP-5.3' of git.php.net:/php-src into PHP-5.3
Diffstat (limited to 'ext')
-rw-r--r--ext/spl/spl_directory.c4
-rw-r--r--ext/spl/tests/bug64023.phpt20
2 files changed, 24 insertions, 0 deletions
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 0638836920..1b6a0e9b7b 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -1873,6 +1873,10 @@ static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type TS
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(readobj TSRMLS_CC);
if (type == IS_STRING) {
+ if (Z_OBJCE_P(readobj)->__tostring) {
+ return std_object_handlers.cast_object(readobj, writeobj, type TSRMLS_CC);
+ }
+
switch (intern->type) {
case SPL_FS_INFO:
case SPL_FS_FILE:
diff --git a/ext/spl/tests/bug64023.phpt b/ext/spl/tests/bug64023.phpt
new file mode 100644
index 0000000000..2c177f9512
--- /dev/null
+++ b/ext/spl/tests/bug64023.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #64023: Overloading __toString() in SplFileInfo has no effect
+--FILE--
+<?php
+class A extends \SplFileInfo
+{
+ public function __toString() {return ' -expected- ';}
+}
+
+$a = new A('/');
+
+// Works
+echo $a, $a->__toString(), $a->__toString() . '', "\n";
+
+// Does not work - outputs parent::__toString()
+echo $a . '', "\n";
+
+--EXPECT--
+ -expected- -expected- -expected-
+ -expected-