For Programmers: Free Programming Magazines  


Home > Archive > PHP Zend Engine > October 2005 > Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 /tests bug26166.phpt









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 /tests bug26166.phpt
Marcus Boerger

2005-10-06, 6:55 pm

Hello internals,

that should read 'unix' not 'uncode', tooooo much unicode changes going on
:-)

Thursday, October 6, 2005, 8:52:53 PM, you wrote:

> helly Thu Oct 6 14:52:53 2005 EDT


> Modified files:
> /ZendEngine2/tests bug26166.phpt
> Log:
> - Fix test
> - Convert to unicode
>
>
> http://cvs.php.net/diff.php/ZendEng...1.3&r2=1.4&ty=u
> Index: ZendEngine2/tests/bug26166.phpt
> diff -u ZendEngine2/tests/bug26166.phpt:1.3 ZendEngine2/tests/bug26166.phpt:1.4
> --- ZendEngine2/tests/bug26166.phpt:1.3 Tue Sep 27 03:59:01 2005
> +++ ZendEngine2/tests/bug26166.phpt Thu Oct 6 14:52:51 2005
> @@ -1,67 +1,74 @@
> ---TEST--
> -Bug #26166 (__toString() crash when no values returned)
> ---FILE--
> -<?php
> -class Foo
> -{
> - function __toString()
> - {
> - return "Hello World!\n";
> - }
> -}
> -
> -class Bar
> -{
> - private $obj;
> -
> - function __construct()
> - {
> - $this->obj = new Foo();
> - }
> -
> - function __toString()
> - {
> - return $this->obj->__toString();
> - }
> -}
> -
> -$o = new Bar;
> -echo $o;
> -
> -echo "===THROW===\n";
> -
> -class Error
> -{
> - function __toString() {
> - throw new Exception("This is an error!");
> - }
> -}
> -
> -$o = new Error;
> -try {
> - echo $o;
> -}
> -catch (Exception $e) {
> - echo "Got the exception\n";
> -}
> -
> -echo "===NONE===\n";
> -
> -class None
> -{
> - function __toString() {
> - }
> -}
> -
> -$o = new None;
> -echo $o;
> -

-?>>
> -===DONE===
> ---EXPECTF--
> -Hello World!
> -===THROW===
> -Got the exception
> -===NONE===
> -
> -Catchable fatal error: Method None::__toString() must return a string value in %sbug26166.php on line %d
> +--TEST--
> +Bug #26166 (__toString() crash when no values returned)
> +--FILE--
> +<?php
> +
> +class Foo
> +{
> + function __toString()
> + {
> + return "Hello World!\n";
> + }
> +}
> +
> +class Bar
> +{
> + private $obj;
> +
> + function __construct()
> + {
> + $this->obj = new Foo();
> + }
> +
> + function __toString()
> + {
> + return $this->obj->__toString();
> + }
> +}
> +
> +$o = new Bar;
> +echo $o;
> +
> +echo "===NONE===\n";
> +
> +function my_error_handler($errno, $errstr, $errfile, $errline) {
> + var_dump($errstr);
> +}
> +
> +set_error_handler('my_error_handler');
> +
> +class None
> +{
> + function __toString() {
> + }
> +}
> +
> +$o = new None;
> +echo $o;
> +
> +echo "===THROW===\n";
> +
> +class Error
> +{
> + function __toString() {
> + throw new Exception("This is an error!");
> + }
> +}
> +
> +$o = new Error;
> +try {
> + echo $o;
> +}
> +catch (Exception $e) {
> + echo "Got the exception\n";
> +}
> +

+?>>
> +===DONE===
> +--EXPECTF--
> +Hello World!
> +===NONE===
> +string(52) "Method None::__toString() must return a string value"
> +===THROW===
> +
> +Fatal error: Object of class Error could not be converted to string in %sbug26166.php on line %d





Best regards,
Marcus
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com