php warning yii base errorexception
Php warning yii base errorexception
В этом разделе помещены уроки по PHP скриптам, которые Вы сможете использовать на своих ресурсах.
Фильтрация данных с помощью zend-filter
Когда речь идёт о безопасности веб-сайта, то фраза «фильтруйте всё, экранируйте всё» всегда будет актуальна. Сегодня поговорим о фильтрации данных.
Контекстное экранирование с помощью zend-escaper
Обеспечение безопасности веб-сайта — это не только защита от SQL инъекций, но и протекция от межсайтового скриптинга (XSS), межсайтовой подделки запросов (CSRF) и от других видов атак. В частности, вам нужно очень осторожно подходить к формированию HTML, CSS и JavaScript кода.
Подключение Zend модулей к Expressive
Expressive 2 поддерживает возможность подключения других ZF компонент по специальной схеме. Не всем нравится данное решение. В этой статье мы расскажем как улучшили процесс подключение нескольких модулей.
Совет: отправка информации в Google Analytics через API
Предположим, что вам необходимо отправить какую-то информацию в Google Analytics из серверного скрипта. Как это сделать. Ответ в этой заметке.
Подборка PHP песочниц
Подборка из нескольких видов PHP песочниц. На некоторых вы в режиме online сможете потестить свой код, но есть так же решения, которые можно внедрить на свой сайт.
Совет: активация отображения всех ошибок в PHP
При поднятии PHP проекта на новом рабочем окружении могут возникнуть ошибки отображение которых изначально скрыто базовыми настройками. Это можно исправить, прописав несколько команд.
Агент
PHP парсер юзер агента с поддержкой Laravel, работающий на базе библиотеки Mobile Detect.
yii\base\ErrorException when apply migrations #35
Comments
tokiaquino commented Jun 22, 2017
What steps will reproduce the problem?
In Configuration Step 3 Apply migrations when do
php yii migrate
What do you get?
PHP Warning ‘yii\base\ErrorException’ with message ‘strncmp() expects parameter 1 to be string, array given’
Stack trace:
#0
#1
#2
#3
#4
#5
#6
#7
#8
#9
#10
#11
#12
Proposed solution
Thats because BaseMigrateController->migrationPath default value is an array, and when we apply the migration String expected
Additional info
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
PHP Warning – yii\base\ErrorException Expected array for frame 0 #11120
Comments
mrsombre commented Mar 15, 2016
Problem with ErrorHandler.
Confirmed for PHP 7.0.4, yii 2.0.7, CLI (\yii\console\Application), YII_DEBUG enabled, xdebug enabled.
Switched to custom ErrorHandler using ErrorException without xdebug related code fixes problem.
Look at \yii\base\ErrorException:45
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
SilverFire commented Mar 15, 2016
I failed to reproduce it in the described way, however I spectate this error in my project on local env sometimes. Usually it happens just after system load and I fix it in non-obvious way like page refresh or disabling/enabling X-Debug listener in PHPStorm. I have no idea why does it happen 🙁
hiqsol commented Mar 16, 2016
I receive this error too. With other code. Console application too.
PHP 7.0 only, PHP 5.6 ok.
cebe commented Mar 16, 2016
I failed to reproduce it in the described way, however I spectate this error in my project on local env sometimes.
Koudy commented Mar 21, 2016
SilverFire commented Mar 21, 2016
quantum13 commented Mar 22, 2016
Php 7.0.0, xdebug enabled:
for web app
in index.php: defined(‘YII_ENV_TEST’) or define(‘YII_ENV_TEST’, true); (to pass in branch with output as string, or use ajax request to get action).
in controller, before class
I didn’t go deeper. Also I didn’t test console commands, but problem the same: converting exception or trace to string.
akaNightmare commented Apr 8, 2016
gbespyatykh commented Apr 22, 2016
Same situation in console and web application on ErrorException
PHP 7.0.5 + xdebug 2.4.1-dev + Yii 2.0.7
wallysalami commented Apr 22, 2016 •
Just to reinforce the problem: we are seeing this PHP Warning: Expected array for frame 0 in the web application sometimes, but only in computers with xdebug enabled.
Edit: just to make sure it is really about xdebug, we disabled it in her machine and the proper warning showed up. So it is confirmed that Yii2’s ErrorException has some problem with xdebug.
«PHP Warning – yii\base\ErrorException filemtime(): stat failed» for all site scripts #17556
Comments
aftaa commented Sep 10, 2019
Firstly, the enviroment:
PHP 7.3 x64
Apache 2.4
Windows 10
In some moment, all the scripts display error:
PHP Warning – yii\base\ErrorException
filemtime(): stat failed for [..]\frontend\runtime/cache\2f\2f33462dc35c2b8886f3905ae3ea3939.bin
in C:\OSPanel\domains\vg\vendor\yiisoft\yii2\caching\FileCache.php line 112
if (@filemtime($cacheFile) > time()) <
I added the @file_exists() check:
if (@file_exists($cacheFile) && @filemtime($cacheFile) > time()) <
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
lubosdz commented Sep 10, 2019 •
Actually supressing errors with @ could be dropped in whole code block:
Simple check whether file exists:
if (file_exists($cacheFile) && filemtime($cacheFile) > time()) <
is better solution IMHO. Supress operator @ not even needed.
aftaa commented Sep 10, 2019 •
is better solution IMHO. Supress operator @ not even needed.
absolutely agree. got carried away by dogs
samdark commented Sep 10, 2019
There are more reasons for failure than non-existing file.
rob006 commented Sep 10, 2019
Simple check whether file exists:
if (file_exists($cacheFile) && filemtime($cacheFile) > time()) <
is better solution IMHO. Supress operator @ not even needed.
If you get such errors, make sure that you don’t have scream enabled.
PHP Compile Warning ‘yii\base\ErrorException’ with message ‘Unterminated comment starting line 1’ #15587
Comments
riyaskp commented Feb 1, 2018
What steps will reproduce the problem?
php yii message config/message.php
What is the expected result?
Console output
`Saving messages to messages/en-US/app/error.php.
Translation saved.
Saving messages to messages/en-US/app.php.
Translation saved.
Saving messages to messages/en-US/messages.php.
Translation saved.
Saving messages to messages/en-US/yii.php.
Translation saved.
Saving messages to messages/ar-SA/app/error.php.
Translation saved.
Saving messages to messages/ar-SA/app.php.
Translation saved.
Saving messages to messages/ar-SA/messages.php.
Translation saved.
Saving messages to messages/ar-SA/yii.php.
Translation saved.`
What do you get instead?
Console output
`Saving messages to messages/en-US/app/error.php.
Translation saved.
Saving messages to messages/en-US/app.php.
Translation saved.
Saving messages to messages/en-US/messages.php.
Translation saved.
Saving messages to messages/en-US/yii.php.
Translation saved.
Saving messages to messages/ar-SA/app/error.php.
Translation saved.
Saving messages to messages/ar-SA/app.php.
Translation saved.
Saving messages to messages/ar-SA/messages.php.
Translation saved.
Saving messages to messages/ar-SA/yii.php.
Translation saved.
PHP Compile Warning ‘yii\base\ErrorException’ with message ‘Unterminated comment starting line 1’
Q | A |
---|---|
Yii version | 2.0.13.1.? |
PHP version | 7.1 |
Operating system | Ubuntu 16.04 |
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
- php warning undefined array key
- php while перейти к следующей итерации