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

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

 New Comment:

See bug #51991

We already fixed this issue. The \ is automatically converted to / on
system where / is the dir separator.


Previous Comments:
------------------------------------------------------------------------
[2010-07-02 11:31:48] johan...@php.net

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

------------------------------------------------------------------------
[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