Edit report at http://bugs.php.net/bug.php?id=52230&edit=1

 ID:               52230
 Updated by:       johan...@php.net
 Reported by:      spawn at frostdrake dot tk
 Summary:          namespace & __autoload clash
-Status:           Open
+Status:           Bogus
 Type:             Bug
 Package:          Class/Object related
 Operating System: gentoo & ubuntu
 PHP Version:      5.3.2

 New Comment:

It tries to load Core\init.php. you have to translate this yourself to
Core/init.php - mind the \ vs. /.


Previous Comments:
------------------------------------------------------------------------
[2010-07-02 01:30:23] spawn at frostdrake dot tk

Description:
------------
when you use __autoload($var) it will get the class needed depending on
the file.

by using namespace and getting the class by a full path name

ex

new \class\name



__autload will then try to load classname

Test script:
---------------
/** index.php **/



function __autoload($var) {

  require_once($var.'.php');

}

//It will try to load the file Coreinit.php and not Core/init.php;

new Core\init



/** Core/init.php **/

namespace Core;

class init{

  function __construct(){

    echo 'Bingo..!'; 

  }

}

Expected result:
----------------
that autoload loads Core/init.php

Actual result:
--------------
autoload loads Coreinit.php


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52230&edit=1

Reply via email to