ferrylukito
(Ferrylukito2003)
1
i’m getting error while using str_pad function in my controller
and this happened just when debugging (netbeans)
PHP Fatal Error – yii\base\ErrorException
Uncaught exception 'yii\base\UnknownPropertyException' with message 'Getting unknown property: yii\web\Application::value' in C:\xampp\htdocs\fems\vendor\yiisoft\yii2\base\Component.php:66
Stack trace:
#0 C:\xampp\htdocs\fems\vendor\yiisoft\yii2\base\Module.php(146): yii\base\Component->__get('value')
#1 xdebug://debug-eval(1): yii\base\Module->__get('value')
#2 C:\xampp\htdocs\fems\vendor\yiisoft\yii2\base\Application.php(507): yii\base\Application::handleException()
#3 [internal function]: yii\base\Application->handleException(Object(yii\base\UnknownPropertyException))
#4 {main}
thrown
1. in C:\xampp\htdocs\fems\vendor\yiisoft\yii2\base\Component.php at line 66
6162636465666768697071 }
}
if (method_exists($this, 'set' . $name)) {
throw new InvalidCallException('Getting write-only property: ' . get_class($this) . '::' . $name);
} else {
throw new UnknownPropertyException('Getting unknown property: ' . get_class($this) . '::' . $name);
}
}
/**
* Sets the value of a component property
Please include the code snippet that caused this error.
ferrylukito
(Ferrylukito2003)
3
error happened just while debugging using netbeans-xdebug port 9000
in SiteController
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
'captcha' => [
'class' => 'yii\captcha\CaptchaAction',
'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
],
];
}
public function actionIndex()
{
$number = '5';
$test = str_pad($number, 3, '0', STR_PAD_LEFT);
return $this->render('index', ['test' => $test]);
}
public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
$this->goHome();
}
$model = new LoginForm();
if ($model->load($_POST) && $model->login()) {
return $this->goBack();
} else {
return $this->render('login', [
'model' => $model,
]);
}
}
in view site
<?php
/**
* @var yii\web\View $this
*/
$this->title = 'My Yii Application';
?>
<div class="site-index">
<div class="jumbotron">
<h1>Congratulations!</h1>
<?= $test ?>
<p class="lead">You have successfully created your Yii-powered application.</p>
<p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p>
</div>
amnah
(Jellysandwich5+1)
4
Are you watching any variables in Netbeans/Xdebug? I had some weird errors like that until I cleared my watch list.