Re: Follow-up to STH user experience, this time with actual testing

From: Date: Fri, 27 Feb 2015 07:59:09 +0000
Subject: Re: Follow-up to STH user experience, this time with actual testing
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-83969@lists.php.net to get a copy of this message
Hey: On Fri, Feb 27, 2015 at 10:06 AM, François Laupretre <francois@php.net> wrote: >> De : Matthew Weier O'Phinney [mailto:matthew@zend.com] >> >> - PHPUnit passes a boolean false to debug_backtrace()... >> which is >> documented >> as expecting an integer! (There are actually several constant values it >> accepts, all of which are integer values.) In this case, PHPUnit is relying >> on the fact that the engine casts booleans to the integers 0 and 1. (Zeev has >> written to the list already indicating that this coercion path will be >> supported in the patch.) > > AFAIK, we won't support boolean to integer. IMO, considering Boolean as integer is a bug > and must not be supported. in a internal developer's view: bool false === 0, bool true == 1; maybe this case should be supported? considering such usage : if (substr($str, strrpos($str, ':delimiter:')) { } this is not a really world usage, I just made it up, this codes is try to find a last part of a string which is contacted with a dimileter ":delimiter": like a:delimiter:b, c:dilimiter:d it works well before, because, if there is no match, it returns false before.. (which we will think it's '0') then the whole $str is returned.. but if we don't support bool false -> 0? thanks > >> - PHPUnit is passing the results of $reflector->getDocComment() blindly to >> substr() and preg_match*(). getDocComment() is documented as returning >> EITHER >> a string OR boolean false. Again, PHPUnit is relying on PHP to cast boolean >> false to an empty string. (Zeev has also indicated this coercion path may be >> re-introduced.) > > The same as above for bool -> string. > > I hope you're wrong because I wouldn't like supporting boolean to scalar back again. > > Your test demonstrates this because you found undetected bugs. I am more and more sure that, > what I first said as a joke, will prove true : during the next years, STH will be used mostly as a > debugging tool, proving opposite arguments were FUD or, at least, phantasm. > > Regards > > François > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php -- Xinchen Hui @Laruence http://www.laruence.com/

« previous php.internals (#83969) next »