php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #921 funcs not returning false in assignment context
Submitted: 1998-11-15 10:21 UTC Modified: 1998-11-15 10:56 UTC
From: david at uws dot edu dot au Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.5 OS: Solaris 2.5.1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: david at uws dot edu dot au
New email:
PHP Version: OS:

 

 [1998-11-15 10:21 UTC] david at uws dot edu dot au
If $doterms is previously set using a logic expression
($doterms = (x and y and z and ...)) it should contain the
integer equivalent of boolean TRUE or FALSE - so far so good.

In an assignment context:

  $doterms = $doterms and ereg(...) and eregi(...);

$doterms should only be set to the integer equivalent of
boolean TRUE iff all three expressions are considered to
be "TRUE" - alas, however, it appears to *always* be set
to true, regardless of the ereg/eregi pattern matches.

A conditional context does, however work:

  if( $doterms and ereg(...) and eregi(...) )
    $doterms = 1;
  else
    $doterms = 0;

This will correctly set $doterms to zero (FALSE) should one
of the RE pattern matches fail.

Surely this is inconsistent (boolean/logic) behaviour (and
probably affects other/all functions)?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-11-15 10:56 UTC] rasmus
Use && instead of 'and'.  'and' is a low-priority operator.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 15:01:33 2025 UTC