Bug #16872 [Com]: PHP crashes at session_start()
| From: | Stehlampe2020 at gmail dot com | Date: | Fri, 25 Aug 2023 11:28:43 +0000 |
| Subject: | Bug #16872 [Com]: PHP crashes at session_start() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-245245@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=16872&edit=1
ID: 16872
Comment by: Stehlampe2020 at gmail dot com
Reported by: siebe_tolsma at hotmail dot com
Summary: PHP crashes at session_start()
Status: Not a bug
Type: Bug
Package: Session related
Operating System: Win 98
PHP Version: 4.2.0
Block user comment: N
Private report: N
New Comment:
I'm also trying that. I load a translation (from a JSON file, which one gets loaded is chosen
by the user) and if I then immediately
die(); it works.
If I put the die(); after the session_start(); it returns error 500.
This is the script as of writing the comment:
```PHP
<?php
// Load translation in requested language or German
$transl = json_decode(file_get_contents('transl-'.((isset($_GET['l'])
&& in_array($_GET['l'], ['de', 'en', 'sv'])) ?
$_GET['l'] : 'de').'.json'));
var_dump($transl); //debug, works
// die('Debug 1'); //debug, works when not commented-out
// Set user type to guest if no session is running or fail to deliver files if it's a file
fetching request
start_session();
die(); //debug, doesn't work
if (!isset($_SESSION['ut'])) {
$_SESSION['ut'] = 'g';
}
if (!in_array($_SESSION['ut'], ['g', 'u', 'a'])) { //
utâusertype gâguest uâuser aâadmin
session_destroy();
header('Content-type: text/html; encoding=utf-8');
die('<!DOCTYPE html>
<html>
<head>
<title>'.$transl->title_sesserr_type.' â¢
Lampe2020.de</title>
</head>
</html>');
}
if (!((isset($_SESSION['un']) &&
isset($_SESSION['pw'])))&&($_SESSION['un']!='' &&
$_SESSION['pw']!='')) { // unâusername pwâpassword
$_SESSION['ut'] = 'g';
}
?>
```
Previous Comments:
------------------------------------------------------------------------
[2002-04-27 10:39:06] siebe_tolsma at hotmail dot com
All right,
So I have the this script:
<?php
session_start();
/*
phpTextEditor v1.0 (03/21/02)
http://php.rij73.com
Copyright (C) 2002 rij73
Please post in the forum at http://php.rij73.com if you have any
questions or comments.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
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. See the
GNU General Public License for more details.
*/
include ("config.inc");
//password check
if(($valid_pass != $editor_password) or ($valid_user != $editor_username)) {
echo "<html><head><title>$title</title><style
type=\"text/css\"><!--";
include ("style.inc");
echo "--></style></head>";
echo "<body onload=\"document.login.valid_user.focus()\"><table align=center
width=750 height=\"90%\"><tr><td align=center valign=middle><form
name=\"login\" method=\"post\" action=\"login.php\">";
echo "$user<br><input type=\"text\"
name=\"valid_user\"><br><br>$pass<br><input
type=\"password\" name=\"valid_pass\"><br><br><input
type=\"submit\" name=\"submit\" value=\"login\">";
echo "</form></td></tr></table></body>";
} //end password check
//password okay, send to script!
elseif(($valid_pass == $editor_password) or ($valid_user == $editor_username)){
session_register('valid_user');
session_register('valid_pass');
header("Location: index.php");
}
?>
I expect it to start a session, register the user and password and the go to index.php.
Now when I run the script in the browser (I run under a Apache server), PHP crashes.
------------------------------------------------------------------------
[2002-04-27 10:31:06] jan@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
------------------------------------------------------------------------
[2002-04-27 10:29:02] siebe_tolsma at hotmail dot com
Hi,
I try to make a script with sessions, but when I use the command session_start() in my script, PHP
crashes. I don't know what causes it, so please help me.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=16872&edit=1