I solved this some time ago by class SwitchableConnection extends \yii\db\Connection
, but it was quite complicated. I like suggested solution in PR - points out nicely the difference static
vs self
, though I am curious about tests. Current failure does not seem related to this PR, but to Generators support in JSON helper #19766.
@yuniorsk I used config that you provided. There is no network.host
.
What's your ../config/main.php
section for databases ?
Attempt to load from filecache if cached file does not exist throws in debug mode error (although supressed).
PHP should detect whether file exists via is_file($path)
rather than via supressed errors @
. Supressed errors still show errors & warnings in debug mode and is generally not preferred way to handle missing files.
| Q | A | ---------------- | --- | Yii version | 2.0.47 | PHP version | 8.0+ | Operating system | Win10
PR - #19773
I tested both with and without cluster autodetection and everything worked OK. I am using latest 2.1.3 yii2-elasticsearch with latest yii2 2.0.47 and ES 8.6.1 on Win10. I added mydsn.com
to my local DNS in ../etc/hosts:
127.0.0.1 localhost mydsn.com
and used connection with default port running local ES:
['http_address' => 'mydsn.com:9200'],
.
It constructed proper URLs e.g. "http://mydsn.com:9200/person/_search"
for both cases autodetectCluster
true and false. Though for autodetectCluster = true
is a bit tricky - authentication must be set, otherwise active node will not be detected. Other than that did not experience any issue.
@Artik-joachim
What's your configuration section in app/config/main.php
?
So it should be:
if ($this->db->dslVersion < 7 && $this->type !== null) {
$url[] = $this->type;
}
Yeah, your subjective view of what's faulty differs from my view. That's normal. Do whatever you do, I don't wanna waste my time arguing.
@rob006 As I wrote above - yes, I could configure dbg to silently ignore those errors. But that's not the point here - the motivation is to fix faulty implementation with faulty assumption. The decision is up to core developers - feel free to close issue or leave open for some time if there would be some related feedback .. whatever you do :-)
@rob006 It's the debugger setting, which overrides PHP environmental settings. I could configure debugger to ignore any error/warning/level, but I don't wanna do that, since I want to catch off all issues in development. Anyway guys - the decision is utterly yours. If you don't wanna change it, feel free to close this issue/PR. I just wanted to point out what I consider faulty implementation from the very beginning. Of course, you may have different view. This is the only place in the framework which throws alike error. Perhaps some inspiration could be taken from other frameworks - Laravel also checks if the file exists before retrieving it - no suppression operator in the code. With Symfony I am not familiar.
Attempt to load from filecache if cached file does not exist throws in debug mode error (although supressed).
PHP should detect that file does not exist simply via is_exists($path)
rather than via supressed errors @
. Supressed errors still show errors & warnings in debugging mode and is not preferred way to handle missing files.
| Q | A | ---------------- | --- | Yii version | 2.0.47 | PHP version | 8.0+ | Operating system | Win10
PR - #19773
| Q | A | ------------- | --- | Is bugfix? | ❌ | New feature? | ❌ | Improvement? | ✔️ | Breaks BC? | ❌
This fixes annoying errors in debug mode when attempting to load from cache non-existing file (filecache only). Adding simple check whether the file exists fixes the issue.
Improve check on loading cached file if the file not found
Change property visibility to allow more flexibility for apps (#19696)
Change property visibility to allow more flexibility for apps
Update framework/web/View.php
Co-authored-by: Alexander Makarov sam@rmcreative.ru
Co-authored-by: Alexander Makarov sam@rmcreative.ru
update rest-authentication.md wiki link (#19698)
Update tutorial-core-validators.md php.net links (#19701)
Fix #15376: Added cache usage for yii2\rbac\DbManager::getRolesByUser()
update tutorial-core-validators.md wiki links (#19702)
Fix #19693: Fix db/Command not caching NULL
result with scalar fetchMode
update tutorial-i18n.md php.net links (#19703)
newline is required for correct rendering (#19707)
update tutorial-performance-tuning.md php.net links (#19708)
Fix #17194: Fix unnecessary SQL updates in the database on attributes typecast via yii\behaviors\AttributeTypecastBehavior
Fix #19635: PHP 8.2 compatibility fix for yii\validators\DateValidator
update helper-array.md php.net links (#19714)
Fix #19712: cast shell_exec() output to string for jsCompressor
update helper-html.md php.net links (#19716)
Bug #18867: Fixed multiple issues with yii\grid\CheckboxColumn
Fix #15376: Added $userId for RBAC roles cache
Add FileHelper test for a negative except, clarify docs (#19723)
Fix sorting link for multisort with default order (#19733)
Add sort tests
Fix link for multisort
changelog
Fix test
Fix #19735: Fix yii\validators\NumberValidator
to use programmable message for the value validation
Fix #19734: PHP 8.1 compatibility fix for $query->orderBy(null)
PHP 8.0.X is OK?
Can you not simply test in your code e.g. if ( !$generator ) { ... }
? This could be a BC with performance impact.
Not enough information to judge. You should show code sending the request, or at least what is $_POST
/ $_GET
content.
Also this might be helpful. Why do you need specifically rawBody
? There are other useful ways to retrieve Request
data.
@MoritzLost
First, I would try out AT
locale, or some other locale which close enough to de
and is complete. Changing/updating ICU contained data is out of Yii2 power, since it's a huge international multipurpose database compiled as an INTL extension. It's really surprising that those keys are missing. I would suggest filling in a bug. It's also very hard to replace INTL data e.g. with partially extracted data (polyfills), which would be very ineffective - slow, incomplete and huge data size. This used to be approach of Yii1. I really have no idea how to fix or prevent this issue .. Perhaps Yii2 developers may have some recommendation.
The reason here is that keys for gram
are missing in ICU for german locale.
Then formatter returns empty message which results in improperly formatted message "{n, plural, }"
- and throws the Exception msgfmt_create: message formatter creation failed: U_DEFAULT_KEYWORD_MISSING
.
This might be ICU issue, but it's strange since DE is commonly used locale. Other less often used langs have those definitions, e.g. SK, CS, HU, .. But for example PL is also missing those keys.
What happens if you try for de
e.g.:
$val = round(5 / 1000, 2);
$result = $formatter->asShortWeight($val);
Still same error?
Any reason why $string
cannot be simply checked inside function ? e.g.
$string = trim($string)
or casted $string = (string) $string