fuel / orm

Fuel PHP Framework - Fuel v1.x ORM
http://fuelphp.com/docs/packages/orm/intro.html
151 stars 95 forks source link

php 7.4 bag #428

Closed hotlabs closed 3 years ago

hotlabs commented 4 years ago

$isnull = $isnull and is_null($record[$pk]); - not work on php 7.4.5 replase to $isnull = ($isnull and is_null($record[$pk]));

WanWizard commented 4 years ago

We're still on 7.3.16 for our development.

Fuel is littered with statements like that, does it produce a hard error, or is it a logic error? Any suggestion on how to find all these?

hotlabs commented 4 years ago

multiple $_primary_key = array('genre_id','locale'); - not work php 7.4 $result = true and false;
var_dump($result); //bool(true) $result = (true and false); var_dump($result); //bool(false) i think this is a syntax error in 7.4

WanWizard commented 4 years ago

These kinds of soft or logic errors are not easy to find, and will require a lot of work.

So for now, don't use PHP 7.4.

WanWizard commented 4 years ago

What do you mean with:

multiple $_primary_key = array('genre_id','locale'); - not work

hotlabs commented 4 years ago

Im have this models

class Model_Genre extends \Orm\Model { protected static $_properties = array( "id", "views", "published", "created_at", "updated_at" ); protected static $_observers = array( 'Orm\Observer_CreatedAt' => [ 'events' => ['before_insert'], 'mysql_timestamp' => false, ], 'Orm\Observer_UpdatedAt' => [ 'events' => ['before_save'], 'mysql_timestamp' => false, ] ); protected static $_table_name = 'genres'; protected static $_primary_key = array('id');

protected static $_has_one = array( 'translation' => array( 'key_from' => 'id', 'model_to' => 'Model_Genre_Translation', 'key_to' => 'genre_id', ) ); }

class Model_Genre_Translation extends \Orm\Model { protected static $_properties = array( "genre_id", "locale", "title", "slug", "description", "seo_title", "seo_description", "seo_keywords", ); protected static $_table_name = 'genre_translations'; protected static $_primary_key = array('genre_id','locale'); protected static $block_set_pks = false; }

and i get data

$genre = Model_Genre::find('first', array(
    'related' => array(
        'translation' => array(
            'where' => array(
                array('lang', '=', 'en'),
            ),
        ),
    ),
));

SQL query build correctly but $genre not have - 'translation' im test php 5.6 - 7.4 - not work this is when using 2 primary keys

hotlabs commented 4 years ago

even that doesn't work $genre_translation = Model_Genre_Translation::find('all', array( 'where' => array( array('genre_id', 1), array('locale', 'en'), ), ));

WanWizard commented 4 years ago

Can you verify if the latest ORM fixes address your issue?

AdamSGit commented 4 years ago

We run Fuel in production with latest 7.4 for months, doesn't seem to have any issue that I noticed.

WanWizard commented 4 years ago

We do too.

Currently running part of the development on 8.0beta, which is really going to be lots of fun given the isssues we've seen sofar.

WanWizard commented 3 years ago

We now run apps in production on PHP 8, using 1.9/dev, without issues.

Closed due to lack of feedback.

AdamSGit commented 3 years ago

Good to hear 😃