[PHP-DEV] CVS update: php3 From: zeev (php-dev <email protected>)
Date: 05/29/98

Date: Friday May 29, 1998 @ 18:16
Author: zeev

Update of /repository/php3
In directory asf:/tmp/cvs-serv16830

Modified Files:
        ChangeLog variables.c
Log Message:
Fix empty($a) where $a == "0"

Index: php3/ChangeLog
diff -c php3/ChangeLog:1.356 php3/ChangeLog:1.357
*** php3/ChangeLog:1.356 Fri May 29 17:53:09 1998
--- php3/ChangeLog Fri May 29 18:16:08 1998
***************
*** 1,6 ****
--- 1,7 ----
  PHP 3.0 CHANGE LOG ChangeLog
  |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  May ?? Version 3.0
+ - empty("0") was returning true - fixed
  - Removed the old sybsql module. Use the new sybase_*() functions instead.
  - Several fixes to the configuration file parser
  - LDAP fixes - fixed return values on several functions
Index: php3/variables.c
diff -c php3/variables.c:1.140 php3/variables.c:1.141
*** php3/variables.c:1.140 Fri May 22 15:18:22 1998
--- php3/variables.c Fri May 29 18:16:09 1998
***************
*** 29,35 ****
   */
  
  
! /* $Id: variables.c,v 1.140 1998/05/22 19:18:22 shane Exp $ */
  
  #ifdef THREAD_SAFE
  #include "tls.h"
--- 29,35 ----
   */
  
  
! /* $Id: variables.c,v 1.141 1998/05/29 22:16:09 zeev Exp $ */
  
  #ifdef THREAD_SAFE
  #include "tls.h"
***************
*** 472,480 ****
                  if (result->value.lval) { /* variable is set */
                          pval var = *((pval *) var_ptr->value.varptr.yystype);
                          
! yystype_copy_constructor(&var);
! if (yystype_true(&var)) {
                                  result->value.lval=0;
                          }
                  } else { /* variable is not set */
                          result->value.lval = 1;
--- 472,485 ----
                  if (result->value.lval) { /* variable is set */
                          pval var = *((pval *) var_ptr->value.varptr.yystype);
                          
! if ((var.type == IS_STRING) && (var.value.str.len == 1) && (var.value.str.val[0] == '0')) {
! /* don't consider "0" as empty */
                                  result->value.lval=0;
+ } else {
+ yystype_copy_constructor(&var);
+ if (yystype_true(&var)) {
+ result->value.lval=0;
+ }
                          }
                  } else { /* variable is not set */
                          result->value.lval = 1;