php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69629 PHP Fatal error: Not compatible with interface
Submitted: 2015-05-13 11:05 UTC Modified: 2016-04-16 13:56 UTC
From: toco at aimeos dot org Assigned:
Status: Duplicate Package: *General Issues
PHP Version: master-Git-2015-05-13 (Git) OS: Travis-ci
Private report: No CVE-ID: None
 [2015-05-13 11:05 UTC] toco at aimeos dot org
Description:
------------
Some weeks ago, there was a change in the PHP master branch that changed the way interfaces are enforced and which creates a fatal error since then:

Fatal error: Declaration of MShop_Coupon_Provider_Decorator_Abstract::__construct() must be compatible with MShop_Coupon_Provider_Factory_Interface::__construct(MShop_Context_Item_Interface $context, MShop_Coupon_Item_Interface $item, $code) in /home/travis/build/aimeos/arcavias-core/lib/mshoplib/src/MShop/Coupon/Provider/Decorator/Abstract.php on line 18

Test script:
---------------
interface MShop_Coupon_Provider_Decorator_Interface
	extends MShop_Coupon_Provider_Interface
{
	public function __construct( MShop_Context_Item_Interface $context, MShop_Coupon_Item_Interface $item, $code, MShop_Coupon_Provider_Interface $provider );
}

interface MShop_Coupon_Provider_Factory_Interface
	extends MShop_Coupon_Provider_Interface
{
	public function __construct( MShop_Context_Item_Interface $context, MShop_Coupon_Item_Interface $item, $code );
}

interface MShop_Coupon_Provider_Interface
{
}

abstract class MShop_Coupon_Provider_Abstract
{
	public function __construct( MShop_Context_Item_Interface $context, MShop_Coupon_Item_Interface $item, $code )
	{
	}
}

abstract class MShop_Coupon_Provider_Decorator_Abstract
	extends MShop_Coupon_Provider_Abstract
	implements MShop_Coupon_Provider_Decorator_Interface
{
	public function __construct(MShop_Context_Item_Interface $context, MShop_Coupon_Item_Interface $couponItem, $code, MShop_Coupon_Provider_Interface $provider )
	{
		parent::__construct( $context, $couponItem, $code );
	}
}


Expected result:
----------------
Should work as before because the MShop_Coupon_Provider_Factory_Interface isn't used for MShop_Coupon_Provider_Decorator_Abstract. The original files are:

- https://github.com/aimeos/arcavias-core/blob/master/lib/mshoplib/src/MShop/Coupon/Provider/Decorator/Interface.php
- https://github.com/aimeos/arcavias-core/blob/master/lib/mshoplib/src/MShop/Coupon/Provider/Interface.php
- https://github.com/aimeos/arcavias-core/blob/master/lib/mshoplib/src/MShop/Coupon/Provider/Factory/Interface.php
- https://github.com/aimeos/arcavias-core/blob/master/lib/mshoplib/src/MShop/Coupon/Provider/Abstract.php
-https://github.com/aimeos/arcavias-core/blob/master/lib/mshoplib/src/MShop/Coupon/Provider/Decorator/Abstract.php

Actual result:
--------------
Fatal error: Declaration of MShop_Coupon_Provider_Decorator_Abstract::__construct() must be compatible with MShop_Coupon_Provider_Factory_Interface::__construct(MShop_Context_Item_Interface $context, MShop_Coupon_Item_Interface $item, $code) in /home/travis/build/aimeos/arcavias-core/lib/mshoplib/src/MShop/Coupon/Provider/Decorator/Abstract.php on line 18

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-16 13:56 UTC] nikic@php.net
-Status: Open +Status: Duplicate
 [2016-04-16 13:56 UTC] nikic@php.net
Duplicate of the bug linked by cmb.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 18:01:29 2024 UTC