Initiate a PHP class where class name is a variable
Posted
by ed209
on Stack Overflow
See other posts from Stack Overflow
or by ed209
Published on 2010-03-31T10:48:42Z
Indexed on
2010/03/31
10:53 UTC
Read the original article
Hit count: 298
I need some help with an error I have not encountered before and can't seem to find anywhere.
In a PHP mvc framework (just from a tutorial) I have the following:
// Initiate the class
$className = 'Controller_' . ucfirst($controller);
if (class_exists($className)) {
$controller = new $className($this->registry);
}
$className is showing the correct class name (case is also correct). But when I run it I get this in the apache error log (no php error)
[Wed Mar 31 10:34:12 2010] [notice] child pid 987 exit signal Segmentation fault (11)
Process id is different on every call. I am running PHP 5.3.0 on os x 10.6. This site seems to work on 5.2.11 on another Mac. Not really sure where to go next to debug it. I guess it could be an apache setting as much as a php bug or a problem with the code... any suggestions on where to look next?
© Stack Overflow or respective owner