php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36122 abstract keyword produces Fatal Error in an interface.
Submitted: 2006-01-22 15:38 UTC Modified: 2006-01-22 15:47 UTC
From: pierre dot lasante at sympatico dot ca Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.1.2 OS: Windows XP sp2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pierre dot lasante at sympatico dot ca
New email:
PHP Version: OS:

 

 [2006-01-22 15:38 UTC] pierre dot lasante at sympatico dot ca
Description:
------------
This is the error I get when I run my script:

Fatal error: Access type for interface method Openable::open() must be omitted in C:\Program Files\Apache Group\Apache2\htdocs\zend\interface.Openable.php on line 3

These are my scripts:


interface.Openable.php
<?php
interface Openable {
	public abstract function open();
	public abstract function close();
}
?>

class.Jar.php
<?php
require_once('interface.Openable.php');

class Jar implements Openable {
	private $contents;
	
	public function __construct($contents) {
		$this->contents = $contents;
	}
	
	function open() {
		print "The jar is now open<br />";
	}
	
	function close() {
		print "The jar is now closed<br />";
	}
}
?>

testOpenable.php
<?php
	require_once('class.Jar.php');
	
	function openSomething(Openable $obj) {
		$obj->open();
	}
	
	$objJar = new Jar('Jelly');
	
	openSomething($objJar);
?>

If I remove the abstract keyword in interface.Openable.php I don't get the error. Is it because of PHP 5.1.2 and that I need to upgrade? 

Regards.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-22 15:47 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The error message says it all. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 08:01:28 2024 UTC