Bug #16842 Updated: header() function doesn`t work

From: Date: Sun, 09 Jun 2002 14:40:14 +0000
Subject: Bug #16842 Updated: header() function doesn`t work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-9931@lists.php.net to get a copy of this message
 ID:               16842
 Updated by:       sabedard@jig.to
 Reported By:      sanya@mail.ru
 Status:           Open
 Bug Type:         HTTP related
 Operating System: Windows XP
 PHP Version:      4.2.0
 New Comment:

I am experiencing the same problem with 4.2.1 on Win2000.  The
following code works fine with 4.1.2 but does not redirect in 4.2.1.  

...

if (isset($HTTP_POST_VARS["submit_login"])) {

	$tbp = new Users();
	$tbp->retrieveDb( "where user_id = '" .$HTTP_POST_VARS["fuser_id"].
"'
and password='" .$HTTP_POST_VARS["fpassword"]. "'" );
	$uid = $tbp->getField("user_id");
	if (!$uid) { 
		$login_success = false;
	} else {
		$path = str_replace ("reg_login","reg_type",$PHP_SELF);
		$tbp->log("Directing to Location: http://" .$SERVER_NAME.
$path);
		header ("Location: http://" .$SERVER_NAME. $path); 
	}

}
.... 

Looking at my log the Location path is correct.  I have even tried
surrounding this code by ob_start() and ob_end_flush() with no luck.  
There is a reference in the header documnentation page indecating that
referencing all variable with a @ will fix this problem.  But that just
seems wrong.  Any workaround would be greatly appreciated.


Previous Comments:
------------------------------------------------------------------------

[2002-06-08 04:47:49] mfischer@php.net

Reopen

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

[2002-06-08 04:13:56] cg@gordimer.net

not the bug report is bogus - only the last user's comment.

Please reopen.

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

[2002-06-08 04:08:36] derick@php.net

User error > bogus

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

[2002-06-07 14:38:06] m@burkmat.nu

Apparently phpinfo() and phpversion() reads from php4ts.dll, which
still was version 4.1.1 on my dev-machine. I simply replaced php4ts.dll
(in \WINNT\system32) with the one that came in the php-4.2.1-Win32
distribution and header() now works flawless :)

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

[2002-06-07 14:10:27] m@burkmat.nu

When I upgraded from 4.1.1 to 4.2.1 I got this problem too. I've gone
through all of php.ini, comparing the values of 4.1.1 with those of
4.2.1. After some modifications (and apache/php restart), header()
still does not work. Even though the values in php.ini are the same.

The weird thing is that Apache says it's running PHP/4.2.1 (as
currently installed) but phpinfo() and phpversion() both say it's still
4.1.1. Even weirder is that "php -v" and "php -i" both says 4.2.1.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/16842

-- 
Edit this bug report at http://bugs.php.net/?id=16842&edit=1



Thread (25 messages)

« previous php.bugs (#9931) next »