php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7949 Bad comparsion of variables
Submitted: 2000-11-23 10:08 UTC Modified: 2000-11-23 10:13 UTC
From: profix at volny dot cz Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.3pl1 OS: Windows 98
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: profix at volny dot cz
New email:
PHP Version: OS:

 

 [2000-11-23 10:08 UTC] profix at volny dot cz
<?

// bug report from profix@volny.cz
// int(0) = string (2) "dd" ? I thing that no...

$testint=0;
$teststr="dd";

// control vardump

var_dump($testint);
echo "<br>";
var_dump($teststr);
echo "<br>";

if ($testint==$teststr) echo "FUCK !!!";         /// this print fuck

//  so if I use

if (strval($testint)==$teststr) echo "FUCK !!!"; /// this dont print fuck

// Why there is no auto convertion into the same type of compared variables?

// Well, if $testint is anything else (but integer-type except 0),it is working fine,
// but with zero it does not want to work properly.

// Example

$testint=1;
$teststr="dd";

// control vardump

var_dump($testint);
echo "<br>";
var_dump($teststr);
echo "<br>";

if ($testint==$teststr) echo "FUCK !!!";         /// this dont print fuck

/*  My php info    - 192.168.0.98 id my localhost - WPN

PHP Version 4.0.3pl1

System Windows 95/98 4.10         // it is Czech language version of Windows 98
Build Date Oct 15 2000
Server API CGI
Virtual Directory Support enabled
Configuration File (php.ini) Path php.ini
ZEND_DEBUG disabled
Thread Safety enabled

 This program makes use of the Zend scripting language engine:
Zend Engine v1.0.3, Copyright (c) 1998-2000 Zend Technologies




--------------------------------------------------------------------------------

PHP 4.0 Credits

--------------------------------------------------------------------------------

Configuration
PHP Core
Directive Local Value Master Value
allow_call_time_pass_reference
 On On
arg_separator
 & &
asp_tags
 Off Off
auto_append_file
 no value no value
auto_prepend_file
 no value no value
browscap
 no value no value
default_charset
 no value no value
default_mimetype
 text/html text/html
define_syslog_variables
 Off Off
disable_functions
 no value no value
display_errors
 On On
display_startup_errors
 Off Off
doc_root
 no value no value
enable_dl
 On On
error_append_string
 Off Off
error_log
 no value no value
error_prepend_string
 Off Off
error_reporting
 no value no value
expose_php
 On On
extension_dir
 no value no value
file_uploads
 1 1
gpc_order
 GPC GPC
highlight.bg
 #FFFFFF #FFFFFF
highlight.comment
 #FF8000 #FF8000
highlight.default
 #0000BB #0000BB
highlight.html
 #000000 #000000
highlight.keyword
 #007700 #007700
highlight.string
 #DD0000 #DD0000
html_errors
 On On
ignore_user_abort
 Off Off
implicit_flush
 Off Off
include_path
 no value no value
log_errors
 Off Off
magic_quotes_gpc
 On On
magic_quotes_runtime
 Off Off
magic_quotes_sybase
 Off Off
max_execution_time
 30 30
open_basedir
 no value no value
output_buffering
 Off Off
post_max_size
 8M 8M
precision
 14 14
register_argc_argv
 On On
register_globals
 On On
safe_mode
 Off Off
safe_mode_exec_dir
 1 1
sendmail_from
 no value no value
sendmail_path
 no value no value
short_open_tag
 On On
SMTP
 localhost localhost
sql.safe_mode
 Off Off
track_errors
 Off Off
upload_max_filesize
 2M 2M
upload_tmp_dir
 no value no value
user_dir
 no value no value
variables_order
 no value no value
y2k_compliance
 Off Off


standard
Regex Library Bundled library enabled
Dynamic Library Support enabled
Internal Sendmail Support for Windows 4 enabled

Directive Local Value Master Value
assert.active
 1 1
assert.bail
 0 0
assert.callback
 no value no value
assert.quiet_eval
 0 0
assert.warning
 1 1
safe_mode_allowed_env_vars
 PHP_ PHP_
safe_mode_protected_env_vars
 LD_LIBRARY_PATH LD_LIBRARY_PATH
session.use_trans_sid
 1 1


bcmath
BCMath support enabled


Calendar
Calendar support enabled


com
Directive Local Value Master Value
allow_dcom
 Off Off
typelib_file
 no value no value


ftp
FTP support enabled


mysql
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 3.23.10-alpha

Directive Local Value Master Value
mysql.allow_persistent
 On On
mysql.default_host
 no value no value
mysql.default_password
 no value no value
mysql.default_port
 no value no value
mysql.default_socket
 no value no value
mysql.default_user
 no value no value
mysql.max_links
 Unlimited Unlimited
mysql.max_persistent
 Unlimited Unlimited


odbc
ODBC Support enabled
Active Persistent Links 0
Active Links 0
ODBC library Win32

Directive Local Value Master Value
odbc.allow_persistent
 On On
odbc.check_persistent
 On On
odbc.default_db
 no value no value
odbc.default_pw

odbc.default_user
 no value no value
odbc.defaultbinmode
 return as is return as is
odbc.defaultlrl
 return up to 4096 bytes return up to 4096 bytes
odbc.max_links
 Unlimited Unlimited
odbc.max_persistent
 Unlimited Unlimited


pcre
PCRE (Perl Compatible Regular Expressions) Support enabled
PCRE Library Version 3.1 09-Feb-2000


session
Session Support enabled

Directive Local Value Master Value
session.auto_start
 Off Off
session.cache_expire
 180 180
session.cache_limiter
 nocache nocache
session.cookie_domain
 no value no value
session.cookie_lifetime
 0 0
session.cookie_path
 / /
session.entropy_file
 no value no value
session.entropy_length
 0 0
session.gc_maxlifetime
 1440 1440
session.gc_probability
 1 1
session.name
 PHPSESSID PHPSESSID
session.referer_check
 no value no value
session.save_handler
 files files
session.save_path
 /tmp /tmp
session.serialize_handler
 php php
session.use_cookies
 On On


xml
XML Support active


wddx
WDDX Support enabled


Additional Modules


Environment
Variable Value
COMSPEC C:\WINDOWS\COMMAND.COM
DOCUMENT_ROOT c:/program files/apache group/apache/htdocs
HTTP_ACCEPT image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, * / *
HTTP_ACCEPT_ENCODING gzip, deflate
HTTP_ACCEPT_LANGUAGE cs
HTTP_CONNECTION Keep-Alive
HTTP_HOST 192.168.0.98
HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; MSNATLAS01.CZ)
PATH C:\NOVELL\CLIENT32;C:\WINDOWS;C:\WINDOWS\COMMAND
REDIRECT_STATUS 200
REDIRECT_URL /info.php
REMOTE_ADDR 192.168.0.98
REMOTE_PORT 1498
SCRIPT_FILENAME c:/php3/php.exe
SERVER_ADDR 192.168.0.98
SERVER_ADMIN you@your.address
SERVER_NAME 192.168.0.98
SERVER_PORT 80
SERVER_SIGNATURE Apache/1.3.14 Server at 192.168.0.98 Port 80
SERVER_SOFTWARE Apache/1.3.14 (Win32)
WINDIR C:\WINDOWS
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.1
REQUEST_METHOD GET
QUERY_STRING
REQUEST_URI /info.php
SCRIPT_NAME /php/php.exe
PATH_INFO /info.php
PATH_TRANSLATED c:\program files\apache group\apache\htdocs\info.php


PHP Variables
Variable Value
PHP_SELF /php/php.exe/info.php
HTTP_SERVER_VARS["PHP_SELF"] /php/php.exe/info.php
HTTP_SERVER_VARS["argv"] Array
(
)


HTTP_SERVER_VARS["argc"] 0
HTTP_ENV_VARS["COMSPEC"] C:\\WINDOWS\\COMMAND.COM
HTTP_ENV_VARS["DOCUMENT_ROOT"] c:/program files/apache group/apache/htdocs
HTTP_ENV_VARS["HTTP_ACCEPT"] image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, * / *
HTTP_ENV_VARS["HTTP_ACCEPT_ENCODING"] gzip, deflate
HTTP_ENV_VARS["HTTP_ACCEPT_LANGUAGE"] cs
HTTP_ENV_VARS["HTTP_CONNECTION"] Keep-Alive
HTTP_ENV_VARS["HTTP_HOST"] 192.168.0.98
HTTP_ENV_VARS["HTTP_USER_AGENT"] Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; MSNATLAS01.CZ)
HTTP_ENV_VARS["PATH"] C:\\NOVELL\\CLIENT32;C:\\WINDOWS;C:\\WINDOWS\\COMMAND
HTTP_ENV_VARS["REDIRECT_STATUS"] 200
HTTP_ENV_VARS["REDIRECT_URL"] /info.php
HTTP_ENV_VARS["REMOTE_ADDR"] 192.168.0.98
HTTP_ENV_VARS["REMOTE_PORT"] 1498
HTTP_ENV_VARS["SCRIPT_FILENAME"] c:/php3/php.exe
HTTP_ENV_VARS["SERVER_ADDR"] 192.168.0.98
HTTP_ENV_VARS["SERVER_ADMIN"] you@your.address
HTTP_ENV_VARS["SERVER_NAME"] 192.168.0.98
HTTP_ENV_VARS["SERVER_PORT"] 80
HTTP_ENV_VARS["SERVER_SIGNATURE"] Apache/1.3.14 Server at 192.168.0.98 Port 80
HTTP_ENV_VARS["SERVER_SOFTWARE"] Apache/1.3.14 (Win32)
HTTP_ENV_VARS["WINDIR"] C:\\WINDOWS
HTTP_ENV_VARS["GATEWAY_INTERFACE"] CGI/1.1
HTTP_ENV_VARS["SERVER_PROTOCOL"] HTTP/1.1
HTTP_ENV_VARS["REQUEST_METHOD"] GET
HTTP_ENV_VARS["QUERY_STRING"]
HTTP_ENV_VARS["REQUEST_URI"] /info.php
HTTP_ENV_VARS["SCRIPT_NAME"] /php/php.exe
HTTP_ENV_VARS["PATH_INFO"] /info.php
HTTP_ENV_VARS["PATH_TRANSLATED"] c:\\program files\\apache group\\apache\\htdocs\\info.php


PHP License
This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file: LICENSE

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact license@php.net.



*/

?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-23 10:13 UTC] stas@php.net
use === for literal compare. == is numerical compare, and
"dd" converts to numerical 0.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sun Oct 11 08:00:01 2026 UTC