ZF2-240: CLONE - "__clone method called on non-object" error when setting selectResultPrototype in setup() function of class extending \Zend\Db\TableGateway\AbstractTableGateway" to

Issue Type: Bug Created: 2012-03-27T06:53:49.000+0000 Last Updated: 2012-03-27T07:00:49.000+0000 Status: Resolved Fix version(s): Reporter: Vitalii (duken) (duken) Assignee: Vitalii (duken) (duken) Tags: - Zend\Db

  • zend_db

Related issues: Attachments:


Creating a RowGateway object as a dependency of ResultSet object to set selectResultPrototype property during the construction of a TableGateway object causes the following error:

"Fatal error: __clone method called on non-object in /var/www/pyratepunx/vendor/ZendFramework/library/Zend/Db/TableGateway/TableGateway.php on line 382"

The problem is the RowGateway constructor tries to clone the TableGateway object which tries to clone its selectResultPrototype property which is what we are trying to set and it creates a bit of a chicken and the egg situation.

The following code reproduces the error:

selectResultPrototype = new \\Zend\\Db\\ResultSet\\ResultSet(new MyRowGateway($this, 'id')); } } $myTable = new MyTableGateway(); ?>


Posted by Vitalii (duken) (duken) on 2012-03-27T07:00:49.000+0000

I want created duplicate issuen Instead clone bug (.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.