Edit report at https://bugs.php.net/bug.php?id=61808&edit=1

 ID:                 61808
 Comment by:         nanocaiordo at gmail dot com
 Reported by:        nanocaiordo at gmail dot com
 Summary:            Could not implement interface Iterator
 Status:             Open
 Type:               Bug
 Package:            Class/Object related
 Operating System:   Fedora 17 x86_64
 PHP Version:        5.4.0
 Block user comment: N
 Private report:     N

 New Comment:

Good decision indeed.
But a fatal error, even if natural in this case, will make it impossible to run 
on 
both 5.3.10 and 5.4.

Not sure if in this case a E_WARNING or a E_DEPRECATED could be used instead.

However, I just found it in the changelog as "MySQLi: Added iterator support in 
MySQLi. mysqli_result implements Traversable."

Shouldn't be added somewhere in the "migration" changes.


Previous Comments:
------------------------------------------------------------------------
[2012-04-22 06:42:29] larue...@php.net

as of PHP-5.4, MySQLi_Result implements Traversable, but not sure, whether this 
should be a bug.

------------------------------------------------------------------------
[2012-04-22 05:29:01] nanocaiordo at gmail dot com

Description:
------------
I cannot find anything within changelogs, bug reportings and documentations 
relating to this issue.

It works fine in php 5.3.10, but gives me fatal error in PHP 5.4.

Test script:
---------------
<?php
error_reporting(E_ALL | E_DEPRECATED | E_STRICT);
ini_set('display_errors', 1);

interface Foo_SQL_Interface_Result extends ArrayAccess, Countable, Iterator
{
 public function data_seek($offset);
 public function fetch_all($resulttype=MYSQLI_NUM);
 public function fetch_array();
 public function fetch_assoc();
 public function fetch_field_direct($offset);
 public function fetch_field();
 public function fetch_fields();
 public function fetch_object();
 public function fetch_row();
 public function field_seek($offset);
 public function free();
}

class Foo_MySQLi_UseResult extends MySQLi_Result
{
 function __construct(MySQLi $obj) { parent::__construct($obj); }
 public function fetch_array($type_cast=false) {}
 public function fetch_assoc($type_cast=false) {}
 public function fetch_row($type_cast=false) {}
 public function fetch_all($resulttype=MYSQLI_ASSOC, $type_cast=false) {}
}

class Foo_MySQLi_Result extends Foo_MySQLi_UseResult implements 
Foo_SQL_Interface_Result
{
 public function data_seek($offset) {}
 public function fetch_field_direct($offset) {}
 public function field_seek($offset) {}
 # ArrayAccess
 public function offsetExists($k)  {}
 public function offsetGet($k)     {}
 public function offsetSet($k, $v) {}
 public function offsetUnset($k)   {}
 # Countable
 public function count()   {}
 # Iterator
 public function key()     {}
 public function current() {}
 public function next()    {}
 public function rewind()  {}
 public function valid()   {}
}


Actual result:
--------------
Fatal error: Class Foo_MySQLi_Result could not implement interface Iterator in 
Unknown on line 0


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



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

Reply via email to