php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38121 class is considered not defined before it is declared
Submitted: 2006-07-17 01:36 UTC Modified: 2014-04-14 12:21 UTC
From: public at grik dot net Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.1.4 OS: *
Private report: No CVE-ID: None
 [2006-07-17 01:36 UTC] public at grik dot net
Description:
------------
I am not sure already what is it related to, but it's getting interesting :)
The engine does not recognise the class that implements the ArrayAccess interface as declared in the code written before the class declaration is placed.

Reproduce code:
---------------
<?php
var_dump(class_exists('validatorCheck'));

class validatorCheck implements ArrayAccess {

function offsetGet($key){}
function offsetSet($key, $value) {}
function offsetUnset($key) {}
function offsetExists($offset) {}

//class end
}

var_dump(class_exists('validatorCheck'));
?>

Expected result:
----------------
bool(true)
bool(true)

Actual result:
--------------
bool(false)
bool(true)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-17 07:05 UTC] helly@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

.
 [2006-07-17 07:57 UTC] tony2001@php.net
It doesn't depend on SPL, that happens with all interfaces and it's expected.
 [2006-07-17 09:00 UTC] public at grik dot net
Thank you! "It's not a bug - it's a feature" :-)
Actually, it is a documentation issue and I'll comment it.
May I convert it to a feature request?
 [2014-04-14 12:21 UTC] dm@php.net
-Status: Open +Status: Not a bug -Package: Feature/Change Request +Package: *General Issues
 [2014-04-14 12:21 UTC] dm@php.net
nikic@php.net said: "interfaces are implemented at runtime"
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 12:01:30 2024 UTC