ID:               32923
 Updated by:       [EMAIL PROTECTED]
 Reported By:      m dot cappelleri at xaos dot it
-Status:           Open
+Status:           Feedback
 Bug Type:         Scripting Engine problem
 Operating System: Debian
 PHP Version:      5.0.4
 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.




Previous Comments:
------------------------------------------------------------------------

[2005-05-03 11:37:16] m dot cappelleri at xaos dot it

Sorry, the code example was already a workaround,
the code that generates the error is:


                $this->_images = array();
                
                while ($r = $q->fetchRow()){
                        
                        
                        try {
                                echo "Adding element ... <br/>";
                                $this->_images[] = 
Attachment::Attachment($r['attachment_id'],
$r['type_id']);
                        } catch (xException $e) {
                                
                                echo "<b>EX</b>";
                                
                        }
                }
                
                echo "<pre>Ora lo printo...";
                print_r($this->_images);
                echo "</pre>";

Sorry about that.

------------------------------------------------------------------------

[2005-05-03 11:34:33] m dot cappelleri at xaos dot it

Description:
------------
In a try and catch syntax,
when an Exception is thrown a variable strangely disappears.

Reproduce code:
---------------
                $this->_images = array();
                
                while ($r = $q->fetchRow()){
                        
                        
                        try {
                                $tmp = NULL;
                                echo "Adding element ... <br/>";
                                $tmp = 
Attachment::Attachment($r['attachment_id'], $r['type_id']);
                                if (!isNull($tmp)) {
                                        $this->_images[] = $tmp;
                                }
                        } catch (xException $e) {
                                
                                echo "<b>EX</b>";
                                
                        }
                }
                
                echo "<pre>Ora lo printo...";
                print_r($this->_images);
                echo "</pre>";

Expected result:
----------------
$this->_images SHOULD ALWAYS be an array, no matter when or if an
exception is thrown.

Actual result:
--------------
In this case when the exception is thrown in the last cycle the print_r
gives a null result.

Even more strangely, $this->_images is still there and correctly
populated when requested after that (from a different method).


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32923&edit=1

Reply via email to