Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Fatal error: Cannot access protected property Orm\Query::$alias in /var/www/public_html/vb_app.dev/f
  • Hi Everyone,

    Getting a bit stuck here .. it did work before with a prev version ..  not with this version (at least for me )

    Just did a fresh install , oil create vb_app.dev

    Set up my database and set up my auth config files..

    did an oil refine migrate packages=auth

    got this error (some tables were created)

    now when i want to go to /vb_app.dev/admin i get this error ..

    ErrorException [ Fatal Error ]:
    Cannot access protected property Orm\Query::$alias



    PKGPATH/orm/classes/query.php @ line 347

    // line in the query.php
    $select
    [$self->alias.'_c'.$i++] = (strpos($value'.') === false $self->alias.'.' '').$value;

    is there something i do different ? that generates this error?

    thanks!! very much  ..

    gebriel. 

  • Which PHP version are you on?
  • The issue was reported here: https://github.com/fuel/orm/issues/370

    so it looks like it was closed prematurely...
  • Could you post the exact ORM query that causes this error (look higher up in the backtrace)?

    I tried

    $test = \Model\Test::query()->select('id')->where('id', '=', 1)->get_one();

    here, and that runs fine.


  • Nothing in the backtrace only the bootstrap.php returning the shutdown_handler
    php -v gives me version 5.3.10-1ubuntu3.14

    it may be me ..  try to create a new project oil create project
    it stops with :
    No composer autoloader found.. 
    Please run composer to install the FuelPHP framework dependencies first

    so but i can reproduce that... happened a few times with the ormauth setting and oil refine migrate packages=auth and when i make an admin project .. makes the tables but when i go there i get the same error ..

    i will check my system run some updates .. 

    thanks a lot!!
    gabriel



     
  • As of Fuel 1.6 we have moved to packagist instead of using git submodules, which are a major pain.

    oil automatically runs a 'composer install' after the project  is created, but that doesn't work if you don't have composer installed, not sure that it does, I have to check that.

    Anyway, you need to run that to pull in dependencies, like the fuel core and all packages, but also external packages used by the framework.

    I have to assume that went ok, otherwise it would already have complained that the ORM package was missing?
  • this is what happens


    this is when en how to reproduce (at least on my laptop)


    mkdir en cd  .. vb_app.dev


    git clone git://github.com/fuel/fuel.git .

     
    composer update
     oil refine install
     setup a database with phpmyadmin
     username password in the db.php development folder
     oil refine migrate .. nothing to do at this time ..
     oil generate admin project .. some fields
     oil refine migrate ..
     creates projects table

     oil refine migrate packages=auth
    PHP Fatal error: Cannot access protected property Orm\Query::$alias in /var/www/public_html/vilianbouw.dev/fuel/packages/orm/classes/query.php on line 347

    Fatal error: Cannot access protected property Orm\Query::$alias in /var/www/public_html/vilianbouw.dev/fuel/packages/orm/classes/query.php on line 347
    Fatal Error - Cannot access protected property Orm\Query::$alias in PKGPATH/orm/classes/query.php on line 347
    [/var/www/public_html/vilianbouw.dev] my prompt..

    I don't know why ..
    when i now go to vilianbouw.dev/admin get this ..

    ErrorException [ Fatal Error ]:
    Cannot access protected property Orm\Query::$alias



    PKGPATH/orm/classes/query.php @ line 347

    backtrace =

    only bootstrap

    prior contents =

    Fatal error: Cannot access protected property Orm\Query::$alias in /var/www/public_html/vilianbouw.dev/fuel/packages/orm/classes/query.php on line 347

    i can't pass this point .. guess have to set up auth in some other way


    thanks a lot ..  

    gabriel c.

  • Runs fine here, that exact sequence of commands.

    I have to see if I can find a PHP 5.3.x somewhere, my development machine runs 5.6.8.

  • I will try to update my php to 5.5 to see what happens
    will keep posting

    thanks a lot ..

    gabriel c
  • Ok, found an old VM with 5.3.15 installed.

    Same sequence runs fine there too. So I'm clueless.

    If you read http://php.net/manual/en/language.oop5.visibility.php, we're doing nothing strange there, on the contrary, the entire ORM hydration process depends on being allowed access to protected properties of the same or derived class (in this case \Orm\Model).

    You are sure the installed ORM package is the latest 1.7/master? query.php should be 36651 bytes.

    Can you check in your migrations file or migrations table  which Auth migrations have run, so we know which ones are ok, and which one triggers it?

    Are you sure there is no other class present in your installation (in app, it one of your own packages) that defines a class with the same FQN as a model in the Auth package, causing the ORM to autoload the wrong class?
  • Which Auth are you using?

    In your first post you mentioned setting up your auth config, but in your last step-by-step you didn't mention it.

    By default Fuel uses Simpleauth, which doesn't use ORM at all. So perhaps that last list of steps isn't correct/complete?
  • You indeed need to switch to Ormauth, and you also need to add Orm to the config.

    And now I can reproduce it on 5.3.15, so it's something specific < 5.4, because newer versions works fine.
  • I think I found a solution.

    Could you replace your packages/orm/classes/query.php by https://raw.githubusercontent.com/fuel/orm/305414df845ee1a72dd18592e4606934a5d252c4/classes/query.php and let me know if it is fixed now?
  • reinstalled my sytem .. to linux mint
    changed the query.php copied content of the file above .

    i added the orm and auth to the config .. also  .. 


    PHP Fatal error:  Call to undefined method Orm\Query::normalize() in /var/www/html/fuel/packages/orm/classes/query.php on line 341

    Fatal error: Call to undefined method Orm\Query::normalize() in /var/www/html/fuel/packages/orm/classes/query.php on line 341
    Fatal Error - Call to undefined method Orm\Query::normalize() in PKGPATH/orm/classes/query.php on line 341

    very strange i am the only one getting this error ..
    ok  .. will keep posting
    thanks a lot
    gabriel c.

  • This is a different error, caused by a typo in my previous fix, sorry about that. Fixed now.

    I guess there aren't that many people still on PHP 5.3.x. From 5.4 up you didn't have the original error, it was a PHP bug (scope of a closure) that caused the issue, and that bug is fixed in 5.4.
  • no problemo ..

    in the meantime back to ubuntu 14.04
    PHP 5.5.9-1ubuntu4.9

    kind of works fine now  with the new installation  .. 
    could manage to setup a starting project..

    not with oil create but git and than composer update --prefer-stable  .. 
    oil stops with a timeout error .. but this is something different

    thanks for your time and wisdom  .. !! ;-)
    gabriel c

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion