Re: Re: PHP 4.0 Bug #4805 Updated: !1 could return 0 instead of false

From: Date: Sun, 04 Jun 2000 23:46:36 +0000
Subject: Re: Re: PHP 4.0 Bug #4805 Updated: !1 could return 0 instead of false
References: 1 2 3 4  Groups: php.dev 
Request: Send a blank email to php-dev+get-20217@lists.php.net to get a copy of this message
maybe the whole lot of problems wouldn't have happened if the boolean value wasn't introduced to php at all. having boolean in php makes php as a language less consistent in my opinion: 'echo true' prints 1, whereas 'echo false' doesn't print anything, 2 != true is 1/true in php3 but 0/false in php4 etc. i don't know but have all the cons and pros of having boolean in php language been considered? thanks for your time and answer, Zeev Suraski <zeev@zend.com> wrote: >It's true that it's an incompatibility, but it's not an incompatibility bug >(in other words, "it's not a bug, it's a feature"). > >PHP 4.0 introduced a new type, the boolean type. It's quite useful and >solves quite a few non intuitive issues that existed in PHP 3.0 (e.g., >2!=true). Since its introduction, all of the logical operators that return >a logical bool, were changed to actually return a value of type >boolean. Due to behavioral constraints, the printed notation of a boolean >false had to be an empty string, and together, this all causes the behavior >you're experiencing. > >Zeev > >At 17:55 04/06/2000, Michal Vitecek wrote: >>Bug Database <php-dev@lists.php.net> wrote: >> >ID: 4805 >> >Updated by: stas >> >Reported By: fuf@fuf.sh.cvut.cz >> >Status: Closed >> >Bug Type: Misbehaving function >> >Assigned To: >> >Comments: >> > >> >Wrong. ! is logical operation, and as such should return boolean. >> >1 is boolean true, so !1 will be boolean false. If you do not like this, >> submit feature request. >> > >> >> in my opinion, this _is_ a bug and more specifically a compatibility >> bug. if !<expression> returned 0 in php3.x the same should be gotten in >> php4.x. boolean as such in php is pretty much useless anyway and this >> change causes unnecessary problems when moving from php3 to php4 and is >> time consuming to fix (simply using sed is not enough). >> >> >Full Bug description available at: >> >http://bugs.php.net/version4/?id=4805 >> >>-- >> fuf >> >> >>------------------------------ na IRC ------------------------------------- >> BillGates [bgates@www.microsoft.com] has joined #LINUX >> ... >> mode/#linux [+b BillGates!*@*] by DoDad >> BillGates was kicked off #linux by DoDad (banned: We see enough of Bill >> Gates already.) >> >> >> >>-- >>PHP Development Mailing List <http://www.php.net/> >>To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net >>For additional commands, e-mail: php-dev-help@lists.php.net >>To contact the list administrators, e-mail: php-list-admin@lists.php.net > >-- >Zeev Suraski <zeev@zend.com> http://www.zend.com/ -- fuf ------------------------------ na IRC ------------------------------------- BillGates [bgates@www.microsoft.com] has joined #LINUX ... mode/#linux [+b BillGates!*@*] by DoDad BillGates was kicked off #linux by DoDad (banned: We see enough of Bill Gates already.)

« previous php.dev (#20217) next »