Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- SPL: spl_autoload() with static methods --INI-- include_path=. --FILE-- <?php cl..

Decoded Output download

--TEST--
SPL: spl_autoload() with static methods
--INI--
include_path=.
--FILE--
<?php

class MyAutoLoader {

        static function autoLoad($className) {
            echo __METHOD__ . "($className)
";
        }
}

spl_autoload_register(array('MyAutoLoader', 'autoLoad'));

// and

$myAutoLoader = new MyAutoLoader();

spl_autoload_register(array($myAutoLoader, 'autoLoad'));

var_dump(spl_autoload_functions());

// check
var_dump(class_exists("TestClass", true));

?>
--EXPECT--
array(1) {
  [0]=>
  array(2) {
    [0]=>
    string(12) "MyAutoLoader"
    [1]=>
    string(8) "autoLoad"
  }
}
MyAutoLoader::autoLoad(TestClass)
bool(false)

Did this file decode correctly?

Original Code

--TEST--
SPL: spl_autoload() with static methods
--INI--
include_path=.
--FILE--
<?php

class MyAutoLoader {

        static function autoLoad($className) {
            echo __METHOD__ . "($className)\n";
        }
}

spl_autoload_register(array('MyAutoLoader', 'autoLoad'));

// and

$myAutoLoader = new MyAutoLoader();

spl_autoload_register(array($myAutoLoader, 'autoLoad'));

var_dump(spl_autoload_functions());

// check
var_dump(class_exists("TestClass", true));

?>
--EXPECT--
array(1) {
  [0]=>
  array(2) {
    [0]=>
    string(12) "MyAutoLoader"
    [1]=>
    string(8) "autoLoad"
  }
}
MyAutoLoader::autoLoad(TestClass)
bool(false)

Function Calls

None

Variables

None

Stats

MD5 6370870e80b708baecd6eeef96ab887c
Eval Count 0
Decode Time 81 ms