2

As answered by @bostaf in the post loading configuration information in to the library;

Unexpected T_VARIABLE is a parse error, 
meaning that code syntax or structure is not valid. 
This error usually occurs because of missing semicolon or bracket
somewhere before it's triggered.

THIS (sic!), I understand implicitly. I have also consulted every test-case listed under the T_VARIABLE primer in PHP Parse/Syntax Errors; and How to solve them? as well as browsed intently through any and all related questions in the sidebar, but I have a feeling it's either so simple I'm just missing it, or there's something else at play. The error message: Message: syntax error, unexpected '$this' (T_VARIABLE) - the source of the error;

     class Upload extends CI_Controller
     {
        function __construct()
        {    
           parent::__construct();
           $this->load->database();
           $this->load->library(array('session','ion_auth'));
           $this->load->helper(array('form', 'url'));    //error line HERE
           $this->load->model('User_profile_model', 'User_profile', TRUE);
        }
    }

THIS coding shouldn't be erroring whatsoever as I have the same opening on several pages of this app (had an unexpected ' function' (T_VARIABLE) before due to the line space between the class declaration and function __construct() line) and none of the stated T_VARIABLE errors exist;

1) Missing semicolon/braces: ALL loaders lines terminate with the required semi-colon (and there are only two brackets for the function __construct()).

2) String concatenation: Not using . anywhere, so that's not an issue.

3) Missing expression operators: No expressions/regexes used, so no issue there.

4) Lists: Using arrays for libraries and helpers, but CI docs say I'm good for that particular formatting, and I've triple-checked this aspect.

5) Class Declarations: No, no...no probs there.

6) Variables after identifiers and 7) Missing parens after language constructs have no play (unless I went blind and missed something COMPLETELY obvious...

I really have no ken of what the actual issue could be as this exact codeblock starts numerous pages, and I've rechecked the ones that do to no effect. Like I said, it's super-clear and I'm missing it, or there may be another factor at play here.

Community
  • 1
  • 1
HomeOffice
  • 139
  • 3
  • 16

2 Answers2

1

Obviously..., if you have code fragments meant to refer to a future event within the db (the posting of an image_path to an empty table column created for the occasion), you're going to error out all over the place - framework cain't be blamed (lol!). I'm going to just honestly resolve this as highly-informed confusion. The problem I'm having isn't actually related to syntactical erroring as much as getting tripped up by coding from another (intertwined) codebank known as Ion Auth. The error actually came from the initialization of the user id ($id or alternatively $user->id), so that original, earlier assessment that I started the post off with was INDEED factually positive. In the user_profile_view page, I had to move a misplaced $user variable declaration to right after the start of the form_open to finally have this error disappear. I thank anyone that took the time to read this and come away with anything.

HomeOffice
  • 139
  • 3
  • 16
0

try

$this->load->model('user_profile_model');

with lowercase

lpz
  • 65
  • 1
  • 8
  • Thanks for your eyes @lpz , but the docs say I'm good for that model loader as is, and I use the same notation throughout my app to no ill effect - just to confirm that, I tried your line. Appreciate your time. – HomeOffice Oct 21 '16 at 20:37