php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #65457 Example on Bitwise Operators page: XOR is not same as AND NOT
Submitted: 2013-08-16 05:51 UTC Modified: 2013-08-19 05:49 UTC
From: david at beroff dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
 [2013-08-16 05:51 UTC] david at beroff dot com
Description:
------------
On http://php.net/manual/en/language.operators.bitwise.php ,
there is an example which states, "Another way to accomplish...
[E_ALL & ~E_NOTICE] ...is [by] using XOR...".

While this yields the same result in THIS particular example,
(because all of the relevant bits of E_ALL are set), it could 
have the undesired effect of incorrectly leading people to 
assume that this shortcut can/should be used in all cases.
In a case where the first value had a cleared bit in the 
desired location, use of XOR would actually turn it on, 
rather than having the intended effect of turning it off.

There is actually a comment (#98979) left by steffen at 
NO-SPAM dot haugk dot co dot uk to the same effect, but 
apparently no action had been taken in the three years
since it was written.

I respectfully ask you to please simply remove the example.
Thank you.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-08-19 05:21 UTC] krakjoe@php.net
-Status: Open +Status: Not a bug
 [2013-08-19 05:21 UTC] krakjoe@php.net
It is not the job of the PHP manual to educate the reader on bitwise comparisons, 
it is the job of the manual to educate the reader on bitwise comparisons _in 
PHP_.

There is no good reason to remove the example, why it works is explained well.
 [2013-08-19 05:49 UTC] david at beroff dot com
I do completely agree with your first sentence.

Would you please then at least consider changing the words,
   "Another way to accomplish that is using",
to simply,
   "One can use"?

This would then meet your requirements, as well as addressing
mine, by removing the suggestion that the act is equivalent.

Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 05:01:30 2024 UTC