php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33897 Incorrect error handling in case of method cals from inside of php engine
Submitted: 2005-07-28 10:32 UTC Modified: 2005-08-09 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: kpisman at gmail dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.0.4 OS: FreeBSD 5.4-STABLE #1: Sat Jul
Private report: No CVE-ID: None
 [2005-07-28 10:32 UTC] kpisman at gmail dot com
Description:
------------
 When php code impliments standart interface (iterator in my case) and there is errors in methods called from inside of php engine (in my case key() ) i got error message with no usefull info: "Error on  line 0", so on. If i will call class->key() i got normal backtrace.

Expected result:
----------------
 I  expected to see the same results in both cases.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-28 11:30 UTC] tony2001@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".

Thank you for your interest in PHP.



 [2005-08-01 12:32 UTC] kpisman at gmail dot com
Sample code:
-----
<?php
class bullshit implements iterator{
  function curent(){
  }
  function next(){
  }
  function current(){
    echo "current";
    throw new exception('bullshit');
  }
  function key(){
  
  }
  function rewind(){
  
  }
  function valid(){
    return (true); 
  }
  function __destruct(){
  echo "destructor";
  }
}
$f=new bullshit;
try{
  foreach($f as $thisF){
  
  }
}
catch (exception $e){
  echo "catch !!!";
}
?>
-----

Run results:

php test-zend.php
current
Fatal error: Couldn't execute method bullshit::key in Unknown on line 0
destructor
(shell returned 255)

----

 So, it's clean that this appearance is incorrect. I think this is result of the same  bug in Zend engine, that troubles described in first comment. Also first trouble is exists to: error is appears in unknown module at line zero.
 [2005-08-01 12:36 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-08-01 12:40 UTC] tony2001@php.net
I can't reproduce it with both 5.0.x CVS and 5.1 CVS.
 [2005-08-09 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-09-28 22:17 UTC] marrone_mike at hotmail dot com
I am having this same problem. The iterator was working and the error seems to have popped up out of nowhere. I am using version 5.0.4.
My CollectionIterator class looks like this:

class CollectionIterator implements Iterator {

  private $_collection;
  private $_currIndex = 0;
  private $_keys;
	
  function __construct( Collection $objCol ) {
    $this->_collection = $objCol;
    $this->_keys = $this->_collection->getKeys();
  }
	
  function rewind() {
    $this->_currIndex = 0;	
  }
	
  function valid() {  
    return $this->_currIndex < 
        $this->_collection->getLength();	
  }
	
  function key() {
    return $this->_keys[$this->_currIndex];	
  }
	
  function current() {
    return $this->_collection->getItem( 
       $this->_keys[$this->_currIndex] );	
  }
	
  function next() {
    $this->_currIndex++;	
  }
	
}

This is the error:
Fatal error: Couldn't execute method CollectionIterator::key in Unknown on line 0

The __construct(), rewind(), and current(), methods are all called without error leading up to the call of the key() method.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC