Skip to content

Commit 164106a

Browse files
committed
remove deprecated __autoload functions
1 parent a852b07 commit 164106a

File tree

1 file changed

+3
-44
lines changed

1 file changed

+3
-44
lines changed

lib/util/sfCore.class.php

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -184,36 +184,7 @@ static public function splAutoload($class)
184184

185185
static public function initAutoload()
186186
{
187-
if (function_exists('spl_autoload_register'))
188-
{
189-
ini_set('unserialize_callback_func', 'spl_autoload_call');
190-
}
191-
else if (!function_exists('__autoload'))
192-
{
193-
ini_set('unserialize_callback_func', '__autoload');
194-
195-
function __autoload($class)
196-
{
197-
foreach (sfCore::getAutoloadCallables() as $callable)
198-
{
199-
if (call_user_func($callable, $class))
200-
{
201-
return true;
202-
}
203-
}
204-
205-
// unspecified class
206-
// do not print an error if the autoload came from class_exists
207-
$trace = debug_backtrace();
208-
if (count($trace) < 1 || ($trace[1]['function'] != 'class_exists' && $trace[1]['function'] != 'is_a'))
209-
{
210-
$error = sprintf('Autoloading of class "%s" failed. Try to clear the symfony cache and refresh.', $class);
211-
$e = new sfAutoloadException($error);
212-
213-
$e->printStackTrace();
214-
}
215-
}
216-
}
187+
ini_set('unserialize_callback_func', 'spl_autoload_call');
217188

218189
self::addAutoloadCallable(array('sfCore', 'splAutoload'));
219190
}
@@ -258,20 +229,8 @@ static public function initSimpleAutoload($dirs)
258229
}
259230
}
260231

261-
if (function_exists('spl_autoload_register'))
262-
{
263-
ini_set('unserialize_callback_func', 'spl_autoload_call');
264-
265-
spl_autoload_register(array('sfCore', 'splSimpleAutoload'));
266-
}
267-
elseif (!function_exists('__autoload'))
268-
{
269-
ini_set('unserialize_callback_func', '__autoload');
232+
ini_set('unserialize_callback_func', 'spl_autoload_call');
270233

271-
function __autoload($class)
272-
{
273-
return sfCore::splSimpleAutoload($class);
274-
}
275-
}
234+
spl_autoload_register(array('sfCore', 'splSimpleAutoload'));
276235
}
277236
}

0 commit comments

Comments
 (0)