Re: Re: PHP 4.0 Bug #4805 Updated: !1 could return 0 instead of false
| From: | Zeev Suraski | Date: | Sun, 04 Jun 2000 23:35:17 +0000 |
| Subject: | Re: Re: PHP 4.0 Bug #4805 Updated: !1 could return 0 instead of false | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-20212@lists.php.net to get a copy of this message | ||
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 ---- 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 BillGates 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