Commit 2cad8fcc by Alexander Makarov

Merge pull request #3517 from klimov-paul/apply-var-dumper-var-export

`VarDumper::export()` applied over framework.
parents 800b18db 1641e057
......@@ -11,6 +11,7 @@ use Yii;
use ReflectionClass;
use yii\base\InvalidConfigException;
use yii\base\Model;
use yii\helpers\VarDumper;
use yii\web\View;
/**
......@@ -496,9 +497,7 @@ abstract class Generator extends Model
if ($this->enableI18N) {
// If there are placeholders, use them
if (!empty($placeholders)) {
$search = ['array (', ')'];
$replace = ['[', ']'];
$ph = ', ' . str_replace($search, $replace, var_export($placeholders, true));
$ph = ', ' . VarDumper::export($placeholders);
} else {
$ph = '';
}
......
......@@ -8,6 +8,7 @@
namespace yii\base;
use Yii;
use yii\helpers\VarDumper;
use yii\web\HttpException;
/**
......@@ -107,7 +108,7 @@ abstract class ErrorHandler extends Component
echo '<pre>' . htmlspecialchars($msg, ENT_QUOTES, Yii::$app->charset) . '</pre>';
}
}
$msg .= "\n\$_SERVER = " . var_export($_SERVER, true);
$msg .= "\n\$_SERVER = " . VarDumper::export($_SERVER);
error_log($msg);
exit(1);
}
......
......@@ -10,6 +10,7 @@ namespace yii\console\controllers;
use Yii;
use yii\console\Exception;
use yii\console\Controller;
use yii\helpers\VarDumper;
/**
* Allows you to combine and compress your JavaScript and CSS files.
......@@ -392,7 +393,7 @@ class AssetController extends Controller
}
}
}
$array = var_export($array, true);
$array = VarDumper::export($array);
$version = date('Y-m-d H:i:s', time());
$bundleFileContent = <<<EOD
<?php
......@@ -573,8 +574,8 @@ EOD;
*/
public function actionTemplate($configFile)
{
$jsCompressor = var_export($this->jsCompressor, true);
$cssCompressor = var_export($this->cssCompressor, true);
$jsCompressor = VarDumper::export($this->jsCompressor);
$cssCompressor = VarDumper::export($this->cssCompressor);
$template = <<<EOD
<?php
......
......@@ -11,6 +11,7 @@ use Yii;
use yii\console\Controller;
use yii\console\Exception;
use yii\helpers\FileHelper;
use yii\helpers\VarDumper;
/**
* Extracts messages to be translated from source files.
......@@ -374,7 +375,7 @@ class MessageController extends Controller
if ($format === 'po') {
$content = $merged;
} else {
$array = str_replace("\r", '', var_export($merged, true));
$array = VarDumper::export($merged);
$content = <<<EOD
<?php
/**
......
......@@ -10,6 +10,7 @@ namespace yii\rbac;
use yii\base\InvalidCallException;
use yii\base\InvalidParamException;
use Yii;
use yii\helpers\VarDumper;
/**
* PhpManager represents an authorization manager that stores authorization
......@@ -703,6 +704,6 @@ class PhpManager extends BaseManager
*/
protected function saveToFile($data, $file)
{
file_put_contents($file, "<?php\nreturn " . var_export($data, true) . ";\n", LOCK_EX);
file_put_contents($file, "<?php\nreturn " . VarDumper::export($data) . ";\n", LOCK_EX);
}
}
......@@ -11,6 +11,7 @@ use Yii;
use yii\base\Exception;
use yii\base\ErrorException;
use yii\base\UserException;
use yii\helpers\VarDumper;
/**
* ErrorHandler handles uncaught PHP errors and exceptions.
......@@ -262,7 +263,7 @@ class ErrorHandler extends \yii\base\ErrorHandler
$request = '';
foreach (['_GET', '_POST', '_SERVER', '_FILES', '_COOKIE', '_SESSION', '_ENV'] as $name) {
if (!empty($GLOBALS[$name])) {
$request .= '$' . $name . ' = ' . var_export($GLOBALS[$name], true) . ";\n\n";
$request .= '$' . $name . ' = ' . VarDumper::export($GLOBALS[$name]) . ";\n\n";
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment