From: [EMAIL PROTECTED]
Operating system: linux
PHP version: 4.3.0-pre1
PHP Bug Type: MySQL related
Bug description: Really hard to explain why this is a bug, it just is. And i will
prove it
What im trying to do, is check to see if the person is new to signing up,
but the way i did it made me think its a bug.
Think about it like this
would this work, (yes)
<?
$new = 1;
if ($new = 1)
echo "it worked";
?>
Ok, so you know that works, and i know that works, but what about this.
picture a login form
<form method=post action=login_go.php>
<input type=test name=username>
<input type=submit>
</form>
You enter your username, and push submit, now you are in login_go.php with
the value carryed by your username
You write
<?
$link = mysql_connect("localhost", "dbuser", "dbpass")
or die("Could not connect");
$get = mysql_select_db("dbname",$link)
or die("Could not select Database");
$user = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE
username='$username';")); //$username from the form
if ($user[new] == "1") // say there was a feild in the table users called
new
{echo "worked";}
?>
That would not work?, why its so right, theres nothing wrong with that
code, but!, now if u add a w to new in the database feild, and add a w to
user[new] it will work.
I have figure out how to get around it by simply added another w, or just
changing the word new all together. Is new a functions of some type, or
is it a bug when you use it like that. It really doesnt make sense to me,
and the people who ive ask about this.
I hope you can give me a anwser to this question, cause i am very curious,
and so are my friends.
--
Edit bug report at http://bugs.php.net/?id=19950&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=19950&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=19950&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=19950&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=19950&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=19950&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19950&r=support
Expected behavior: http://bugs.php.net/fix.php?id=19950&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=19950&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=19950&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=19950&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=19950&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=19950&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=19950&r=isapi