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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Wed May 29 09:01:33 2024 UTC