#21312 [NEW]: session_register doesnt like null values
| From: | charlesk at netgaintechnology dot com | Date: | Tue, 31 Dec 2002 14:59:20 +0000 |
| Subject: | #21312 [NEW]: session_register doesnt like null values | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-28847@lists.php.net to get a copy of this message | ||
From: charlesk@netgaintechnology.com
Operating system: Windows 2000 Server
PHP version: 4.3.0
PHP Bug Type: Session related
Bug description: session_register doesnt like null values
<?php
session_start();
$source = $_SERVER["HTTP_REFERER"];
session_register("source");
$connection = mssql_connect('server','UserName','password');
$sql = "select * from tbl;";
echo "$sql $connection<br>";
$sql_result = mssql_query($sql,$connection);
$num = mssql_num_rows($sql_result);
$retVal = "Records = ".$num;
if ($num > 0) {
mssql_data_seek($sql_result,0);
$row = mssql_fetch_object($sql_result);
$retVal = $row->Text;
}
mssql_free_result($sql_result);
echo $retVal;
?>
In this case the mssql_query fails with:
PHP Warning: mssql_query(): supplied argument is not a valid MS SQL-Link
resource.
if I simply comment the $source = $_SERVER... it succeeds.
If I change session_register to $_SESSION["source"] = $source; it
succeeds.
I am not sure how these are related.
What is even weirder is the echo "$sql $connection<br>";
They echo what is expected when it works. When it doesnt whichever was
defined first is the value for both.
IE When it fails as it is written
select * from tbl_Texts; select * from tbl_Texts;
If you change
$connection = mssql_connect('server','UserName','password');
$sql = "select * from tbl;";
to
$sql = "select * from tbl;";
$connection = mssql_connect('server','UserName','password');
it echos
Resource id #3 Resource id #3
I will in the future use $_SESSION but there are alot of files to change
if this wont be fixed.
Thanks
Charles Killmer
--
Edit bug report at http://bugs.php.net/?id=21312&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=21312&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=21312&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=21312&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=21312&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=21312&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=21312&r=support
Expected behavior: http://bugs.php.net/fix.php?id=21312&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=21312&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=21312&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=21312&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21312&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=21312&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=21312&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=21312&r=gnused