|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30090 Outside interface method can be called inside method that using the interface
Submitted: 2004-09-15 07:53 UTC Modified: 2004-09-15 08:07 UTC
From: mikarento at hotmail dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.0.0 OS: Windows 2000
Private report: No CVE-ID: None
 [2004-09-15 07:53 UTC] mikarento at hotmail dot com
Method who's parameter is object of particular interface should not invoke other method of its interface. 

Reproduce code:
interface Printable{
 public function print();

interface Writeable{
 public function write($text);

class ImplClass implements Printable, Writeable{
 public function print(){
  return 'hallo'
 public function write($text){
  echo 'written';

class Printer {
 public static function printIt(Printable p){

$a = new ImplClass();

// the result is 'written'

Expected result:
error: Printable object doesn't have 'write' method 

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-15 08:07 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

The object you pass is a ImplClass which has a write method. Your problem here is that PHP does only dynamic binding and resolving at runtime unlike for example C++.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 18:01:30 2024 UTC