Answer the question
In order to leave comments, you need to log in
Why is the Debugger outputting the object as a serialized string?
When I do this Yii::info($someobject),
I get something like this in the debugger log:
unserialize('O:36:"backend\\models\\PriceFileColumnsOrder":9:{s:44:"' . "\0" . 'backend\\models\\PriceFileColumnsOrder' . "\0" . '_items";a:0:{}s:36:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_attributes";a:1:{s:2:"id";i:9;}s:39:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_oldAttributes";a:1:{s:2:"id";i:9;}s:33:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_related";a:1:{s:26:"priceFileColumnsOrderItems";a:5:{i:0;O:40:"backend\\models\\PriceFileColumnsOrderItem":8:{s:36:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_attributes";a:5:{s:2:"id";i:9;s:4:"type";i:-1;s:7:"default";N;s:3:"num";i:0;s:27:"price_file_columns_order_id";i:9;}s:39:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_oldAttributes";a:5:{s:2:"id";i:9;s:4:"type";i:-1;s:7:"default";N;s:3:"num";i:0;s:27:"price_file_columns_order_id";i:9;}s:33:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_related";a:0:{}s:23:"' . "\0" . 'yii\\base\\Model' . "\0" . '_errors";N;s:27:"' . "\0" . 'yii\\base\\Model' . "\0" . '_validators";N;s:25:"' . "\0" . 'yii\\base\\Model' . "\0" . '_scenario";s:7:"default";s:27:"' . "\0" . 'yii\\base\\Component' . "\0" . '_events";a:0:{}s:30:"' . "\0" . 'yii\\base\\Component' . "\0" . '_behaviors";a:0:{}}i:1;O:40:"backend\\models\\PriceFileColumnsOrderItem":8:{s:36:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_attributes";a:5:{s:2:"id";i:10;s:4:"type";i:8;s:7:"default";N;s:3:"num";i:1;s:27:"price_file_columns_order_id";i:9;}s:39:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_oldAttributes";a:5:{s:2:"id";i:10;s:4:"type";i:8;s:7:"default";N;s:3:"num";i:1;s:27:"price_file_columns_order_id";i:9;}s:33:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_related";a:0:{}s:23:"' . "\0" . 'yii\\base\\Model' . "\0" . '_errors";N;s:27:"' . "\0" . 'yii\\base\\Model' . "\0" . '_validators";N;s:25:"' . "\0" . 'yii\\base\\Model' . "\0" . '_scenario";s:7:"default";s:27:"' . "\0" . 'yii\\base\\Component' . "\0" . '_events";a:0:{}s:30:"' . "\0" . 'yii\\base\\Component' . "\0" . '_behaviors";a:0:{}}i:2;O:40:"backend\\models\\PriceFileColumnsOrderItem":8:{s:36:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_attributes";a:5:{s:2:"id";i:11;s:4:"type";i:6;s:7:"default";N;s:3:"num";i:2;s:27:"price_file_columns_order_id";i:9;}s:39:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_oldAttributes";a:5:{s:2:"id";i:11;s:4:"type";i:6;s:7:"default";N;s:3:"num";i:2;s:27:"price_file_columns_order_id";i:9;}s:33:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_related";a:0:{}s:23:"' . "\0" . 'yii\\base\\Model' . "\0" . '_errors";N;s:27:"' . "\0" . 'yii\\base\\Model' . "\0" . '_validators";N;s:25:"' . "\0" . 'yii\\base\\Model' . "\0" . '_scenario";s:7:"default";s:27:"' . "\0" . 'yii\\base\\Component' . "\0" . '_events";a:0:{}s:30:"' . "\0" . 'yii\\base\\Component' . "\0" . '_behaviors";a:0:{}}i:3;O:40:"backend\\models\\PriceFileColumnsOrderItem":8:{s:36:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_attributes";a:5:{s:2:"id";i:12;s:4:"type";i:1;s:7:"default";N;s:3:"num";i:3;s:27:"price_file_columns_order_id";i:9;}s:39:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_oldAttributes";a:5:{s:2:"id";i:12;s:4:"type";i:1;s:7:"default";N;s:3:"num";i:3;s:27:"price_file_columns_order_id";i:9;}s:33:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_related";a:0:{}s:23:"' . "\0" . 'yii\\base\\Model' . "\0" . '_errors";N;s:27:"' . "\0" . 'yii\\base\\Model' . "\0" . '_validators";N;s:25:"' . "\0" . 'yii\\base\\Model' . "\0" . '_scenario";s:7:"default";s:27:"' . "\0" . 'yii\\base\\Component' . "\0" . '_events";a:0:{}s:30:"' . "\0" . 'yii\\base\\Component' . "\0" . '_behaviors";a:0:{}}i:4;O:40:"backend\\models\\PriceFileColumnsOrderItem":8:{s:36:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_attributes";a:5:{s:2:"id";i:13;s:4:"type";i:2;s:7:"default";N;s:3:"num";i:4;s:27:"price_file_columns_order_id";i:9;}s:39:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_oldAttributes";a:5:{s:2:"id";i:13;s:4:"type";i:2;s:7:"default";N;s:3:"num";i:4;s:27:"price_file_columns_order_id";i:9;}s:33:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_related";a:0:{}s:23:"' . "\0" . 'yii\\base\\Model' . "\0" . '_errors";N;s:27:"' . "\0" . 'yii\\base\\Model' . "\0" . '_validators";N;s:25:"' . "\0" . 'yii\\base\\Model' . "\0" . '_scenario";s:7:"default";s:27:"' . "\0" . 'yii\\base\\Component' . "\0" . '_events";a:0:{}s:30:"' . "\0" . 'yii\\base\\Component' . "\0" . '_behaviors";a:0:{}}}}s:23:"' . "\0" . 'yii\\base\\Model' . "\0" . '_errors";N;s:27:"' . "\0" . 'yii\\base\\Model' . "\0" . '_validators";N;s:25:"' . "\0" . 'yii\\base\\Model' . "\0" . '_scenario";s:7:"default";s:27:"' . "\0" . 'yii\\base\\Component' . "\0" . '_events";a:0:{}s:30:"' . "\0" . 'yii\\base\\Component' . "\0" . '_behaviors";a:0:{}}')
Answer the question
In order to leave comments, you need to log in
Serialize the object in advance in the desired beautiful format.
The logger in Yii is terrible: there is a violation of all possible OOP principles due to embedding the logger in BaseYii, and non-compliance with PSR-3, and bicycle building, and the lack of the ability to pass the context.
Yii developer Tian said he thinks his framework's users are too dumb to use a PSR-3 compliant logger: https://github.com/yiisoft/yii2/issues/1660
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question