Mantis - Quercus
Viewing Issue Advanced Details
3254 minor always 01-14-09 12:59 01-14-09 14:51
koreth  
nam  
normal  
closed 4.0.0  
fixed  
none    
none 4.0.0  
0003254: Object __toString is not being called when object is passed to Java function
ToStringTest.java:

package test;
public class ToStringTest {
        public String test(String str) {
                return str;
        }
}

test.php:

<?php
import test.ToStringTest;

class Foo {
  public $var = 'abc';
  public function __toString() {
    return $this->var;
  }
}

$ts = new ToStringTest;
$x = new Foo;
print $ts->test($x);


This should output "abc" but it outputs "ObjectExtValue@8962932[Foo]".

__toString() does appear to be getting correctly called when objects are used as strings in PHP code.

Notes
(0003730)
nam   
01-14-09 14:51   
php/0c11
php/3c11