oop - PHP Fatal error Call to private Uploade::__construct() from invalid context (Construct is Public) -
the problem i'm having strange one, log file says __construct method in class called 'upload' private, in reality public! error makes no sense. class code;
class upload { public $errors; public $imagetypes; public $cdn_url; public $uploadpath; private $maxheight; private $maxwidth; private $maxtokenlength; private $forcemaxdimensions; private $maxfilesize = 5; public function __construct() { include_once 'config.php'; $this->imagetypes = array('jpg', 'png'); $this->errors = array(); # convert megabytes bytes $this->maxfilesize = $this->maxfilesize * 1048576; } }
this how initiate class;
include_once 'upload.php'; $upload = new upload;
this error log file;
php fatal error: call private upload::__construct() invalid context
i've looked @ many answers online , non have helped me, i'm hoping answer stackoverflow! help.
edit: contents of config.php file
$imagetypes = array('jpg', 'png'); $cdn_url = 'cdn.php'; $uploadpath = 'uploads/'; $maxheight = 1000; $maxwidth = 1000; $forcemaxdimensions = true; $maxfilesize = 5;// mb
based on code posted, mentioned error can't happen.
i propose use cstatementtracer
found in my answer question.
cstatementtracer
uses php's tick-feature trace each executed statement , dump log file. said, need enable cstatementtracer
somewhere in application.
Comments
Post a Comment