Closed bagtim closed 4 years ago
iis 10, php manager from https://www.iis.net/downloads/community/2018/05/php-manager-150-for-iis-10, php install from iis web platform
I think problem near column type varbinary, because after removed 4 auth tables, i create new tables with change column types from binary to varchar for AuthItem->ruleName and AuthRule->data. And then worked is fine. This problem has from version where columns type is varbinary.
Do you store RBAC rules in MSSQL?
Was table created from migrations or https://github.com/yiisoft/yii2/blob/b39bb71587cb4a4964238bdc6e846535588a3cfc/framework/rbac/migrations/schema-mssql.sql?
Do you store RBAC rules in MSSQL?
Yes
Tables created from migrations with "yii migrate --migrationPath=@yii/rbac/migrations"
What was used as the rule name?
What was used as the rule name?
From docs:
class AuthorRule extends Rule
{
public $name = 'isAuthor';
...
and then from topic post:
$rule = new \app\rbac\AuthorRule;
$auth->add($rule);
...
$updateOwnPost->ruleName = $rule->name;
$auth->add($updateOwnPost);
OK. That's enough info to try reproducing it.
I had an analogical problem.
I did following:
1) Change to CONVERT(VARBINARY(MAX), ...) in QueryBuilder::normalizeTableRowData because default length is 30 characters (Link MS SQL Server)
2) For VARBINARY field need add paramert in PDOStatement::bindParam driver_options "PDO::SQLSRV_ENCODING_BINARY"
PDOStatement::bindParam(column, &$var, type,length,PDO::SQLSRV_ENCODING_BINARY);
DbManager
Or not use PDOStatement. Use PDO::exec('insert...')
@toatall since you're into it, would you like to prepare a pull request with a fix?
@samdark OK!
@bagtim would you please check if @toatall solution fixes the issue for you?
Without setted ruleName, permission is good created. But if set ruleName, i have error "unserialize(): Error at offset 0 of 60 bytes"