From:             m at saffitz dot com
Operating system: Mac OS 10.3
PHP version:      5.0.0RC2
PHP Bug Type:     Zend Engine 2 problem
Bug description:  Looses variable in exception

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.


-- 
Edit bug report at http://bugs.php.net/?id=28420&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28420&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28420&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28420&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28420&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28420&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28420&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28420&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28420&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28420&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28420&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28420&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28420&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28420&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28420&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28420&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28420&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28420&r=float

Reply via email to