javed_ali
(Jak Abbassi)
October 21, 2011, 2:31pm
1
In user management module of yii when i assign permission to user it produces following error but it work well when i’m assigning permission to any role any one can help…
public static function encode($text)
{
return htmlspecialchars($text,ENT_QUOTES,Yii::app()->charset);
}
mdomba
(Maurizio Domba Cerin)
October 21, 2011, 9:07pm
2
Hi and welcome to the forum
your question is not at all clear
If you want to get help you need to explain better your problem… in other words… you need to help us understand your problem so that we can help you.
You mention "folowing error" but did not write the error…
what is the user managment model of yii? any link?
you have problem with assigning permission but the code you provided is just used for encoding…
javed_ali
(Jak Abbassi)
October 24, 2011, 12:27pm
3
Hi this is the error but it is somewhere in helper class (C:\wamp\www\yii\framework\web\helpers\CHtml.php(66))
htmlspecialchars() expects parameter 1 to be string, object given and this is the function
public static function encode($text)
{
return htmlspecialchars($text,ENT_QUOTES,Yii::app()->charset);
}
it happens with user management in user management module of yii…
and this is name of that module easily downloadable(yii-user-management_0.8rc5)
from code.google.com/p/yii-user-management/downloads/list
or do you have any suggestion for implementing role based access control for
user’s in yii…
mdomba
(Maurizio Domba Cerin)
October 24, 2011, 12:43pm
4
I know the model is easily downloadable… but I don’t need it and don’t have time for that…
The problem is in the parameter that is sent to the encode function… so it’s completely useless to post the encode function source…
you need to check where this function is called… and what value is sent to it.
jessyu12
(Jessyu12)
May 24, 2012, 1:29pm
5
mdomba:
Hi this is the error but it is somewhere in helper class (C:\wamp\www\yii\framework\web\helpers\CHtml.php(66))
htmlspecialchars() expects parameter 1 to be string, object given and this is the function
public static function encode($text)
{
return htmlspecialchars($text,ENT_QUOTES,Yii::app()->charset);
}
it happens with user management in user management module of yii…
It happened to me also. It seems the error is in /modules/role/views/role/admin.php because the error message shows up when I go to
role/views/permission/admin page.
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'columns'=>array(
array(
'name' => 'title',
'type' => 'raw',
'value'=> 'CHtml::link(CHtml::encode($data->title),
array(Yum::route("role/view"),"id"=>$data->id))',
),
//'autoassign',
'is_membership_possible',
array(
'class'=>'CButtonColumn',
),
),
));
CHtml::encode function was used, and $data->title needs to be a string, but $data->title seem to be an object.
Why $data->title returns an object?