I have a class and the commented line is failing (clearly because I don’t need the $ before displayname), however I ended up having to put a bunch of echo statements in to figure that out because an error isn’t being thrown.
I’m hoping there is a way.
class RegisterModel {
var $displayname;
...
function RegisterModel() {
try {
if (empty($_POST) === false) {
// THIS LINE IS FAILING ... BUT I'M NOT GETTING AN ERROR
// I KNOW WHY IT'S FAILING ... BUT I WANT AN ERROR TO THROW
$this->$displayname = $_POST['displayname'];
...
}
}
catch (Exception $e) {
echo $e->getMessage();
}
}
}
Should the error be getting thrown into the catch and I’m just not using it right? Is there some global setting I need to set so that the errors are thrown?
Keep in mind you want to set
error_reportingto your desired level.