• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Escaping broke query

#1
hey, right after the escaping update, some queries and models dont work anymore.

1. problem : first query after session is loaded ( DatabaseHandler )

PHP Code:
Services::session()->start();
Database::connect()->query'SELECT A FROM B WHERE C=?', [ '2' ] ); 

2. problem : model stores escaping info twice
PHP Code:
class ExampleEntity extends Entity
{
    protected 
$id;
    protected 
$timestamp;
}
class 
ExampleModel extends Model
{
    protected 
$table         'sessions';
    protected 
$primaryKey        'id';
    protected 
$returnType        '\App\Models\ExampleEntity';
}

$Model  new ExampleModel();
$Entity $Model->find'0' );
$New $Entity === null;
if( 
$New $Entity = new ExampleEntity( ['id' => '0' ] );
Database::connect()->setEscapeFlagstrue );
$Entity->timestamp 0;
if( 
$New $Model->protect(false)->insert$Entityfalse );
else 
$Model->protect(false)->update'0'$Entity ); 

insert & update throw exception

-> my current workaround is to disable escaping at all ( before & after every query )
-> but cant use it in production without escaping -> need to wait for fix
Reply


Messages In This Thread
Escaping broke query - by puschie - 01-30-2019, 12:45 AM
RE: Escaping broke query - by kilishan - 01-30-2019, 07:17 AM
RE: Escaping broke query - by InsiteFX - 01-30-2019, 09:42 AM
RE: Escaping broke query - by puschie - 01-31-2019, 01:33 AM
RE: Escaping broke query - by kilishan - 01-31-2019, 10:36 PM
RE: Escaping broke query - by puschie - 02-01-2019, 02:27 AM
RE: Escaping broke query - by puschie - 02-11-2019, 05:46 AM
RE: Escaping broke query - by puschie - 02-14-2019, 01:45 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.