104 Commits

Author SHA1 Message Date
f3eefee572 Fix #20348: ErrorHandler::convertExceptionToError() Passing E_USER_ERROR to trigger_error() is deprecated since PHP 8.4 2025-06-25 15:07:46 +03:00
4b0a02e69c Fix #20147: Fix error handler compatibility with PHP 8.3 (#20228) 2024-07-12 17:48:05 +03:00
52e4a3e645 release version 2.0.50 2024-05-30 20:23:31 +03:00
e2a167028b Upgrade to PSR12 coding standard (#20121) 2024-03-19 17:21:27 +03:00
2141f9abdf Improve performance of handling ErrorHandler::$memoryReserveSize 2023-10-23 20:49:27 +02:00
161526cd41 HTTPS everywhere (#19503) 2022-08-03 12:32:18 +03:00
5c055673a5 Fix #19481: Exception is always empty in ErrorHandler when handling fatal error 2022-07-25 23:34:50 +03:00
6c4d3456b3 Optimize ErrorHandler::handleFatalError() (#19444) 2022-06-21 00:17:35 +03:00
4d0d25d479 Fix #19401: Delay exit(1) in yii\base\ErrorHandler::handleFatalError 2022-06-02 00:13:47 +03:00
c1801c7c61 Fix #19402: Add shutdown event and fix working directory in yii\base\ErrorHandler 2022-06-01 10:38:27 +03:00
4f1ffd2c98 Fix generation of docs on the site (#19353) 2022-04-15 16:49:11 +04:00
a87c02c712 Fix more types (#19333)
* Migration::upsert() returns void

* Unneeded `@property` tags

* Add missing `null` param/return types

* Null types for db\Query + db\ActiveQuery

* Fixed testSelect

* Null types for Validator

* Several more null types

* One more

* Make AccessRule::$allow always a boolean

It doesn't have any special null handling, so it's safe to default to false

* Validator::$skipOnEmpty is always a boolean

* Catch all throwable from Widget::widget()

* Don't limit $previous args to \Exception

The actual \Exception allows $previous to be any throwable in PHP 7+

* Add Throwable catch block to Instance::get()

* Throwable cleanup

Comment changes only.

- Document \Throwable instead of \Exception wherever appropriate
- Removed redundant exception/error classes when \Throwable is referenced

* Yii::setlogger() accepts null

* ArrayHelper::removeValue() can remove any type of value

* Change default $allow value to false
2022-04-03 11:20:21 +02:00
2fe03cd82c Only log the $_SERVER information under YII_DEBUG (#18707)
* Only log the $_SERVER information under YII_DEBUG

Since $_SERVER can contain sensitive information that could leak in CI pipelines ideally it should happen under the YII_DEBUG flag only

* Added upgrade / changelog

* Corrected the upgrade information

* Update framework/UPGRADE.md

Co-authored-by: Alexander Makarov <sam@rmcreative.ru>

Co-authored-by: Bizley <pawel@positive.codes>
Co-authored-by: Alexander Makarov <sam@rmcreative.ru>
2021-07-03 18:55:06 +02:00
ccb14ff667 release version 2.0.39 2020-11-10 13:58:35 +03:00
03da5bb689 Updates to ErrorHandler, add missing type hint \Throwable (#18302)
* Updated phpdoc so it has \Throwable

- `abstract protected function renderException($exception);` is extended in web/ErrorHandler to also have `\Error`.
- `public static function convertExceptionToError($exception)` is called from widgets/ActiveField.php with 
```
/**
     * PHP magic method that returns the string representation of this object.
     * @return string the string representation of this object.
     */
    public function __toString()
    {
        // __toString cannot throw exception
        // use trigger_error to bypass this limitation
        try {
            return $this->render();
        } catch (\Exception $e) {
            ErrorHandler::convertExceptionToError($e);
            return '';
        } catch (\Throwable $e) {
            ErrorHandler::convertExceptionToError($e);
            return '';
        }
    }
```

* Add \Throwable to phpdoc in response.php 

The ErrorHandler has been updated in phpdoc to have throwable, this complets that change.

* Update ErrorHandler.php

fixed missing `|`
2020-09-30 02:34:23 +03:00
38f038175f Adjust changelog, correct phpdoc, minor code style fixes 2020-07-07 15:00:16 +03:00
5c3ee63316 Fix #15202: Add optional param --silent-exit-on-exception in yii\console\Controller 2020-06-23 13:34:09 +03:00
fd6ccb615c release version 2.0.32 2020-01-22 01:29:38 +03:00
Sam
9b1304ab4e Fix #17803: Fixed ErrorHandler unregister and register only change global state when applicable 2020-01-15 00:08:05 +03:00
383cf0c48d Fix #17762: PHP 7.4: Remove special condition for converting PHP errors to exceptions if they occurred inside of __toString() call 2019-12-25 12:25:04 +03:00
1a74b3d4f8 [minor] SCA with Php Inspections (EA Ultimate) (#15871)
* Php Inspections (EA Ultimate): use type casting where applicable

* Php Inspections (EA Ultimate): use constants where applicable

* Php Inspections (EA Ultimate): CS

* Php Inspections (EA Ultimate): address some of one-time used variables

* Php Inspections (EA Ultimate): address some of performance-related findings

* Php Inspections (EA Ultimate): address some of performance-related findings

* Php Inspections (EA Ultimate): revert a constant usage

* Php Inspections (EA Ultimate): revert sequential assignments

* Php Inspections (EA Ultimate): build is green again

* Php Inspections (EA Ultimate): revert array_merge tweaks

* Php Inspections (EA Ultimate): revert BC-incompatible one-time used variable tweak

* Update description [skip ci]

* Php Inspections (EA Ultimate): CS
2018-03-12 01:37:19 +03:00
6b0be47e0f Fixes #14711: Fixed yii\web\ErrorHandler displaying exception message in non-debug mode 2018-01-22 11:41:24 +03:00
5a8c3d537b Enable phpdoc_summary rule in php-cs-fixer config (#14675)
* Enable `phpdoc_summary` rule in php-cs-fixer config.

* Fix case in "PHPDoc".
2017-08-21 11:19:35 +02:00
1501c659ac Add empty lines before return statements. (#14682) [skip ci] 2017-08-21 01:58:49 +03:00
a50d9d8e3e Enable include rule in php-cs-fixer (#14418) 2017-07-10 13:19:57 +03:00
ba0ab403b5 Added php-cs-fixer coding standards validation to Travis CI (#14100)
* php-cs-fixer: PSR2 rule.

* php-cs-fixer: PSR2 rule - fix views.

* Travis setup refactoring.

* Add php-cs-fixer to travis cs tests.

* Fix tests on hhvm-3.12

* improve travis config

* composer update

* revert composer update

* improve travis config

* Fix CS.

* Extract config to separate classes.

* Extract config to separate classes.

* Add file header.

* Force short array syntax.

* binary_operator_spaces fixer

* Fix broken tests

* cast_spaces fixer

* concat_space fixer

* dir_constant fixer

* ereg_to_preg fixer

* function_typehint_space fixer

* hash_to_slash_comment fixer

* is_null fixer

* linebreak_after_opening_tag fixer

* lowercase_cast fixer

* magic_constant_casing fixer

* modernize_types_casting fixer

* native_function_casing fixer

* new_with_braces fixer

* no_alias_functions fixer

* no_blank_lines_after_class_opening fixer

* no_blank_lines_after_phpdoc fixer

* no_empty_comment fixer

* no_empty_phpdoc fixer

* no_empty_statement fixer

* no_extra_consecutive_blank_lines fixer

* no_leading_import_slash fixer

* no_leading_namespace_whitespace fixer

* no_mixed_echo_print fixer

* no_multiline_whitespace_around_double_arrow fixer

* no_multiline_whitespace_before_semicolons fixer

* no_php4_constructor fixer

* no_short_bool_cast fixer

* no_singleline_whitespace_before_semicolons fixer

* no_spaces_around_offset fixer

* no_trailing_comma_in_list_call fixer

* no_trailing_comma_in_singleline_array fixer

* no_unneeded_control_parentheses fixer

* no_unused_imports fixer

* no_useless_return fixer

* no_whitespace_before_comma_in_array fixer

* no_whitespace_in_blank_line fixer

* not_operator_with_successor_space fixer

* object_operator_without_whitespace fixer

* ordered_imports fixer

* php_unit_construct fixer

* php_unit_dedicate_assert fixer

* php_unit_fqcn_annotation fixer

* phpdoc_indent fixer

* phpdoc_no_access fixer

* phpdoc_no_empty_return fixer

* phpdoc_no_package fixer

* phpdoc_no_useless_inheritdoc fixer

* Fix broken tests

* phpdoc_return_self_reference fixer

* phpdoc_single_line_var_spacing fixer

* phpdoc_single_line_var_spacing fixer

* phpdoc_to_comment fixer

* phpdoc_trim fixer

* phpdoc_var_without_name fixer

* psr4 fixer

* self_accessor fixer

* short_scalar_cast fixer

* single_blank_line_before_namespace fixer

* single_quote fixer

* standardize_not_equals fixer

* ternary_operator_spaces fixer

* trailing_comma_in_multiline_array fixer

* trim_array_spaces fixer

* protected_to_private fixer

* unary_operator_spaces fixer

* whitespace_after_comma_in_array fixer

* `parent::setRules()` -> `$this->setRules()`

* blank_line_after_opening_tag fixer

* Update finder config.

* Revert changes for YiiRequirementChecker.

* Fix array formatting.

* Add missing import.

* Fix CS for new code merged from master.

* Fix some indentation issues.
2017-06-12 12:25:45 +03:00
950e895fe0 Fix phpDocumentor annotations (#13905) [skip ci] 2017-04-02 21:49:09 +03:00
ea75068a92 Fixes #13813: Fixed PHP 7 compatibiltiy by adding support for passing instances of Error to the yii\web\Response::setStatusCodeByException() 2017-03-23 01:20:42 +03:00
4aa935e69e Fixes #12055: Changed boolean to bool and integer to int in phpdoc 2016-11-07 02:51:39 +03:00
32f4dc8997 Fixes #5385: links created from classes to corresponding guide articles (#12920) 2016-11-04 18:55:14 +03:00
5308aa1eee Fixes #12619: Added catch Throwable in yii\base\ErrorHandler::handleException() 2016-10-25 21:38:48 +03:00
1b3770fd21 Use === instead of == where possible 2015-10-10 01:04:35 +03:00
a2568d1ec8 updated some comments and @since annotations 2015-08-02 19:56:49 +02:00
6d9fe671de various code style and whitespace adjustments 2015-08-02 00:27:19 +02:00
8ced2ba96a Fixes #8933: Yii is now able to properly handle HHVM fatal errors 2015-07-28 10:32:52 +03:00
b9916b1718 log the whole exception object to allow log targets to work with it
fixes #6354
made possible by #7305
2015-05-16 00:32:01 +02:00
8f1811919f ensure error will always result in a failing HTTP status code
fixes #8326
proper fix for #7571 which did not work in all situations
2015-05-08 22:38:49 +02:00
b6a591c720 Fixes #7571: HTTP status 500 and "An internal server error occurred." are now returned in case there was an exception in layout and YII_DEBUG is false 2015-03-06 20:10:54 +03:00
2aace3714c minor adjustments 2015-03-01 01:24:28 +01:00
2ba573bfb5 Fixes #6883: yii\base\ErrorHandler::logException() is now public 2015-02-08 18:36:55 +03:00
ab0033542b Fixes #6247: Logger and error handler are now using slightly less memory 2014-12-17 00:39:54 +03:00
9061874bdb Fixes #5646: Call yii\base\ErrorHandler::unregister() instead of restore_*_handlers directly 2014-10-19 14:48:11 +04:00
6709154792 yii\base\ErrorHandler::handleError() adjusted keeping native error processing on error reporting miss match. 2014-08-19 12:42:41 +03:00
0087339a42 log fatal errors to yii logs. 2014-06-19 15:35:04 -04:00
1641e057a9 VarDumper::export() applied over framework. 2014-05-20 16:35:12 +03:00
32aa175b7c renamed ErrorHandler::deRegister to unregister. [skip ci] 2014-05-11 20:47:27 -04:00
2e6e318720 added ErrorHandler::deRegister() 2014-05-11 21:18:34 +02:00
c15aceb094 Refactored filter error display for GridView. 2014-04-22 20:46:23 -04:00
c1445871f4 Correction of many errors code inspection.
Adjustments code according to the standards.
Adding missing PHPDoc comment.
2014-04-16 19:29:07 -03:00
a64429acf3 removed TODOs 2014-03-30 12:01:08 +02:00