php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4805 !1 could return 0 instead of false
Submitted: 2000-06-04 17:30 UTC Modified: 2000-06-04 17:35 UTC
From: fuf at fuf dot sh dot cvut dot cz Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0.0 Release OS: linux-2.2.14pre16 + some patches
Private report: No CVE-ID: None
 [2000-06-04 17:30 UTC] fuf at fuf dot sh dot cvut dot cz
hello,

  !1 returns false now in php4.0 so it's not outputted in echo (echo "!1: " . (!1) . "\n"; ) whereas in php3.x !1 returned 0 and was displayed.
  i know this is not a bug, but it may render many scripts (including the ones i'm working on (~50.000 lines)) misbehave in certain conditions and definitely is a compatibility problem.
  _checking_ and changing !<some_expression> to (int)!<some_expression> would take *LOTS* of time, so IMO this behaviour should be changed or at least be configurable via some option.
  or the way echo outputs boolean could be changed. please, don't make php programmers go berserk :)

	thanks,
		Michal Vitecek

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-04 17:35 UTC] stas at cvs dot php dot net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 08:01:29 2024 UTC