php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28420 Looses variable in exception
Submitted: 2004-05-17 15:44 UTC Modified: 2004-05-19 22:40 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: m at saffitz dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.0RC2 OS: Mac OS 10.3
Private report: No CVE-ID: None
 [2004-05-17 15:44 UTC] m at saffitz dot com
Description:
------------
I have a very standard session handler I'm writing, with 
the write function as below.

I'm using propel (propel.phpdb.org) as an object 
persistence layer.

When the function is called automatically by the session 
system, the first print statement correctly prints the 
session id.  However, an exception is thrown when the 
record does not yet exist in the database, and the catch 
block in entered.  Here, the second print statement 
incorrectly prints $id, printing instead some path:

Output:

0a900f631d4ebf175f7b85ec262ca7292
/Users/msaffitz/cvswork/aspen-in
Failed to select one and only one row.
/Users/msaffitz/cvswork/aspen-in

Reproduce code:
---------------
 public function write( $id, $val ) { 
    print "$id<br>\n";
    try { 
      $session = SessionsPeer::retrieveByPk($id); 
    }
    catch ( PropelException $exception ) {
      print "$id<br>\n";
      print $exception->getMessage();
      $session = new Sessions();
      $session->setId($id);
    }
    print $id;
    $session->setDatavalue($val);
    $session->setModificationDate('NOW()');
    $session->save();
  }
 

Expected result:
----------------
The variable $id's value should persist.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-19 22:40 UTC] m at saffitz dot com
Retracting the bug report...  appears to not be a PHP 
issue.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 12:01:31 2024 UTC