php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11368 "getenv("REMOTE_ADDR")" crashes PHP during session saving
Submitted: 2001-06-08 16:05 UTC Modified: 2001-06-09 08:23 UTC
From: alex at gai dot ru Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.0.5 OS: OS/2
Private report: No CVE-ID: None
 [2001-06-08 16:05 UTC] alex at gai dot ru
===cut===
<?php

 function open ($save_path, $session_name) {
    $f = fopen('log', 'a');
    fputs($f, "open ($save_path, $session_name)\n");
    fclose($f);
     return true;
 }

 function close() {
    $f = fopen('log', 'a');
    fputs($f, "close\n");
    fclose($f);
     return true;
 }

 function read ($key) {
    $f = fopen('log', 'a');
    fputs($f, "read ($key)\n");
    fclose($f);
     return "foo|i:1;";
 }

 function write ($key, $val) {
    $ip = getenv("REMOTE_ADDR");
    $f = fopen('log', 'a');
    fputs($f, "write ($key, $val)\n");
    fclose($f);
     return true;
 }

 function destroy ($key) {
    $f = fopen('log', 'a');
    fputs($f, "destroy($key)\n");
    fclose($f);
     return true;
 }

 function gc ($maxlifetime) {
     return true;
 }

 session_set_save_handler ("open", "close", "read", "write", "destroy", "gc");

 session_start();

 $foo++;

 ?>
===cut===

this will produce only one "log" only with "open" and "read", no "write" and "close"...

this is not only 4.0.5 bug, but 4.0.4pl1 too.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-09 01:11 UTC] sniper@php.net
submitted twice

 [2001-06-09 08:23 UTC] alex at gai dot ru
This is not repetitive submission. The code is simillar, but not the same.
Bug 11367 is about directory changing and bug 11368 is about crashing, so be careful...
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed May 22 12:01:27 2019 UTC