Ask a Question related to PHP Development, Design and Development.
-
iam at nimajneb dot com #1
#26122 [NEW]: Logical Operator "and" not functioning as expected
From: iam at nimajneb dot com
Operating system: Mac OSX 10.2.6
PHP version: 4.3.2
PHP Bug Type: Math related
Bug description: Logical Operator "and" not functioning as expected
Description:
------------
Result of 'and' operator not what is expected. 1 and 0 and 1 => 1? Should
be 0. See attached code sample. '&&' operator does function correctly
however.
Reproduce code:
---------------
$primary_err_valid = (($_POST['primary_err'] != "category") and
($_POST['primary_err'] != "separator"));
$secondary_err_valid = (($_POST['secondary_err'] != "category") and
($_POST['secondary_err'] != "separator"));
$tertiary_err_valid = (($_POST['tertiary_err'] != "category") and
($_POST['tertiary_err'] != "separator"));
$error_valid = ($primary_err_valid) and ($secondary_err_valid) and
($tertiary_err_valid);
echo "Pri: $primary_err_valid <br>";
echo "Sec: $secondary_err_valid <br>";
echo "Tri: $tertiary_err_valid <br>";
echo "Total Error: $error_valid <br>";
Expected result:
----------------
Pri: 1
Sec:
Tri: 1
Total Error:
Actual result:
--------------
Pri: 1
Sec:
Tri: 1
Total Error: 1
--
Edit bug report at [url]http://bugs.php.net/?id=26122&edit=1[/url]
--
Try a CVS snapshot (php4): [url]http://bugs.php.net/fix.php?id=26122&r=trysnapshot4[/url]
Try a CVS snapshot (php5): [url]http://bugs.php.net/fix.php?id=26122&r=trysnapshot5[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=26122&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=26122&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=26122&r=needtrace[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=26122&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=26122&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=26122&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=26122&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=26122&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=26122&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=26122&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=26122&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=26122&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=26122&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=26122&r=float[/url]
iam at nimajneb dot com Guest
-
#39588 [NEW]: unpack("a*", "abc\0") does not work as expected
From: pprasse at actindo dot de Operating system: linux 2.6.10 PHP version: 4.4.4 PHP Bug Type: Scripting Engine problem Bug... -
"Acrobat PDF file format is having difficulties expected a non-negative integer"
Posted this in a wrong folder before. Opening many of my AI 10 docs in AI CS is getting me this error message: "Acrobat PDF file format is having... -
"Expected a dict object" with Acrobat Prof 6.0 = lock up
Trying to view a PDF from a website (www.skidmorednagenealogy.com)(PDF entitled "Family Genetics Project") Using Adobe Acrobat Professional 6.0... -
"wrong argument type nil (expected String)" from Dir.chdir
I'm running Ruby 1.6.8. Can anybody tell me why this line: Dir.chdir("/") results in the error "wrong argument type nil (expected String)"... -
#26122 [Opn->Bgs]: Logical Operator "and" not functioning as expected
ID: 26122 Updated by: iliaa@php.net Reported By: iam at nimajneb dot com -Status: Open +Status: ...



Reply With Quote

