From 9616a61d98c4f4fbcdec4b24402a88a936c76c06 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 29 Dec 2015 21:29:46 -0600
Subject: [PATCH] php: Support PHP 7, require at least 5.4

This commit attempts to remove all coding standard warnings emitted by PHP
7.0.
---
 include/JSON.php                              |  8 +--
 include/PasswordHash.php                      |  2 +-
 include/api.tickets.php                       |  2 +-
 include/class.ajax.php                        |  3 -
 include/class.api.php                         |  2 +-
 include/class.attachment.php                  |  2 +-
 include/class.captcha.php                     |  2 +-
 include/class.config.php                      |  6 +-
 include/class.crypto.php                      | 14 ++---
 include/class.csrf.php                        |  2 +-
 include/class.dept.php                        |  4 +-
 include/class.dispatcher.php                  |  4 +-
 include/class.dynamic_forms.php               | 55 +------------------
 include/class.error.php                       |  6 +-
 include/class.export.php                      |  2 +-
 include/class.file.php                        |  8 +--
 include/class.filter.php                      |  6 +-
 include/class.forms.php                       | 24 ++++----
 include/class.i18n.php                        |  4 +-
 include/class.knowledgebase.php               |  2 +-
 include/class.lock.php                        |  5 --
 include/class.log.php                         |  2 +-
 include/class.mailer.php                      |  2 +-
 include/class.mailfetch.php                   |  4 +-
 include/class.mailparse.php                   |  4 +-
 include/class.migrater.php                    |  4 +-
 include/class.nav.php                         |  8 +--
 include/class.orm.php                         |  5 +-
 include/class.osticket.php                    |  2 +-
 include/class.ostsession.php                  |  2 +-
 include/class.pagenate.php                    |  2 +-
 include/class.pdf.php                         |  2 +-
 include/class.plugin.php                      |  4 +-
 include/class.role.php                        |  4 +-
 include/class.search.php                      | 14 ++---
 include/class.setup.php                       |  6 +-
 include/class.staff.php                       | 10 ++--
 include/class.task.php                        |  4 +-
 include/class.team.php                        |  4 +-
 include/class.template.php                    |  4 +-
 include/class.thread.php                      | 33 +++++------
 include/class.ticket.php                      |  4 +-
 include/class.translation.php                 |  4 +-
 include/class.upgrader.php                    | 44 +--------------
 include/class.user.php                        |  2 +-
 include/class.usersession.php                 |  2 +-
 include/class.validator.php                   | 25 +++++----
 include/class.variable.php                    |  2 +-
 include/class.xml.php                         |  2 +-
 include/class.yaml.php                        |  2 +-
 include/htmLawed.php                          |  3 +-
 include/html2text.php                         |  2 +-
 include/mpdf/classes/bmp.php                  |  4 +-
 include/mpdf/classes/cssmgr.php               |  4 +-
 include/mpdf/classes/gif.php                  | 33 ++---------
 include/mpdf/classes/grad.php                 |  4 +-
 include/mpdf/classes/indic.php                |  7 +--
 include/mpdf/classes/ttfontsuni.php           |  4 +-
 include/mpdf/classes/wmf.php                  |  4 +-
 include/mpdf/mpdf.php                         |  3 +-
 include/pear/Crypt/AES.php                    |  4 +-
 include/pear/Crypt/Hash.php                   |  2 +-
 include/pear/Crypt/Rijndael.php               |  2 +-
 include/pear/Mail/RFC822.php                  |  2 +-
 include/pear/Mail/mail.php                    |  2 +-
 include/pear/Mail/mimeDecode.php              |  2 +-
 include/pear/Mail/mock.php                    |  2 +-
 include/pear/Mail/sendmail.php                |  2 +-
 include/pear/Mail/smtp.php                    |  4 +-
 include/pear/Math/BigInteger.php              |  2 +-
 include/pear/PEAR.php                         |  8 +--
 include/pear/PEAR/FixPHP5PEARWarnings.php     |  6 +-
 include/staff/system.inc.php                  |  8 +++
 include/upgrader/prereq.inc.php               |  2 +-
 .../streams/core/934954de-f1ccd3bb.task.php   |  2 +-
 open.php                                      |  2 +-
 setup/inc/class.installer.php                 |  4 +-
 setup/inc/install-prereq.inc.php              |  6 +-
 78 files changed, 191 insertions(+), 309 deletions(-)

diff --git a/include/JSON.php b/include/JSON.php
index e75eba65b..efa942497 100644
--- a/include/JSON.php
+++ b/include/JSON.php
@@ -129,7 +129,7 @@ class Services_JSON
     *                                   bubble up with an error, so all return values
     *                                   from encode() should be checked with isError()
     */
-    function Services_JSON($use = 0)
+    function __construct($use = 0)
     {
         $this->use = $use;
     }
@@ -779,10 +779,10 @@ if (class_exists('PEAR_Error')) {
 
     class Services_JSON_Error extends PEAR_Error
     {
-        function Services_JSON_Error($message = 'unknown error', $code = null,
+        function __construct($message = 'unknown error', $code = null,
                                      $mode = null, $options = null, $userinfo = null)
         {
-            parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
+            parent::__construct($message, $code, $mode, $options, $userinfo);
         }
     }
 
@@ -793,7 +793,7 @@ if (class_exists('PEAR_Error')) {
      */
     class Services_JSON_Error
     {
-        function Services_JSON_Error($message = 'unknown error', $code = null,
+        function __construct($message = 'unknown error', $code = null,
                                      $mode = null, $options = null, $userinfo = null)
         {
 
diff --git a/include/PasswordHash.php b/include/PasswordHash.php
index b5b8efcad..745c93ba2 100644
--- a/include/PasswordHash.php
+++ b/include/PasswordHash.php
@@ -30,7 +30,7 @@ class PasswordHash {
 	var $portable_hashes;
 	var $random_state;
 
-	function PasswordHash($iteration_count_log2, $portable_hashes)
+	function __construct($iteration_count_log2, $portable_hashes)
 	{
 		$this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
 
diff --git a/include/api.tickets.php b/include/api.tickets.php
index e2ee066ae..e762fb18a 100644
--- a/include/api.tickets.php
+++ b/include/api.tickets.php
@@ -129,7 +129,7 @@ class TicketApiController extends ApiController {
         # Create the ticket with the data (attempt to anyway)
         $errors = array();
 
-        $ticket = Ticket::create($data, $errors, $data['source'], $autorespond, $alert);
+        $ticket = Ticket::create2($data, $errors, $data['source'], $autorespond, $alert);
         # Return errors (?)
         if (count($errors)) {
             if(isset($errors['errno']) && $errors['errno'] == 403)
diff --git a/include/class.ajax.php b/include/class.ajax.php
index 870d5ae88..143dbac2a 100644
--- a/include/class.ajax.php
+++ b/include/class.ajax.php
@@ -25,9 +25,6 @@ require_once (INCLUDE_DIR.'class.api.php');
  * consistency.
  */
 class AjaxController extends ApiController {
-    function AjaxController() {
-    
-    }
     function staffOnly() {
         global $thisstaff;
         if(!$thisstaff || !$thisstaff->isValid()) {
diff --git a/include/class.api.php b/include/class.api.php
index 86a8320cd..818b8826e 100644
--- a/include/class.api.php
+++ b/include/class.api.php
@@ -19,7 +19,7 @@ class API {
 
     var $ht;
 
-    function API($id) {
+    function __construct($id) {
         $this->id = 0;
         $this->load($id);
     }
diff --git a/include/class.attachment.php b/include/class.attachment.php
index 6dd482338..95e2fe242 100644
--- a/include/class.attachment.php
+++ b/include/class.attachment.php
@@ -130,7 +130,7 @@ extends InstrumentedList {
                 $fileId = $file['id'];
             elseif (isset($file['tmp_name']) && ($F = AttachmentFile::upload($file)))
                 $fileId = $F->getId();
-            elseif ($F = AttachmentFile::create($file))
+            elseif ($F = AttachmentFile::createFile($file))
                 $fileId = $F->getId();
             else
                 continue;
diff --git a/include/class.captcha.php b/include/class.captcha.php
index 86f89d979..c74117254 100644
--- a/include/class.captcha.php
+++ b/include/class.captcha.php
@@ -18,7 +18,7 @@ class Captcha {
     var $bgimages=array('cottoncandy.png','grass.png','ripple.png','silk.png','whirlpool.png',
                         'bubbles.png','crackle.png','lines.png','sand.png','snakeskin.png');
     var $font = 10;
-    function Captcha($len=6,$font=7,$bg=''){
+    function __construct($len=6,$font=7,$bg=''){
 
         $this->hash = strtoupper(substr(md5(rand(0, 9999)),rand(0, 24),$len));
         $this->font = $font;
diff --git a/include/class.config.php b/include/class.config.php
index e1e7e7b06..924f0c012 100644
--- a/include/class.config.php
+++ b/include/class.config.php
@@ -30,7 +30,7 @@ class Config {
     # new settings and the corresponding default values.
     var $defaults = array();                # List of default values
 
-    function Config($section=null, $defaults=array()) {
+    function __construct($section=null, $defaults=array()) {
         if ($section)
             $this->section = $section;
 
@@ -209,8 +209,8 @@ class OsticketConfig extends Config {
         'max_open_tickets' => 0,
     );
 
-    function OsticketConfig($section=null) {
-        parent::Config($section);
+    function __construct($section=null) {
+        parent::__construct($section);
 
         if (count($this->config) == 0) {
             // Fallback for osticket < 1.7@852ca89e
diff --git a/include/class.crypto.php b/include/class.crypto.php
index a9aebcd2f..b169cbb29 100644
--- a/include/class.crypto.php
+++ b/include/class.crypto.php
@@ -231,7 +231,7 @@ class CryptoAlgo {
 
     var $ciphers = null;
 
-    function  CryptoAlgo($tag) {
+    function __construct($tag) {
         $this->tag_number = $tag;
     }
 
@@ -332,8 +332,8 @@ Class CryptoMcrypt extends CryptoAlgo {
                 ),
             );
 
-    function getCipher($cid=null) {
-        return parent::getCipher($cid, array($this, '_checkCipher'));
+    function getCipher($cid=null, $callback=false) {
+        return parent::getCipher($cid, $callback ?: array($this, '_checkCipher'));
     }
 
    function _checkCipher($c) {
@@ -465,8 +465,8 @@ class CryptoOpenSSL extends CryptoAlgo {
             ? $cipher['method']: '';
     }
 
-    function getCipher($cid) {
-        return parent::getCipher($cid, array($this, '_checkCipher'));
+    function getCipher($cid=null, $callback=false) {
+        return parent::getCipher($cid, $callback ?: array($this, '_checkCipher'));
     }
 
     function _checkCipher($c) {
@@ -580,8 +580,8 @@ class CryptoPHPSecLib extends CryptoAlgo {
         return new $class($c['mode']);
     }
 
-    function getCipher($cid) {
-        return  parent::getCipher($cid, array($this, '_checkCipher'));
+    function getCipher($cid=null, $callback=false) {
+        return  parent::getCipher($cid, $callback ?: array($this, '_checkCipher'));
     }
 
     function _checkCipher($c) {
diff --git a/include/class.csrf.php b/include/class.csrf.php
index a1c3aed21..77a8bf833 100644
--- a/include/class.csrf.php
+++ b/include/class.csrf.php
@@ -34,7 +34,7 @@ Class CSRF {
 
     var $csrf;
 
-    function CSRF($name='__CSRFToken__', $timeout=0) {
+    function __construct($name='__CSRFToken__', $timeout=0) {
 
         $this->name = $name;
         $this->timeout = $timeout;
diff --git a/include/class.dept.php b/include/class.dept.php
index 5e916a816..495380b91 100644
--- a/include/class.dept.php
+++ b/include/class.dept.php
@@ -733,7 +733,7 @@ extends Form {
         return $clean;
     }
 
-    function render($staff=true) {
-        return parent::render($staff, false, array('template' => 'dynamic-form-simple.tmpl.php'));
+    function render($staff=true, $title=false, $options=array()) {
+        return parent::render($staff, $title, $options + array('template' => 'dynamic-form-simple.tmpl.php'));
     }
 }
diff --git a/include/class.dispatcher.php b/include/class.dispatcher.php
index 3490e7882..00cec8700 100644
--- a/include/class.dispatcher.php
+++ b/include/class.dispatcher.php
@@ -21,7 +21,7 @@
  * functions aren't separated
  */
 class Dispatcher {
-    function Dispatcher($file=false) {
+    function __construct($file=false) {
         $this->urls = array();
         $this->file = $file;
     }
@@ -81,7 +81,7 @@ class Dispatcher {
 }
 
 class UrlMatcher {
-    function UrlMatcher($regex, $func, $args=false, $method=false) {
+    function __construct($regex, $func, $args=false, $method=false) {
         # Add the slashes for the Perl syntax
         $this->regex = "@" . $regex . "@";
         $this->func = $func;
diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index 172a15809..bb1bce0ad 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -487,58 +487,6 @@ class TicketForm extends DynamicForm {
         return static::$instance;
     }
 
-    static function ensureDynamicDataView() {
-        $sql = 'SHOW TABLES LIKE \''.TABLE_PREFIX.'ticket__cdata\'';
-        if (!db_num_rows(db_query($sql)))
-            return static::buildDynamicDataView();
-    }
-
-    static function buildDynamicDataView() {
-        // create  table __cdata (primary key (ticket_id)) as select
-        // entry.object_id as ticket_id, MAX(IF(field.name = 'subject',
-        // ans.value, NULL)) as `subject`,MAX(IF(field.name = 'priority',
-        // ans.value, NULL)) as `priority_desc`,MAX(IF(field.name =
-        // 'priority', ans.value_id, NULL)) as `priority_id`
-        // FROM ost_form_entry entry LEFT JOIN ost_form_entry_values ans ON
-        // ans.entry_id = entry.id LEFT JOIN ost_form_field field ON
-        // field.id=ans.field_id
-        // where entry.object_type='T' group by entry.object_id;
-        $sql = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'ticket__cdata` (PRIMARY KEY
-            (ticket_id)) DEFAULT CHARSET=utf8 AS '
-            . static::getCrossTabQuery('T', 'ticket_id');
-        db_query($sql);
-    }
-
-    static function dropDynamicDataView() {
-        db_query('DROP TABLE IF EXISTS `'.TABLE_PREFIX.'ticket__cdata`');
-    }
-
-    static function updateDynamicDataView($answer, $data) {
-        // TODO: Detect $data['dirty'] for value and value_id
-        // We're chiefly concerned with Ticket form answers
-        if (!($e = $answer->getEntry()) || $e->form->get('type') != 'T')
-            return;
-
-        // $record = array();
-        // $record[$f] = $answer->value'
-        // TicketFormData::objects()->filter(array('ticket_id'=>$a))
-        //      ->merge($record);
-        $sql = 'SHOW TABLES LIKE \''.TABLE_PREFIX.'ticket__cdata\'';
-        if (!db_num_rows(db_query($sql)))
-            return;
-
-        $f = $answer->getField();
-        if (!$f->getFormId())
-            return;
-
-        $name = $f->get('name') ?: ('field_'.$f->get('id'));
-        $fields = sprintf('`%s`=', $name) . db_input($answer->getSearchKeys());
-        $sql = 'INSERT INTO `'.TABLE_PREFIX.'ticket__cdata` SET '.$fields
-            .', `ticket_id`='.db_input($answer->getEntry()->get('object_id'))
-            .' ON DUPLICATE KEY UPDATE '.$fields;
-        if (!db_query($sql))
-            return self::dropDynamicDataView();
-    }
 }
 // Add fields from the standard ticket form to the ticket filterable fields
 Filter::addSupportedMatches(/* @trans */ 'Ticket Data', function() {
@@ -1485,9 +1433,8 @@ class SelectionField extends FormField {
         return $this->_list;
     }
 
-    function getWidget() {
+    function getWidget($widgetClass=false) {
         $config = $this->getConfiguration();
-        $widgetClass = false;
         if ($config['widget'] == 'typeahead' && $config['multiselect'] == false)
             $widgetClass = 'TypeaheadSelectionWidget';
         elseif ($config['widget'] == 'textbox')
diff --git a/include/class.error.php b/include/class.error.php
index 72909a615..c083437d8 100644
--- a/include/class.error.php
+++ b/include/class.error.php
@@ -17,7 +17,7 @@
     vim: expandtab sw=4 ts=4 sts=4:
 **********************************************************************/
 
-class Error extends Exception {
+class BaseError extends Exception {
     static $title = '';
     static $sendAlert = true;
 
@@ -42,7 +42,7 @@ class Error extends Exception {
     }
 }
 
-class InitialDataError extends Error {
+class InitialDataError extends BaseError {
     static $title = 'Problem with install initial data';
 }
 
@@ -52,7 +52,7 @@ function raise_error($message, $class=false) {
 }
 
 // File storage backend exceptions
-class IOException extends Error {
+class IOException extends BaseError {
     static $title = 'Unable to read resource content';
 }
 
diff --git a/include/class.export.php b/include/class.export.php
index ee2c6a8ec..9235a18bc 100644
--- a/include/class.export.php
+++ b/include/class.export.php
@@ -393,7 +393,7 @@ class DatabaseExporter {
         USER_ACCOUNT_TABLE, ORGANIZATION_TABLE, NOTE_TABLE
     );
 
-    function DatabaseExporter($stream, $options=array()) {
+    function __construct($stream, $options=array()) {
         $this->stream = $stream;
         $this->options = $options;
     }
diff --git a/include/class.file.php b/include/class.file.php
index 8e95bc08f..6439f798d 100644
--- a/include/class.file.php
+++ b/include/class.file.php
@@ -293,7 +293,7 @@ class AttachmentFile extends VerySimpleModel {
                     'tmp_name'=>$file['tmp_name'],
                     );
 
-        return static::create($info, $ft, $deduplicate);
+        return static::createFile($info, $ft, $deduplicate);
     }
 
     static function uploadLogo($file, &$error, $aspect_ratio=2) {
@@ -327,7 +327,7 @@ class AttachmentFile extends VerySimpleModel {
         return false;
     }
 
-    static function create(&$file, $ft='T', $deduplicate=true) {
+    static function createFile(&$file, $ft='T', $deduplicate=true) {
         if (isset($file['encoding'])) {
             switch ($file['encoding']) {
             case 'base64':
@@ -380,7 +380,7 @@ class AttachmentFile extends VerySimpleModel {
             $file['type'] = 'application/octet-stream';
 
 
-        $f = parent::create(array(
+        $f = static::create(array(
             'type' => strtolower($file['type']),
             'name' => $file['name'],
             'key' => $file['key'],
@@ -445,7 +445,7 @@ class AttachmentFile extends VerySimpleModel {
     }
 
     static function __create($file, &$errors) {
-        return static::create($file);
+        return static::createFile($file);
     }
 
     /**
diff --git a/include/class.filter.php b/include/class.filter.php
index c15249ec3..9a31e510f 100644
--- a/include/class.filter.php
+++ b/include/class.filter.php
@@ -37,7 +37,7 @@ class Filter {
         ),
     );
 
-    function Filter($id) {
+    function __construct($id) {
         $this->id=0;
         $this->load($id);
     }
@@ -561,7 +561,7 @@ class FilterRule {
 
     var $filter;
 
-    function FilterRule($id,$filterId=0) {
+    function __construct($id,$filterId=0) {
         $this->id=0;
         $this->load($id,$filterId);
     }
@@ -697,7 +697,7 @@ class TicketFilter {
      *  ---------------
      *  @see Filter::matches() for a complete list of supported keys
      */
-    function TicketFilter($origin, $vars=array()) {
+    function __construct($origin, $vars=array()) {
 
         //Normalize the target based on ticket's origin.
         $this->target = self::origin2target($origin);
diff --git a/include/class.forms.php b/include/class.forms.php
index 59bd50d38..02e918575 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -2166,8 +2166,8 @@ FormField::addFieldTypes(/*@trans*/ 'Dynamic Fields', function() {
 
 
 class DepartmentField extends ChoiceField {
-    function getWidget() {
-        $widget = parent::getWidget();
+    function getWidget($widgetClass=false) {
+        $widget = parent::getWidget($widgetClass);
         if ($widget->value instanceof Dept)
             $widget->value = $widget->value->getId();
         return $widget;
@@ -2177,7 +2177,7 @@ class DepartmentField extends ChoiceField {
         return true;
     }
 
-    function getChoices() {
+    function getChoices($verbose=false) {
         global $cfg;
 
         $choices = array();
@@ -2235,8 +2235,8 @@ class AssigneeField extends ChoiceField {
     var $_choices = null;
     var $_criteria = null;
 
-    function getWidget() {
-        $widget = parent::getWidget();
+    function getWidget($widgetClass=false) {
+        $widget = parent::getWidget($widgetClass);
         if (is_object($widget->value))
             $widget->value = $widget->value->getId();
         return $widget;
@@ -2261,7 +2261,7 @@ class AssigneeField extends ChoiceField {
         $this->_choices = $choices;
     }
 
-    function getChoices() {
+    function getChoices($verbose=false) {
         global $cfg;
 
         if (!isset($this->_choices)) {
@@ -2651,7 +2651,7 @@ class FileUploadField extends FormField {
         if ($file['size'] > $config['size'])
             throw new FileUploadError(__('File size is too large'));
 
-        if (!$F = AttachmentFile::create($file))
+        if (!$F = AttachmentFile::createFile($file))
             throw new FileUploadError(__('Unable to save file'));
 
         return $F;
@@ -3071,7 +3071,7 @@ class TextboxWidget extends Widget {
 
 class TextboxSelectionWidget extends TextboxWidget {
     //TODO: Support multi-input e.g comma separated inputs
-    function render($options=array()) {
+    function render($options=array(), $extraConfig=array()) {
 
         if ($this->value && is_array($this->value))
             $this->value = current($this->value);
@@ -4072,9 +4072,9 @@ class AssignmentForm extends Form {
             return $fields[$name];
     }
 
-    function isValid() {
+    function isValid($include=false) {
 
-        if (!parent::isValid() || !($f=$this->getField('assignee')))
+        if (!parent::isValid($include) || !($f=$this->getField('assignee')))
             return false;
 
         // Do additional assignment validation
@@ -4212,9 +4212,9 @@ class TransferForm extends Form {
         return $this->fields;
     }
 
-    function isValid() {
+    function isValid($include=false) {
 
-        if (!parent::isValid())
+        if (!parent::isValid($include))
             return false;
 
         // Do additional validations
diff --git a/include/class.i18n.php b/include/class.i18n.php
index c29082119..3954ea0d0 100644
--- a/include/class.i18n.php
+++ b/include/class.i18n.php
@@ -23,7 +23,7 @@ class Internationalization {
     // fallback
     var $langs = array('en_US');
 
-    function Internationalization($language=false) {
+    function __construct($language=false) {
         global $cfg;
 
         if ($cfg && ($lang = $cfg->getPrimaryLanguage()))
@@ -540,7 +540,7 @@ class DataTemplate {
      * template itself does not have to keep track of the language for which
      * it is defined.
      */
-    function DataTemplate($path, $langs=array('en_US')) {
+    function __construct($path, $langs=array('en_US')) {
         foreach ($langs as $l) {
             if (file_exists("{$this->base}/$l/$path")) {
                 $this->lang = $l;
diff --git a/include/class.knowledgebase.php b/include/class.knowledgebase.php
index 33b214d6a..8c4b01025 100644
--- a/include/class.knowledgebase.php
+++ b/include/class.knowledgebase.php
@@ -17,7 +17,7 @@ require_once("class.file.php");
 
 class Knowledgebase {
 
-    function Knowledgebase($id) {
+    function __construct($id) {
         $res=db_query(
             'SELECT title, isenabled, dept_id, created, updated '
            .'FROM '.CANNED_TABLE.' WHERE canned_id='.db_input($id));
diff --git a/include/class.lock.php b/include/class.lock.php
index e5da2f048..427ecbbe9 100644
--- a/include/class.lock.php
+++ b/include/class.lock.php
@@ -128,11 +128,6 @@ class Lock extends VerySimpleModel {
             return $lock;
     }
 
-    static function create($staffId, $lockTime) {
-        if ($lock = self::acquire($staffId, $lockTime))
-            return $lock;
-    }
-
     // Simply remove ALL locks a user (staff) holds on a ticket(s).
     static function removeStaffLocks($staffId, $object=false) {
         $locks = static::objects()->filter(array(
diff --git a/include/class.log.php b/include/class.log.php
index 4fea7e4c1..eec2192b1 100644
--- a/include/class.log.php
+++ b/include/class.log.php
@@ -19,7 +19,7 @@ class Log {
     var $id;
     var $info;
 
-    function Log($id){
+    function __construct($id){
         $this->id=0;
         return $this->load($id);
     }
diff --git a/include/class.mailer.php b/include/class.mailer.php
index 1d3712211..cffaec5ed 100644
--- a/include/class.mailer.php
+++ b/include/class.mailer.php
@@ -30,7 +30,7 @@ class Mailer {
     var $smtp = array();
     var $eol="\n";
 
-    function Mailer($email=null, array $options=array()) {
+    function __construct($email=null, array $options=array()) {
         global $cfg;
 
         if(is_object($email) && $email->isSMTPEnabled() && ($info=$email->getSMTPInfo())) { //is SMTP enabled for the current email?
diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php
index 94b80c91a..9410c95d0 100644
--- a/include/class.mailfetch.php
+++ b/include/class.mailfetch.php
@@ -33,7 +33,7 @@ class MailFetcher {
 
     var $tnef = false;
 
-    function MailFetcher($email, $charset='UTF-8') {
+    function __construct($email, $charset='UTF-8') {
 
 
         if($email && is_numeric($email)) //email_id
@@ -792,7 +792,7 @@ class MailFetcher {
             // NOTE: This might not be a "ticket"
             $ticket = $thread->getObject();
         }
-        elseif (($ticket=Ticket::create($vars, $errors, 'Email'))) {
+        elseif (($ticket=Ticket::create2($vars, $errors, 'Email'))) {
             $message = $ticket->getLastMessage();
         }
         else {
diff --git a/include/class.mailparse.php b/include/class.mailparse.php
index 1efd5a8b1..1564cc077 100644
--- a/include/class.mailparse.php
+++ b/include/class.mailparse.php
@@ -32,7 +32,7 @@ class Mail_Parse {
 
     var $tnef = false;      // TNEF encoded mail
 
-    function Mail_parse(&$mimeMessage, $charset=null){
+    function __construct(&$mimeMessage, $charset=null){
 
         $this->mime_message = &$mimeMessage;
 
@@ -581,7 +581,7 @@ class EmailDataParser {
     var $stream;
     var $error;
 
-    function EmailDataParser($stream=null) {
+    function __construct($stream=null) {
         $this->stream = $stream;
     }
 
diff --git a/include/class.migrater.php b/include/class.migrater.php
index b9dbdca2e..0348f1b31 100644
--- a/include/class.migrater.php
+++ b/include/class.migrater.php
@@ -33,12 +33,10 @@ class DatabaseMigrater {
     var $end;
     var $sqldir;
 
-    function DatabaseMigrater($start, $end, $sqldir) {
-
+    function __construct($start, $end, $sqldir) {
         $this->start = $start;
         $this->end = $end;
         $this->sqldir = $sqldir;
-
     }
 
     function getPatches($stop=null) {
diff --git a/include/class.nav.php b/include/class.nav.php
index e69014817..dfe308f79 100644
--- a/include/class.nav.php
+++ b/include/class.nav.php
@@ -23,7 +23,7 @@ class StaffNav {
 
     var $staff;
 
-    function StaffNav($staff, $panel='staff'){
+    function __construct($staff, $panel='staff'){
         $this->staff=$staff;
         $this->panel=strtolower($panel);
     }
@@ -206,8 +206,8 @@ class StaffNav {
 
 class AdminNav extends StaffNav{
 
-    function AdminNav($staff){
-        parent::StaffNav($staff, 'admin');
+    function __construct($staff){
+        parent::__construct($staff, 'admin');
     }
 
     function getRegisteredApps() {
@@ -296,7 +296,7 @@ class UserNav {
 
     var $user;
 
-    function UserNav($user=null, $active=''){
+    function __construct($user=null, $active=''){
 
         $this->user=$user;
         $this->navs=$this->getNavs();
diff --git a/include/class.orm.php b/include/class.orm.php
index f816265e3..3c381d121 100644
--- a/include/class.orm.php
+++ b/include/class.orm.php
@@ -458,10 +458,11 @@ class VerySimpleModel {
      */
     static function lookup($criteria) {
         // Model::lookup(1), where >1< is the pk value
+        $args = func_get_args();
         if (!is_array($criteria)) {
             $criteria = array();
             $pk = static::getMeta('pk');
-            foreach (func_get_args() as $i=>$f)
+            foreach ($args as $i=>$f)
                 $criteria[$pk[$i]] = $f;
 
             // Only consult cache for PK lookup, which is assumed if the
@@ -653,7 +654,7 @@ class AnnotatedModel {
 class SqlFunction {
     var $alias;
 
-    function SqlFunction($name) {
+    function __construct($name) {
         $this->func = $name;
         $this->args = array_slice(func_get_args(), 1);
     }
diff --git a/include/class.osticket.php b/include/class.osticket.php
index d6f1f5533..40c939c04 100644
--- a/include/class.osticket.php
+++ b/include/class.osticket.php
@@ -51,7 +51,7 @@ class osTicket {
     var $company;
     var $plugins;
 
-    function osTicket() {
+    function __construct() {
 
         require_once(INCLUDE_DIR.'class.config.php'); //Config helper
         require_once(INCLUDE_DIR.'class.company.php');
diff --git a/include/class.ostsession.php b/include/class.ostsession.php
index e08ab604f..e6b57a916 100644
--- a/include/class.ostsession.php
+++ b/include/class.ostsession.php
@@ -27,7 +27,7 @@ class osTicketSession {
     var $id = '';
     var $backend;
 
-    function osTicketSession($ttl=0){
+    function __construct($ttl=0){
         $this->ttl = $ttl ?: ini_get('session.gc_maxlifetime') ?: SESSION_TTL;
 
         // Set osTicket specific session name.
diff --git a/include/class.pagenate.php b/include/class.pagenate.php
index 5873862c0..69368393e 100644
--- a/include/class.pagenate.php
+++ b/include/class.pagenate.php
@@ -24,7 +24,7 @@ class PageNate {
     var $pages;
 
 
-    function PageNate($total,$page,$limit=20,$url='') {
+    function __construct($total,$page,$limit=20,$url='') {
         $this->total = intval($total);
         $this->limit = max($limit, 1 );
         $this->page  = max($page, 1 );
diff --git a/include/class.pdf.php b/include/class.pdf.php
index 7f149f342..c12d071e8 100644
--- a/include/class.pdf.php
+++ b/include/class.pdf.php
@@ -56,7 +56,7 @@ class Ticket2PDF extends mPDFWithLocalImages
 
     var $ticket = null;
 
-	function Ticket2PDF($ticket, $psize='Letter', $notes=false) {
+	function __construct($ticket, $psize='Letter', $notes=false) {
         global $thisstaff;
 
         $this->ticket = $ticket;
diff --git a/include/class.plugin.php b/include/class.plugin.php
index 39028f6ee..9d15bd359 100644
--- a/include/class.plugin.php
+++ b/include/class.plugin.php
@@ -8,7 +8,7 @@ class PluginConfig extends Config {
     function __construct($name) {
         // Use parent constructor to place configurable information into the
         // central config table in a namespace of "plugin.<id>"
-        parent::Config("plugin.$name");
+        parent::__construct("plugin.$name");
         foreach ($this->getOptions() as $name => $field) {
             if ($this->exists($name))
                 $this->config[$name]->value = $field->to_php($this->get($name));
@@ -370,7 +370,7 @@ abstract class Plugin {
 
     static $verify_domain = 'updates.osticket.com';
 
-    function Plugin($id) {
+    function __construct($id) {
         $this->id = $id;
         $this->load();
     }
diff --git a/include/class.role.php b/include/class.role.php
index 64fdbe07d..005bc0ff5 100644
--- a/include/class.role.php
+++ b/include/class.role.php
@@ -383,7 +383,7 @@ extends AbstractForm {
         return $clean;
     }
 
-    function render($staff=true) {
-        return parent::render($staff, false, array('template' => 'dynamic-form-simple.tmpl.php'));
+    function render($staff=true, $title=false, $options=array()) {
+        return parent::render($staff, $title, $options + array('template' => 'dynamic-form-simple.tmpl.php'));
     }
 }
diff --git a/include/class.search.php b/include/class.search.php
index fb4c4e800..69d21401c 100644
--- a/include/class.search.php
+++ b/include/class.search.php
@@ -230,7 +230,7 @@ class MySqlSearchConfig extends Config {
     var $table = CONFIG_TABLE;
 
     function __construct() {
-        parent::Config("mysqlsearch");
+        parent::__construct("mysqlsearch");
     }
 }
 
@@ -1011,14 +1011,14 @@ class HelpTopicChoiceField extends ChoiceField {
         return true;
     }
 
-    function getChoices() {
+    function getChoices($verbose=false) {
         return Topic::getHelpTopics(false, Topic::DISPLAY_DISABLED);
     }
 }
 
 require_once INCLUDE_DIR . 'class.dept.php';
 class DepartmentChoiceField extends ChoiceField {
-    function getChoices() {
+    function getChoices($verbose=false) {
         return Dept::getDepartments();
     }
 
@@ -1031,7 +1031,7 @@ class DepartmentChoiceField extends ChoiceField {
 }
 
 class AssigneeChoiceField extends ChoiceField {
-    function getChoices() {
+    function getChoices($verbose=false) {
         global $thisstaff;
 
         $items = array(
@@ -1128,7 +1128,7 @@ class AssigneeChoiceField extends ChoiceField {
 }
 
 class TicketStateChoiceField extends ChoiceField {
-    function getChoices() {
+    function getChoices($verbose=false) {
         return array(
             'open' => __('Open'),
             'closed' => __('Closed'),
@@ -1150,7 +1150,7 @@ class TicketStateChoiceField extends ChoiceField {
 }
 
 class TicketFlagChoiceField extends ChoiceField {
-    function getChoices() {
+    function getChoices($verbose=false) {
         return array(
             'isanswered' =>   __('Answered'),
             'isoverdue' =>    __('Overdue'),
@@ -1178,7 +1178,7 @@ class TicketFlagChoiceField extends ChoiceField {
 }
 
 class TicketSourceChoiceField extends ChoiceField {
-    function getChoices() {
+    function getChoices($verbose=false) {
         return array(
             'web' => __('Web'),
             'email' => __('Email'),
diff --git a/include/class.setup.php b/include/class.setup.php
index 2bddbd65d..bcdd24687 100644
--- a/include/class.setup.php
+++ b/include/class.setup.php
@@ -14,10 +14,10 @@
     vim: expandtab sw=4 ts=4 sts=4:
 **********************************************************************/
 
-Class SetupWizard {
+class SetupWizard {
 
     //Mimimum requirements
-    var $prereq = array('php'   => '5.3',
+    var $prereq = array('php'   => '5.4',
                         'mysql' => '5.0');
 
     //Version info - same as the latest version.
@@ -28,7 +28,7 @@ Class SetupWizard {
     //Errors
     var $errors=array();
 
-    function SetupWizard(){
+    function __construct(){
         $this->errors=array();
         $this->version_verbose = sprintf(__('osTicket %s' /* <%s> is for the version */),
             THIS_VERSION);
diff --git a/include/class.staff.php b/include/class.staff.php
index 0c1b40712..b511f633a 100644
--- a/include/class.staff.php
+++ b/include/class.staff.php
@@ -840,7 +840,7 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
         $token = Misc::randCode(48); // 290-bits
 
         if (!$content)
-            return new Error(/* @trans */ 'Unable to retrieve password reset email template');
+            return new BaseError(/* @trans */ 'Unable to retrieve password reset email template');
 
         $vars = array(
             'url' => $ost->getConfig()->getBaseUrl(),
@@ -1315,8 +1315,8 @@ extends AbstractForm {
         return $clean;
     }
 
-    function render($staff=true) {
-        return parent::render($staff, false, array('template' => 'dynamic-form-simple.tmpl.php'));
+    function render($staff=true, $title=false, $options=array()) {
+        return parent::render($staff, $title, $options + array('template' => 'dynamic-form-simple.tmpl.php'));
     }
 }
 
@@ -1366,8 +1366,8 @@ extends AbstractForm {
         return $clean;
     }
 
-    function render($staff=true) {
-        return parent::render($staff, false, array('template' => 'dynamic-form-simple.tmpl.php'));
+    function render($staff=true, $title=false, $options=array()) {
+        return parent::render($staff, $title, $options + array('template' => 'dynamic-form-simple.tmpl.php'));
     }
 }
 
diff --git a/include/class.task.php b/include/class.task.php
index 3de800bce..1aecea023 100644
--- a/include/class.task.php
+++ b/include/class.task.php
@@ -1545,7 +1545,9 @@ class TaskThread extends ObjectThread {
         return MessageThreadEntry::create($vars, $errors);
     }
 
-    static function create($task) {
+    static function create($task=false) {
+        assert($task !== false);
+
         $id = is_object($task) ? $task->getId() : $task;
         $thread = parent::create(array(
                     'object_id' => $id,
diff --git a/include/class.team.php b/include/class.team.php
index d059eba51..1e772d16d 100644
--- a/include/class.team.php
+++ b/include/class.team.php
@@ -375,7 +375,7 @@ extends AbstractForm {
         );
     }
 
-    function render($staff=true) {
-        return parent::render($staff, false, array('template' => 'dynamic-form-simple.tmpl.php'));
+    function render($staff=true, $title=false, $options=array()) {
+        return parent::render($staff, $title, $options + array('template' => 'dynamic-form-simple.tmpl.php'));
     }
 }
diff --git a/include/class.template.php b/include/class.template.php
index bc998c851..36cf85602 100644
--- a/include/class.template.php
+++ b/include/class.template.php
@@ -182,7 +182,7 @@ class EmailTemplateGroup {
         ),
     );
 
-    function EmailTemplateGroup($id){
+    function __construct($id){
         $this->id=0;
         $this->load($id);
     }
@@ -508,7 +508,7 @@ class EmailTemplate {
     var $ht;
     var $_group;
 
-    function EmailTemplate($id, $group=null){
+    function __construct($id, $group=null){
         $this->id=0;
         if ($id) $this->load($id);
         if ($group) $this->_group = $group;
diff --git a/include/class.thread.php b/include/class.thread.php
index 0a1162487..0bb394aab 100644
--- a/include/class.thread.php
+++ b/include/class.thread.php
@@ -533,7 +533,10 @@ class Thread extends VerySimpleModel {
         return true;
     }
 
-    static function create($vars) {
+    static function create($vars=false) {
+        // $vars is expected to be an array
+        assert(is_array($vars));
+
         $inst = parent::create($vars);
         $inst->created = SqlFunction::NOW();
         return $inst;
@@ -961,7 +964,7 @@ implements TemplateVariable {
             $fileId = $file;
         elseif ($file instanceof AttachmentFile)
             $fileId = $file->getId();
-        elseif ($F = AttachmentFile::create($file))
+        elseif ($F = AttachmentFile::createFile($file))
             $fileId = $F->getId();
         elseif (is_array($file) && isset($file['id']))
             $fileId = $file['id'];
@@ -1309,9 +1312,11 @@ implements TemplateVariable {
     }
 
     //new entry ... we're trusting the caller to check validity of the data.
-    static function create($vars, &$errors=array()) {
+    static function create($vars=false) {
         global $cfg;
 
+        assert(is_array($vars));
+
         //Must have...
         if (!$vars['threadId'] || !$vars['type'])
             return false;
@@ -2280,10 +2285,6 @@ class MessageThreadEntry extends ThreadEntry {
         return $this->getTitle();
     }
 
-    static function create($vars, &$errors=array()) {
-        return static::add($vars, $errors);
-    }
-
     static function add($vars, &$errors=array()) {
 
         if (!$vars || !is_array($vars) || !$vars['threadId'])
@@ -2330,10 +2331,6 @@ class ResponseThreadEntry extends ThreadEntry {
         return $this->getStaff();
     }
 
-    static function create($vars, &$errors=array()) {
-        return static::add($vars, $errors);
-    }
-
     static function add($vars, &$errors=array()) {
 
         if (!$vars || !is_array($vars) || !$vars['threadId'])
@@ -2377,10 +2374,6 @@ class NoteThreadEntry extends ThreadEntry {
                 _S('New internal note posted'));
     }
 
-    static function create($vars, &$errors) {
-        return self::add($vars, $errors);
-    }
-
     static function add($vars, &$errors=array()) {
 
         //Check required params.
@@ -2518,7 +2511,7 @@ implements TemplateVariable {
 
         //Add ticket Id.
         $vars['threadId'] = $this->getId();
-        return NoteThreadEntry::create($vars, $errors);
+        return NoteThreadEntry::add($vars, $errors);
     }
 
     function addMessage($vars, &$errors) {
@@ -2526,7 +2519,7 @@ implements TemplateVariable {
         $vars['threadId'] = $this->getId();
         $vars['staffId'] = 0;
 
-        if (!($message = MessageThreadEntry::create($vars, $errors)))
+        if (!($message = MessageThreadEntry::add($vars, $errors)))
             return $message;
 
         $this->lastmessage = SqlFunction::NOW();
@@ -2539,7 +2532,7 @@ implements TemplateVariable {
         $vars['threadId'] = $this->getId();
         $vars['userId'] = 0;
 
-        if (!($resp = ResponseThreadEntry::create($vars, $errors)))
+        if (!($resp = ResponseThreadEntry::add($vars, $errors)))
             return $resp;
 
         $this->lastresponse = SqlFunction::NOW();
@@ -2594,7 +2587,9 @@ implements TemplateVariable {
 // Ticket thread class
 class TicketThread extends ObjectThread {
 
-    static function create($ticket) {
+    static function create($ticket=false) {
+        assert($ticket !== false);
+
         $id = is_object($ticket) ? $ticket->getId() : $ticket;
         $thread = parent::create(array(
                     'object_id' => $id,
diff --git a/include/class.ticket.php b/include/class.ticket.php
index 6d68aae89..6008a6eaa 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -3001,7 +3001,7 @@ implements RestrictedAccess, Threadable {
      *
      *  $autorespond and $alertstaff overrides config settings...
      */
-    static function create($vars, &$errors, $origin, $autorespond=true,
+    static function create2($vars, &$errors, $origin, $autorespond=true,
             $alertstaff=true) {
         global $ost, $cfg, $thisclient, $thisstaff;
 
@@ -3504,7 +3504,7 @@ implements RestrictedAccess, Threadable {
         $create_vars['cannedattachments']
             = $tform->getField('message')->getWidget()->getAttachments()->getClean();
 
-        if (!($ticket=Ticket::create($create_vars, $errors, 'staff', false)))
+        if (!($ticket=Ticket::create2($create_vars, $errors, 'staff', false)))
             return false;
 
         $vars['msgId']=$ticket->getLastMsgId();
diff --git a/include/class.translation.php b/include/class.translation.php
index 93c7cc4f3..77786de45 100644
--- a/include/class.translation.php
+++ b/include/class.translation.php
@@ -119,7 +119,7 @@ class gettext_reader {
    * @param object Reader the StreamReader object
    * @param boolean enable_cache Enable or disable caching of strings (default on)
    */
-  function gettext_reader($Reader, $enable_cache = true) {
+  function __construct($Reader, $enable_cache = true) {
     // If there isn't a StreamReader, turn on short circuit mode.
     if (! $Reader || isset($Reader->error) ) {
       $this->short_circuit = true;
@@ -462,7 +462,7 @@ class FileReader {
   var $_fd;
   var $_length;
 
-  function FileReader($filename) {
+  function __construct($filename) {
     if (is_resource($filename)) {
         $this->_length = strlen(stream_get_contents($filename));
         rewind($filename);
diff --git a/include/class.upgrader.php b/include/class.upgrader.php
index cf75be784..37df892c3 100644
--- a/include/class.upgrader.php
+++ b/include/class.upgrader.php
@@ -18,7 +18,7 @@ require_once INCLUDE_DIR.'class.setup.php';
 require_once INCLUDE_DIR.'class.migrater.php';
 
 class Upgrader {
-    function Upgrader($prefix, $basedir) {
+    function __construct($prefix, $basedir) {
         global $ost;
 
         $this->streams = array();
@@ -87,7 +87,7 @@ class Upgrader {
 
         //Create a ticket to make the system warm and happy.
         $errors = array();
-        Ticket::create($vars, $errors, 'api', false, false);
+        Ticket::create2($vars, $errors, 'api', false, false);
     }
 
     function getMode() {
@@ -114,44 +114,6 @@ class Upgrader {
             return call_user_func_array($callable, $args);
         }
     }
-
-    function getTask() {
-        if($this->getCurrentStream())
-            return $this->getCurrentStream()->getTask();
-    }
-
-    function doTask() {
-        return $this->getCurrentStream()->doTask();
-    }
-
-    function getErrors() {
-        if ($this->getCurrentStream())
-            return $this->getCurrentStream()->getErrors();
-    }
-
-    function getUpgradeSummary() {
-        if ($this->getCurrentStream())
-            return $this->getCurrentStream()->getUpgradeSummary();
-    }
-
-    function getNextAction() {
-        if ($this->getCurrentStream())
-            return $this->getCurrentStream()->getNextAction();
-    }
-
-    function getNextVersion() {
-        return $this->getCurrentStream()->getNextVersion();
-    }
-
-    function getSchemaSignature() {
-        if ($this->getCurrentStream())
-            return $this->getCurrentStream()->getSchemaSignature();
-    }
-
-    function getSHash() {
-        if ($this->getCurrentStream())
-            return $this->getCurrentStream()->getSHash();
-    }
 }
 
 /**
@@ -185,7 +147,7 @@ class StreamUpgrader extends SetupWizard {
      * sqldir - (string<path>) Path of sql patches
      * upgrader - (Upgrader) Parent coordinator of parallel stream updates
      */
-    function StreamUpgrader($schema_signature, $target, $stream, $prefix, $sqldir, $upgrader) {
+    function __construct($schema_signature, $target, $stream, $prefix, $sqldir, $upgrader) {
 
         $this->signature = $schema_signature;
         $this->target = $target;
diff --git a/include/class.user.php b/include/class.user.php
index b4feed828..4d106e27c 100644
--- a/include/class.user.php
+++ b/include/class.user.php
@@ -1051,7 +1051,7 @@ class UserAccount extends VerySimpleModel {
         $content = Page::lookupByType($template);
 
         if (!$email ||  !$content)
-            return new Error(sprintf(_S('%s: Unable to retrieve template'),
+            return new BaseError(sprintf(_S('%s: Unable to retrieve template'),
                 $template));
 
         $vars = array(
diff --git a/include/class.usersession.php b/include/class.usersession.php
index 004eda9ee..bb113f5d3 100644
--- a/include/class.usersession.php
+++ b/include/class.usersession.php
@@ -25,7 +25,7 @@ class UserSession {
    var $ip = '';
    var $validated=FALSE;
 
-   function UserSession($userid){
+   function __construct($userid){
 
       $this->browser=(!empty($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT'] : $_ENV['HTTP_USER_AGENT'];
       $this->ip=(!empty($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : getenv('REMOTE_ADDR');
diff --git a/include/class.validator.php b/include/class.validator.php
index 88075ab45..2cce38f21 100644
--- a/include/class.validator.php
+++ b/include/class.validator.php
@@ -20,7 +20,7 @@ class Validator {
     var $fields=array();
     var $errors=array();
 
-    function Validator($fields=null) {
+    function __construct($fields=null) {
         $this->setFields($fields);
     }
     function setFields(&$fields){
@@ -99,15 +99,15 @@ class Validator {
                 break;
             case 'phone':
             case 'fax':
-                if(!$this->is_phone($this->input[$k]))
+                if(!self::is_phone($this->input[$k]))
                     $this->errors[$k]=$field['error'];
                 break;
             case 'email':
-                if(!$this->is_email($this->input[$k]))
+                if(!self::is_email($this->input[$k]))
                     $this->errors[$k]=$field['error'];
                 break;
             case 'url':
-                if(!$this->is_url($this->input[$k]))
+                if(!self::is_url($this->input[$k]))
                     $this->errors[$k]=$field['error'];
                 break;
             case 'password':
@@ -116,7 +116,7 @@ class Validator {
                 break;
             case 'username':
                 $error = '';
-                if (!$this->is_username($this->input[$k], $error))
+                if (!self::is_username($this->input[$k], $error))
                     $this->errors[$k]=$field['error'].": $error";
                 break;
             case 'zipcode':
@@ -140,10 +140,11 @@ class Validator {
 
     /*** Functions below can be called directly without class instance.
          Validator::func(var..);  (nolint) ***/
-    function is_email($email, $list=false, $verify=false) {
+    static function is_email($email, $list=false, $verify=false) {
         require_once PEAR_DIR . 'Mail/RFC822.php';
         require_once PEAR_DIR . 'PEAR.php';
-        if (!($mails = Mail_RFC822::parseAddressList($email)) || PEAR::isError($mails))
+        $rfc822 = new Mail_RFC822();
+        if (!($mails = $rfc822->parseAddressList($email)) || PEAR::isError($mails))
             return false;
 
         if (!$list && count($mails) > 1)
@@ -166,24 +167,24 @@ class Validator {
         return true;
     }
 
-    function is_valid_email($email) {
+    static function is_valid_email($email) {
         global $cfg;
         // Default to FALSE for installation
         return self::is_email($email, false, $cfg && $cfg->verifyEmailAddrs());
     }
 
-    function is_phone($phone) {
+    static function is_phone($phone) {
         /* We're not really validating the phone number but just making sure it doesn't contain illegal chars and of acceptable len */
         $stripped=preg_replace("(\(|\)|\-|\.|\+|[  ]+)","",$phone);
         return (!is_numeric($stripped) || ((strlen($stripped)<7) || (strlen($stripped)>16)))?false:true;
     }
 
-    function is_url($url) {
+    static function is_url($url) {
         //XXX: parse_url is not ideal for validating urls but it's ideal for basic checks.
         return ($url && ($info=parse_url($url)) && $info['host']);
     }
 
-    function is_ip($ip) {
+    static function is_ip($ip) {
 
         if(!$ip or empty($ip))
             return false;
@@ -203,7 +204,7 @@ class Validator {
         return false;
     }
 
-    function is_username($username, &$error='') {
+    static function is_username($username, &$error='') {
         if (strlen($username)<2)
             $error = __('Username must have at least two (2) characters');
         elseif (!preg_match('/^[\p{L}\d._-]+$/u', $username))
diff --git a/include/class.variable.php b/include/class.variable.php
index 48c39095e..fb968336a 100644
--- a/include/class.variable.php
+++ b/include/class.variable.php
@@ -27,7 +27,7 @@ class VariableReplacer {
 
     var $errors;
 
-    function VariableReplacer($start_delim='(?:%{|%%7B)', $end_delim='(?:}|%7D)') {
+    function __construct($start_delim='(?:%{|%%7B)', $end_delim='(?:}|%7D)') {
 
         $this->start_delim = $start_delim;
         $this->end_delim = $end_delim;
diff --git a/include/class.xml.php b/include/class.xml.php
index 129e05877..c73a7cf73 100644
--- a/include/class.xml.php
+++ b/include/class.xml.php
@@ -18,7 +18,7 @@
 
 class XmlDataParser {
 
-    function XmlDataParser() {
+    function __construct() {
         $this->parser = xml_parser_create('utf-8');
         xml_set_object($this->parser, $this);
         xml_set_element_handler($this->parser, "startElement", "endElement");
diff --git a/include/class.yaml.php b/include/class.yaml.php
index 63ceb3754..9fffc9a3f 100644
--- a/include/class.yaml.php
+++ b/include/class.yaml.php
@@ -36,7 +36,7 @@ class YamlDataParser {
     }
 }
 
-class YamlParserError extends Error {
+class YamlParserError extends BaseError {
     static $title = 'Error parsing YAML document';
 }
 ?>
diff --git a/include/htmLawed.php b/include/htmLawed.php
index 9d0cc9e95..58f12039d 100644
--- a/include/htmLawed.php
+++ b/include/htmLawed.php
@@ -379,7 +379,8 @@ return $r;
 function hl_spec($t){
 // final $spec
 $s = array();
-$t = str_replace(array("\t", "\r", "\n", ' '), '', preg_replace('/"(?>(`.|[^"])*)"/sme', 'substr(str_replace(array(";", "|", "~", " ", ",", "/", "(", ")", \'`"\'), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\""), "$0"), 1, -1)', trim($t)));
+$t = str_replace(array("\t", "\r", "\n", ' '), '',
+preg_replace_callback('/"(?>(`.|[^"])*)"/sm', function($m) {return substr(str_replace(array(";", "|", "~", " ", ",", "/", "(", ")", '`"'), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\""), $m[0]), 1, -1);}, trim($t)));
 for($i = count(($t = explode(';', $t))); --$i>=0;){
  $w = $t[$i];
  if(empty($w) or ($e = strpos($w, '=')) === false or !strlen(($a =  substr($w, $e+1)))){continue;}
diff --git a/include/html2text.php b/include/html2text.php
index d8ef77c5e..0fcaa5cab 100644
--- a/include/html2text.php
+++ b/include/html2text.php
@@ -561,7 +561,7 @@ class HtmlUnorderedListElement extends HtmlListElement {
 }
 
 class HtmlListItem extends HtmlBlockElement {
-    function HtmlListItem($node, $parent, $number) {
+    function __construct($node, $parent, $number) {
         parent::__construct($node, $parent);
         $this->number = $number;
     }
diff --git a/include/mpdf/classes/bmp.php b/include/mpdf/classes/bmp.php
index acf7f8085..04b64326d 100755
--- a/include/mpdf/classes/bmp.php
+++ b/include/mpdf/classes/bmp.php
@@ -4,7 +4,7 @@ class bmp {
 
 var $mpdf = null;
 
-function bmp(&$mpdf) {
+function __construct(&$mpdf) {
 	$this->mpdf = $mpdf;
 }
 
@@ -245,4 +245,4 @@ function rle4_decode ($str, $width){
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/include/mpdf/classes/cssmgr.php b/include/mpdf/classes/cssmgr.php
index aef74542d..3b030f8c4 100755
--- a/include/mpdf/classes/cssmgr.php
+++ b/include/mpdf/classes/cssmgr.php
@@ -12,7 +12,7 @@ var $tbCSSlvl;
 var $listCSSlvl;
 
 
-function cssmgr(&$mpdf) {
+function __construct(&$mpdf) {
 	$this->mpdf = $mpdf;
 	$this->tablecascadeCSS = array();
 	$this->listcascadeCSS = array();
@@ -1574,4 +1574,4 @@ function PreviewBlockCSS($tag,$attr) {
 
 }	// end of class
 
-?>
\ No newline at end of file
+?>
diff --git a/include/mpdf/classes/gif.php b/include/mpdf/classes/gif.php
index 582de0d6f..2087a97d3 100755
--- a/include/mpdf/classes/gif.php
+++ b/include/mpdf/classes/gif.php
@@ -26,7 +26,7 @@ class CGIFLZW
 	///////////////////////////////////////////////////////////////////////////
 
 	// CONSTRUCTOR
-	function CGIFLZW()
+	function __construct()
 	{
 		$this->MAX_LZW_BITS = 12;
 		unSet($this->Next);
@@ -240,7 +240,7 @@ class CGIFCOLORTABLE
 	///////////////////////////////////////////////////////////////////////////
 
 	// CONSTRUCTOR
-	function CGIFCOLORTABLE()
+	function __construct()
 	{
 		unSet($this->m_nColors);
 		unSet($this->m_arColors);
@@ -327,7 +327,7 @@ class CGIFFILEHEADER
 	///////////////////////////////////////////////////////////////////////////
 
 	// CONSTRUCTOR
-	function CGIFFILEHEADER()
+	function __construct()
 	{
 		unSet($this->m_lpVer);
 		unSet($this->m_nWidth);
@@ -402,20 +402,6 @@ class CGIFIMAGEHEADER
 
 	///////////////////////////////////////////////////////////////////////////
 
-	// CONSTRUCTOR
-	function CGIFIMAGEHEADER()
-	{
-		unSet($this->m_nLeft);
-		unSet($this->m_nTop);
-		unSet($this->m_nWidth);
-		unSet($this->m_nHeight);
-		unSet($this->m_bLocalClr);
-		unSet($this->m_bInterlace);
-		unSet($this->m_bSorted);
-		unSet($this->m_nTableSize);
-		unSet($this->m_colorTable);
-	}
-
 	///////////////////////////////////////////////////////////////////////////
 
 	function load($lpData, &$hdrLen)
@@ -473,15 +459,8 @@ class CGIFIMAGE
 
 	///////////////////////////////////////////////////////////////////////////
 
-	function CGIFIMAGE()
+	function __construct()
 	{
-		unSet($this->m_disp);
-		unSet($this->m_bUser);
-		unSet($this->m_bTrans);
-		unSet($this->m_nDelay);
-		unSet($this->m_nTrans);
-		unSet($this->m_lpComm);
-		unSet($this->m_data);
 		$this->m_gih = new CGIFIMAGEHEADER();
 		$this->m_lzw = new CGIFLZW();
 	}
@@ -647,7 +626,7 @@ class CGIF
 	///////////////////////////////////////////////////////////////////////////
 
 	// CONSTRUCTOR
-	function CGIF()
+	function __construct()
 	{
 		$this->m_gfh     = new CGIFFILEHEADER();
 		$this->m_img     = new CGIFIMAGE();
@@ -697,4 +676,4 @@ class CGIF
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-?>
\ No newline at end of file
+?>
diff --git a/include/mpdf/classes/grad.php b/include/mpdf/classes/grad.php
index b5db60204..c43c3e06f 100755
--- a/include/mpdf/classes/grad.php
+++ b/include/mpdf/classes/grad.php
@@ -4,7 +4,7 @@ class grad {
 
 var $mpdf = null;
 
-function grad(&$mpdf) {
+function __construct(&$mpdf) {
 	$this->mpdf = $mpdf;
 }
 
@@ -720,4 +720,4 @@ function parseBackgroundGradient($bg) {
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/include/mpdf/classes/indic.php b/include/mpdf/classes/indic.php
index e747dedef..c99e6eb45 100755
--- a/include/mpdf/classes/indic.php
+++ b/include/mpdf/classes/indic.php
@@ -2,11 +2,6 @@
 
 class indic {
 
-function indic() {
-
-}
-
-
 function substituteIndic($earr, $lang, $font) {
 	global $voltdata;
 
@@ -430,4 +425,4 @@ function substituteIndic($earr, $lang, $font) {
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/include/mpdf/classes/ttfontsuni.php b/include/mpdf/classes/ttfontsuni.php
index f639b005b..70be745a6 100755
--- a/include/mpdf/classes/ttfontsuni.php
+++ b/include/mpdf/classes/ttfontsuni.php
@@ -79,7 +79,7 @@ var $TTCFonts;
 var $maxUniChar;
 var $kerninfo;
 
-	function TTFontFile() {
+	function __construct() {
 		$this->maxStrLenRead = 200000;	// Maximum size of glyf table to read in as string (otherwise reads each glyph from file)
 	}
 
@@ -2062,4 +2062,4 @@ PCLT - not recommended
 }
 
 
-?>
\ No newline at end of file
+?>
diff --git a/include/mpdf/classes/wmf.php b/include/mpdf/classes/wmf.php
index e5f5e3c1b..5182d3397 100755
--- a/include/mpdf/classes/wmf.php
+++ b/include/mpdf/classes/wmf.php
@@ -5,7 +5,7 @@ class wmf {
 var $mpdf = null;
 var $gdiObjectArray;
 
-function wmf(&$mpdf) {
+function __construct(&$mpdf) {
 	$this->mpdf = $mpdf;
 }
 
@@ -233,4 +233,4 @@ function _DeleteGDIObject($idx) {
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/include/mpdf/mpdf.php b/include/mpdf/mpdf.php
index 9c7fe98ad..fa2ff8f15 100755
--- a/include/mpdf/mpdf.php
+++ b/include/mpdf/mpdf.php
@@ -827,7 +827,7 @@ var $innerblocktags;
 // **********************************
 // **********************************
 
-function mPDF($mode='',$format='A4',$default_font_size=0,$default_font='',$mgl=15,$mgr=15,$mgt=16,$mgb=16,$mgh=9,$mgf=9, $orientation='P') {
+function __construct($mode='',$format='A4',$default_font_size=0,$default_font='',$mgl=15,$mgr=15,$mgt=16,$mgb=16,$mgh=9,$mgf=9, $orientation='P') {
 
 /*-- BACKGROUNDS --*/
 		if (!class_exists('grad', false)) { include(_MPDF_PATH.'classes/grad.php'); }
@@ -1431,7 +1431,6 @@ function _getPageFormat($format) {
 			case 'A': {$format=array(314.65,504.57 );	 break;}		//	'A' format paperback size 111x178mm
 			case 'DEMY': {$format=array(382.68,612.28 );  break;}		//	'Demy' format paperback size 135x216mm
 			case 'ROYAL': {$format=array(433.70,663.30 );  break;}	//	'Royal' format paperback size 153x234mm
-			default: $format = false;
 		}
 	return $format;
 }
diff --git a/include/pear/Crypt/AES.php b/include/pear/Crypt/AES.php
index 84de2d9ac..771d87aee 100644
--- a/include/pear/Crypt/AES.php
+++ b/include/pear/Crypt/AES.php
@@ -175,7 +175,7 @@ class Crypt_AES extends Crypt_Rijndael {
      * @return Crypt_AES
      * @access public
      */
-    function Crypt_AES($mode = CRYPT_AES_MODE_CBC)
+    function __construct($mode = CRYPT_AES_MODE_CBC)
     {
         if ( !defined('CRYPT_AES_MODE') ) {
             switch (true) {
@@ -237,7 +237,7 @@ class Crypt_AES extends Crypt_Rijndael {
         }
 
         if (CRYPT_AES_MODE == CRYPT_AES_MODE_INTERNAL) {
-            parent::Crypt_Rijndael($this->mode);
+            parent::__construct($this->mode);
         }
 
     }
diff --git a/include/pear/Crypt/Hash.php b/include/pear/Crypt/Hash.php
index 3b506164e..77bf2b534 100644
--- a/include/pear/Crypt/Hash.php
+++ b/include/pear/Crypt/Hash.php
@@ -143,7 +143,7 @@ class Crypt_Hash {
      * @return Crypt_Hash
      * @access public
      */
-    function Crypt_Hash($hash = 'sha1')
+    function __construct($hash = 'sha1')
     {
         if ( !defined('CRYPT_HASH_MODE') ) {
             switch (true) {
diff --git a/include/pear/Crypt/Rijndael.php b/include/pear/Crypt/Rijndael.php
index a8510007a..e35d96383 100644
--- a/include/pear/Crypt/Rijndael.php
+++ b/include/pear/Crypt/Rijndael.php
@@ -448,7 +448,7 @@ class Crypt_Rijndael {
      * @return Crypt_Rijndael
      * @access public
      */
-    function Crypt_Rijndael($mode = CRYPT_RIJNDAEL_MODE_CBC)
+    function __construct($mode = CRYPT_RIJNDAEL_MODE_CBC)
     {
         switch ($mode) {
             case CRYPT_RIJNDAEL_MODE_ECB:
diff --git a/include/pear/Mail/RFC822.php b/include/pear/Mail/RFC822.php
index abf1000d9..0ad24d7d8 100644
--- a/include/pear/Mail/RFC822.php
+++ b/include/pear/Mail/RFC822.php
@@ -149,7 +149,7 @@ class Mail_RFC822 {
      *
      * @return object Mail_RFC822 A new Mail_RFC822 object.
      */
-    function Mail_RFC822($address = null, $default_domain = null, $nest_groups = null, $validate = null, $limit = null)
+    function __construct($address = null, $default_domain = null, $nest_groups = null, $validate = null, $limit = null)
     {
         if (isset($address))        $this->address        = $address;
         if (isset($default_domain)) $this->default_domain = $default_domain;
diff --git a/include/pear/Mail/mail.php b/include/pear/Mail/mail.php
index a8b4b5dbe..3c79da7f5 100644
--- a/include/pear/Mail/mail.php
+++ b/include/pear/Mail/mail.php
@@ -64,7 +64,7 @@ class Mail_mail extends Mail {
      *
      * @param array $params Extra arguments for the mail() function.
      */
-    function Mail_mail($params = null)
+    function __construct($params = null)
     {
         // The other mail implementations accept parameters as arrays.
         // In the interest of being consistent, explode an array into
diff --git a/include/pear/Mail/mimeDecode.php b/include/pear/Mail/mimeDecode.php
index 29095c960..9b1e208be 100644
--- a/include/pear/Mail/mimeDecode.php
+++ b/include/pear/Mail/mimeDecode.php
@@ -149,7 +149,7 @@ class Mail_mimeDecode extends PEAR
      * @param string The input to decode
      * @access public
      */
-    function Mail_mimeDecode(&$input)
+    function __construct(&$input)
     {
         list($header, $body)   = $this->_splitBodyHeader($input);
 
diff --git a/include/pear/Mail/mock.php b/include/pear/Mail/mock.php
index 61570ba40..a1bf9b803 100644
--- a/include/pear/Mail/mock.php
+++ b/include/pear/Mail/mock.php
@@ -84,7 +84,7 @@ class Mail_mock extends Mail {
      * @param array Hash containing any parameters.
      * @access public
      */
-    function Mail_mock($params)
+    function __construct($params)
     {
         if (isset($params['preSendCallback']) &&
             is_callable($params['preSendCallback'])) {
diff --git a/include/pear/Mail/sendmail.php b/include/pear/Mail/sendmail.php
index b056575e9..77dbe1fe7 100644
--- a/include/pear/Mail/sendmail.php
+++ b/include/pear/Mail/sendmail.php
@@ -56,7 +56,7 @@ class Mail_sendmail extends Mail {
      *              defaults.
      * @access public
      */
-    function Mail_sendmail($params)
+    function __construct($params)
     {
         if (isset($params['sendmail_path'])) {
             $this->sendmail_path = $params['sendmail_path'];
diff --git a/include/pear/Mail/smtp.php b/include/pear/Mail/smtp.php
index 75171891e..877803d95 100644
--- a/include/pear/Mail/smtp.php
+++ b/include/pear/Mail/smtp.php
@@ -188,7 +188,7 @@ class Mail_smtp extends Mail {
      *              defaults.
      * @access public
      */
-    function Mail_smtp($params)
+    function __construct($params)
     {
         if (isset($params['host'])) $this->host = $params['host'];
         if (isset($params['port'])) $this->port = $params['port'];
@@ -346,7 +346,7 @@ class Mail_smtp extends Mail {
         }
 
         include_once 'Net/SMTP.php';
-        $this->_smtp = &new Net_SMTP($this->host,
+        $this->_smtp = new Net_SMTP($this->host,
                                      $this->port,
                                      $this->localhost);
 
diff --git a/include/pear/Math/BigInteger.php b/include/pear/Math/BigInteger.php
index 37acb1fe3..f91c246b1 100644
--- a/include/pear/Math/BigInteger.php
+++ b/include/pear/Math/BigInteger.php
@@ -256,7 +256,7 @@ class Math_BigInteger {
      * @return Math_BigInteger
      * @access public
      */
-    function Math_BigInteger($x = 0, $base = 10)
+    function __construct($x = 0, $base = 10)
     {
         if ( !defined('MATH_BIGINTEGER_MODE') ) {
             switch (true) {
diff --git a/include/pear/PEAR.php b/include/pear/PEAR.php
index 2aa85259d..9708fcd5e 100644
--- a/include/pear/PEAR.php
+++ b/include/pear/PEAR.php
@@ -146,7 +146,7 @@ class PEAR
      * @access public
      * @return void
      */
-    function PEAR($error_class = null)
+    function __construct($error_class = null)
     {
         $classname = strtolower(get_class($this));
         if ($this->_debug) {
@@ -247,7 +247,7 @@ class PEAR
      * @access  public
      * @return  bool    true if parameter is an error
      */
-    function isError($data, $code = null)
+    static function isError($data, $code = null)
     {
         if (!is_a($data, 'PEAR_Error')) {
             return false;
@@ -469,7 +469,7 @@ class PEAR
      * @see PEAR::setErrorHandling
      * @since PHP 4.0.5
      */
-    function &raiseError($message = null,
+    static function &raiseError($message = null,
                          $code = null,
                          $mode = null,
                          $options = null,
@@ -823,7 +823,7 @@ class PEAR_Error
      * @access public
      *
      */
-    function PEAR_Error($message = 'unknown error', $code = null,
+    function __construct($message = 'unknown error', $code = null,
                         $mode = null, $options = null, $userinfo = null)
     {
         if ($mode === null) {
diff --git a/include/pear/PEAR/FixPHP5PEARWarnings.php b/include/pear/PEAR/FixPHP5PEARWarnings.php
index be5dc3ce7..32807c290 100644
--- a/include/pear/PEAR/FixPHP5PEARWarnings.php
+++ b/include/pear/PEAR/FixPHP5PEARWarnings.php
@@ -1,7 +1,7 @@
 <?php
 if ($skipmsg) {
-    $a = &new $ec($code, $mode, $options, $userinfo);
+    $a = new $ec($code, $mode, $options, $userinfo);
 } else {
-    $a = &new $ec($message, $code, $mode, $options, $userinfo);
+    $a = new $ec($message, $code, $mode, $options, $userinfo);
 }
-?>
\ No newline at end of file
+?>
diff --git a/include/staff/system.inc.php b/include/staff/system.inc.php
index 6988261ea..ee70faefb 100644
--- a/include/staff/system.inc.php
+++ b/include/staff/system.inc.php
@@ -41,6 +41,14 @@ $extensions = array(
             'name' => 'fileinfo',
             'desc' => __('Used to detect file types for uploads')
             ),
+        'apcu' => array(
+            'name' => 'APCu',
+            'desc' => __('Improves overall performance')
+            ),
+        'Zend Opcache' => array(
+            'name' => 'Zend Opcache',
+            'desc' => __('Improves overall performance')
+            ),
         );
 
 ?>
diff --git a/include/upgrader/prereq.inc.php b/include/upgrader/prereq.inc.php
index ddb19ee21..7ab7b4c5b 100644
--- a/include/upgrader/prereq.inc.php
+++ b/include/upgrader/prereq.inc.php
@@ -15,7 +15,7 @@ if(!defined('OSTSCPINC') || !$thisstaff || !$thisstaff->isAdmin()) die('Access D
             <?php echo __('These items are necessary in order to run the latest version of osTicket.');?>
             <ul class="progress">
                 <li class="<?php echo $upgrader->check_php()?'yes':'no'; ?>">
-                <?php echo sprintf(__('%s or later'), 'PHP v5.3'); ?> - (<small><b><?php echo PHP_VERSION; ?></b></small>)</li>
+                <?php echo sprintf(__('%s or later'), 'PHP v5.4'); ?> - (<small><b><?php echo PHP_VERSION; ?></b></small>)</li>
                 <li class="<?php echo $upgrader->check_mysql()?'yes':'no'; ?>">
                 <?php echo __('MySQLi extension for PHP'); ?>- (<small><b><?php
                     echo extension_loaded('mysqli')?__('module loaded'):__('missing!'); ?></b></small>)</li>
diff --git a/include/upgrader/streams/core/934954de-f1ccd3bb.task.php b/include/upgrader/streams/core/934954de-f1ccd3bb.task.php
index 041bfad9a..74a4006fd 100644
--- a/include/upgrader/streams/core/934954de-f1ccd3bb.task.php
+++ b/include/upgrader/streams/core/934954de-f1ccd3bb.task.php
@@ -7,7 +7,7 @@ class FileImport extends MigrationTask {
         $i18n = new Internationalization('en_US');
         $files = $i18n->getTemplate('file.yaml')->getData();
         foreach ($files as $f) {
-            if (!($file = AttachmentFile::create($f)))
+            if (!($file = AttachmentFile::createFile($f)))
                 continue;
 
             // Ensure the new files are never deleted (attached to Disk)
diff --git a/open.php b/open.php
index a081c29c9..8359edbf3 100644
--- a/open.php
+++ b/open.php
@@ -39,7 +39,7 @@ if ($_POST) {
     // submitted will be displayed back to the user
     Draft::deleteForNamespace('ticket.client.'.substr(session_id(), -12));
     //Ticket::create...checks for errors..
-    if(($ticket=Ticket::create($vars, $errors, SOURCE))){
+    if(($ticket=Ticket::create2($vars, $errors, SOURCE))){
         $msg=__('Support ticket request created');
         // Drop session-backed form data
         unset($_SESSION[':form-data']);
diff --git a/setup/inc/class.installer.php b/setup/inc/class.installer.php
index 24594ec40..4142f7785 100644
--- a/setup/inc/class.installer.php
+++ b/setup/inc/class.installer.php
@@ -21,7 +21,7 @@ class Installer extends SetupWizard {
 
     var $config;
 
-    function Installer($configfile) {
+    function __construct($configfile) {
         $this->config =$configfile;
         $this->errors=array();
     }
@@ -288,7 +288,7 @@ class Installer extends SetupWizard {
         $errors = array();
         $ticket_vars = $i18n->getTemplate('templates/ticket/installed.yaml')
             ->getData();
-        $ticket = Ticket::create($ticket_vars, $errors, 'api', false, false);
+        $ticket = Ticket::create2($ticket_vars, $errors, 'api', false, false);
 
         if ($ticket
             && ($org = Organization::objects()->order_by('id')->one())
diff --git a/setup/inc/install-prereq.inc.php b/setup/inc/install-prereq.inc.php
index 659b01c0f..bff091f60 100644
--- a/setup/inc/install-prereq.inc.php
+++ b/setup/inc/install-prereq.inc.php
@@ -15,7 +15,7 @@ if(!defined('SETUPINC')) die('Kwaheri!');
             <?php echo __('These items are necessary in order to install and use osTicket.');?>
             <ul class="progress">
                 <li class="<?php echo $installer->check_php()?'yes':'no'; ?>">
-                <?php echo sprintf(__('%s or greater'), '<span class="ltr">PHP v5.3</span>');?> &mdash; <small class="ltr">(<b><?php echo PHP_VERSION; ?></b>)</small></li>
+                <?php echo sprintf(__('%s or greater'), '<span class="ltr">PHP v5.4</span>');?> &mdash; <small class="ltr">(<b><?php echo PHP_VERSION; ?></b>)</small></li>
                 <li class="<?php echo $installer->check_mysql()?'yes':'no'; ?>">
                 <?php echo __('MySQLi extension for PHP');?> &mdash; <small><b><?php
                     echo extension_loaded('mysqli')?__('module loaded'):__('missing!'); ?></b></small></li>
@@ -38,7 +38,9 @@ if(!defined('SETUPINC')) die('Kwaheri!');
                     echo __('recommended for plugins and language packs');?></li>
                 <li class="<?php echo extension_loaded('intl')?'yes':'no'; ?>">Intl <?php echo __('extension');?> &mdash; <?php
                     echo __('recommended for improved localization');?></li>
-                <li class="<?php echo extension_loaded('apc')?'yes':'no'; ?>">APC <?php echo __('extension');?> &mdash; <?php
+                <li class="<?php echo extension_loaded('apcu')?'yes':'no'; ?>">APCu <?php echo __('extension');?> &mdash; <?php
+                    echo __('(faster performance)');?></li>
+                <li class="<?php echo extension_loaded('Zend OPcache')?'yes':'no'; ?>">Zend OPcache <?php echo __('extension');?> &mdash; <?php
                     echo __('(faster performance)');?></li>
             </ul>
             <div id="bar">
-- 
GitLab