Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[2.2][Process] Fix Array to string conversion exception #7354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a59e5e4
[Finder] Unified tests
gajdaw Aug 1, 2012
a4ec677
[DomCrawler] Fix relative path handling in links
lazyhammer Mar 2, 2013
73bead7
[ClassLoader] made DebugClassLoader idempotent
kriswallsmith Mar 2, 2013
bb08247
[ClassLoader] tweaked test
kriswallsmith Mar 3, 2013
41ad9d8
[Routing] make xml loader more tolerant
Tobion Mar 5, 2013
54c333d
[Routing] unify and fix the loader tests
Tobion Mar 5, 2013
b9cdb9a
[HttpKernel] Fixed possible profiler token collision (closes #7272, c…
fabpot Mar 6, 2013
1d3da29
[FrameworkBundle] avoids cache:clear to break if new/old folders alre…
jfsimon Mar 4, 2013
82f6389
merged branch jfsimon/issue-6502 (PR #7260)
fabpot Mar 6, 2013
f9d683e
merged branch lazyhammer/crawler-relative-links-2.1 (PR #7244)
fabpot Mar 6, 2013
a31deeb
Update RouteCompiler.php
sualko Mar 5, 2013
7241be9
[Finder] fixed a potential issue on Solaris where INF value is wrong …
fabpot Mar 6, 2013
fea27c1
merged branch Tobion/scheme-method-def-tolerance (PR #7268)
fabpot Mar 6, 2013
3263fe1
merged branch gajdaw/finder_unified_tests (PR #7197)
fabpot Mar 6, 2013
523ef29
Fix warning for buildXml method
Mar 5, 2013
9544405
merged branch fabpot/moved_serializer_4 (PR #7292)
fabpot Mar 6, 2013
5361f83
[FramworkBundle] fix phpdoc of commands
Tobion Mar 7, 2013
d16d193
[FramworkBundle] removed unused property of trans update command
Tobion Mar 7, 2013
95af84c
Fixed test to use Reflection
merk Mar 8, 2013
27cc0df
Merge pull request #1 from merk/class-loader/idempotent
kriswallsmith Mar 8, 2013
ee495f8
merged branch kriswallsmith/class-loader/idempotent (PR #7245)
fabpot Mar 8, 2013
15bf033
[FrameworkBundle] fix router debug command
Tobion Mar 8, 2013
62f3d2a
merged branch Tobion/debug-command (PR #7301)
fabpot Mar 8, 2013
f5dc03d
fix xargs pipe to work with spaces in dir names
havvg Mar 8, 2013
b7a85e0
merged branch havvg/hotfix/finder-spaces-in-dir (PR #7302)
fabpot Mar 8, 2013
547350c
[FrameworkBundle] Fix code status in dockblock
franmomu Mar 9, 2013
a27f7d8
merged branch franmomu/patch-1 (PR #7317)
fabpot Mar 10, 2013
a735cbd
fix xargs pipe to work with spaces in dir names
havvg Mar 8, 2013
7c66dff
Merge branch '2.1' into 2.2
fabpot Mar 11, 2013
e795683
merged branch havvg/hotfix/finder-spaces-in-dir (PR #7327)
fabpot Mar 11, 2013
4f3771d
[2.2][HttpKernel] fixed wrong option name in FragmentHandler::fixOptions
aitboudad Mar 10, 2013
6c1e86c
merged branch Aitboudad/ticket_7309 (PR #7321)
fabpot Mar 11, 2013
663c796
Property accessor custom array object fix
cystbear Mar 10, 2013
26a7222
merged branch cystbear/PropertyAccessor-CustomArrayObject-Fix (PR #7320)
fabpot Mar 11, 2013
cf29581
Update SecurityDataCollector.php
janschoenherr Mar 8, 2013
639c30c
fixed id case when setting a service (also slightly enhanced an error…
fabpot Mar 11, 2013
02da7da
merged branch fabpot/deic-fix (PR #7333)
fabpot Mar 11, 2013
080cec5
Fix array to string conversion exception
Mar 12, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\Finder\Finder;

/**
Expand All @@ -26,7 +25,7 @@
class AssetsInstallCommand extends ContainerAwareCommand
{
/**
* @see Command
* {@inheritdoc}
*/
protected function configure()
{
Expand Down Expand Up @@ -62,9 +61,9 @@ protected function configure()
}

/**
* @see Command
* {@inheritdoc}
*
* @throws \InvalidArgumentException When the target directory does not exist
* @throws \InvalidArgumentException When the target directory does not exist or symlink cannot be used
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
19 changes: 14 additions & 5 deletions src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CacheClearCommand extends ContainerAwareCommand
protected $name;

/**
* @see Command
* {@inheritdoc}
*/
protected function configure()
{
Expand Down Expand Up @@ -62,23 +62,32 @@ protected function execute(InputInterface $input, OutputInterface $output)
throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $realCacheDir));
}

$filesystem = $this->getContainer()->get('filesystem');
$kernel = $this->getContainer()->get('kernel');
$output->writeln(sprintf('Clearing the cache for the <info>%s</info> environment with debug <info>%s</info>', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));

$this->getContainer()->get('cache_clearer')->clear($realCacheDir);

if ($filesystem->exists($oldCacheDir)) {
$filesystem->remove($oldCacheDir);
}

if ($input->getOption('no-warmup')) {
rename($realCacheDir, $oldCacheDir);
$filesystem->rename($realCacheDir, $oldCacheDir);
} else {
$warmupDir = $realCacheDir.'_new';

if ($filesystem->exists($warmupDir)) {
$filesystem->remove($warmupDir);
}

$this->warmup($warmupDir, !$input->getOption('no-optional-warmers'));

rename($realCacheDir, $oldCacheDir);
rename($warmupDir, $realCacheDir);
$filesystem->rename($realCacheDir, $oldCacheDir);
$filesystem->rename($warmupDir, $realCacheDir);
}

$this->getContainer()->get('filesystem')->remove($oldCacheDir);
$filesystem->remove($oldCacheDir);
}

protected function warmup($warmupDir, $enableOptionalWarmers = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
class CacheWarmupCommand extends ContainerAwareCommand
{
/**
* @see Command
* {@inheritdoc}
*/
protected function configure()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class ConfigDumpReferenceCommand extends ContainerDebugCommand
{
/**
* @see Command
* {@inheritdoc}
*/
protected function configure()
{
Expand Down Expand Up @@ -53,7 +53,9 @@ protected function configure()
}

/**
* @see Command
* {@inheritdoc}
*
* @throws \LogicException
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
abstract class ContainerAwareCommand extends Command implements ContainerAwareInterface
{
/**
* @var ContainerInterface
* @var ContainerInterface|null
*/
private $container;

Expand All @@ -40,7 +40,7 @@ protected function getContainer()
}

/**
* @see ContainerAwareInterface::setContainer()
* {@inheritdoc}
*/
public function setContainer(ContainerInterface $container = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
class ContainerDebugCommand extends ContainerAwareCommand
{
/**
* @var ContainerBuilder
* @var ContainerBuilder|null
*/
protected $containerBuilder;

/**
* @see Command
* {@inheritdoc}
*/
protected function configure()
{
Expand Down Expand Up @@ -74,7 +74,9 @@ protected function configure()
}

/**
* @see Command
* {@inheritdoc}
*
* @throws \LogicException
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -307,7 +309,7 @@ protected function getContainerBuilder()
*
* @param string $serviceId The service id to resolve
*
* @return \Symfony\Component\DependencyInjection\Definition|\Symfony\Component\DependencyInjection\Alias
* @return Definition|Alias
*/
protected function resolveServiceDefinition($serviceId)
{
Expand All @@ -328,7 +330,7 @@ protected function resolveServiceDefinition($serviceId)
* Renders list of tagged services grouped by tag
*
* @param OutputInterface $output
* @param bool $showPrivate
* @param Boolean $showPrivate
*/
protected function outputTags(OutputInterface $output, $showPrivate = false)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class RouterApacheDumperCommand extends ContainerAwareCommand
{
/**
* {@inheritDoc}
* {@inheritdoc}
*/
public function isEnabled()
{
Expand All @@ -42,7 +42,7 @@ public function isEnabled()
}

/**
* @see Command
* {@inheritdoc}
*/
protected function configure()
{
Expand All @@ -65,7 +65,7 @@ protected function configure()
}

/**
* @see Command
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
114 changes: 65 additions & 49 deletions src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
* A console command for retrieving information about routes
*
* @author Fabien Potencier <[email protected]>
* @author Tobias Schultze <http://tobion.de>
*/
class RouterDebugCommand extends ContainerAwareCommand
{
/**
* {@inheritDoc}
* {@inheritdoc}
*/
public function isEnabled()
{
Expand All @@ -40,7 +41,7 @@ public function isEnabled()
}

/**
* @see Command
* {@inheritdoc}
*/
protected function configure()
{
Expand All @@ -60,7 +61,9 @@ protected function configure()
}

/**
* @see Command
* {@inheritdoc}
*
* @throws \InvalidArgumentException When route does not exist
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand All @@ -83,34 +86,28 @@ protected function outputRoutes(OutputInterface $output, $routes = null)

$maxName = strlen('name');
$maxMethod = strlen('method');
$maxScheme = strlen('scheme');
$maxHost = strlen('host');

foreach ($routes as $name => $route) {
$requirements = $route->getRequirements();
$method = isset($requirements['_method'])
? strtoupper(is_array($requirements['_method'])
? implode(', ', $requirements['_method']) : $requirements['_method']
)
: 'ANY';
$method = $route->getMethods() ? implode('|', $route->getMethods()) : 'ANY';
$scheme = $route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY';
$host = '' !== $route->getHost() ? $route->getHost() : 'ANY';
$maxName = max($maxName, strlen($name));
$maxMethod = max($maxMethod, strlen($method));
$maxScheme = max($maxScheme, strlen($scheme));
$maxHost = max($maxHost, strlen($host));
}
$format = '%-'.$maxName.'s %-'.$maxMethod.'s %-'.$maxHost.'s %s';

// displays the generated routes
$format1 = '%-'.($maxName + 19).'s %-'.($maxMethod + 19).'s %-'.($maxHost + 19).'s %s';
$output->writeln(sprintf($format1, '<comment>Name</comment>', '<comment>Method</comment>', '<comment>Host</comment>', '<comment>Pattern</comment>'));
$format = '%-'.$maxName.'s %-'.$maxMethod.'s %-'.$maxScheme.'s %-'.$maxHost.'s %s';
$formatHeader = '%-'.($maxName + 19).'s %-'.($maxMethod + 19).'s %-'.($maxScheme + 19).'s %-'.($maxHost + 19).'s %s';
$output->writeln(sprintf($formatHeader, '<comment>Name</comment>', '<comment>Method</comment>', '<comment>Scheme</comment>', '<comment>Host</comment>', '<comment>Path</comment>'));

foreach ($routes as $name => $route) {
$requirements = $route->getRequirements();
$method = isset($requirements['_method'])
? strtoupper(is_array($requirements['_method'])
? implode(', ', $requirements['_method']) : $requirements['_method']
)
: 'ANY';
$method = $route->getMethods() ? implode('|', $route->getMethods()) : 'ANY';
$scheme = $route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY';
$host = '' !== $route->getHost() ? $route->getHost() : 'ANY';
$output->writeln(sprintf($format, $name, $method, $host, $route->getPath()));
$output->writeln(sprintf($format, $name, $method, $scheme, $host, $route->getPath()), OutputInterface::OUTPUT_RAW);
}
}

Expand All @@ -124,41 +121,49 @@ protected function outputRoute(OutputInterface $output, $name)
throw new \InvalidArgumentException(sprintf('The route "%s" does not exist.', $name));
}

$output->writeln($this->getHelper('formatter')->formatSection('router', sprintf('Route "%s"', $name)));

$method = $route->getMethods() ? implode('|', $route->getMethods()) : 'ANY';
$scheme = $route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY';
$host = '' !== $route->getHost() ? $route->getHost() : 'ANY';

$output->writeln($this->getHelper('formatter')->formatSection('router', sprintf('Route "%s"', $name)));
$output->write('<comment>Name</comment> ');
$output->writeln($name, OutputInterface::OUTPUT_RAW);

$output->writeln(sprintf('<comment>Name</comment> %s', $name));
$output->writeln(sprintf('<comment>Pattern</comment> %s', $route->getPath()));
$output->writeln(sprintf('<comment>Host</comment> %s', $host));
$output->writeln(sprintf('<comment>Class</comment> %s', get_class($route)));
$output->write('<comment>Path</comment> ');
$output->writeln($route->getPath(), OutputInterface::OUTPUT_RAW);

$defaults = '';
$d = $route->getDefaults();
ksort($d);
foreach ($d as $name => $value) {
$defaults .= ($defaults ? "\n".str_repeat(' ', 13) : '').$name.': '.$this->formatValue($value);
}
$output->writeln(sprintf('<comment>Defaults</comment> %s', $defaults));
$output->write('<comment>Host</comment> ');
$output->writeln($host, OutputInterface::OUTPUT_RAW);

$requirements = '';
$r = $route->getRequirements();
ksort($r);
foreach ($r as $name => $value) {
$requirements .= ($requirements ? "\n".str_repeat(' ', 13) : '').$name.': '.$this->formatValue($value);
}
$requirements = '' !== $requirements ? $requirements : 'NONE';
$output->writeln(sprintf('<comment>Requirements</comment> %s', $requirements));

$options = '';
$o = $route->getOptions();
ksort($o);
foreach ($o as $name => $value) {
$options .= ($options ? "\n".str_repeat(' ', 13) : '').$name.': '.$this->formatValue($value);
$output->write('<comment>Scheme</comment> ');
$output->writeln($scheme, OutputInterface::OUTPUT_RAW);

$output->write('<comment>Method</comment> ');
$output->writeln($method, OutputInterface::OUTPUT_RAW);

$output->write('<comment>Class</comment> ');
$output->writeln(get_class($route), OutputInterface::OUTPUT_RAW);

$output->write('<comment>Defaults</comment> ');
$output->writeln($this->formatConfigs($route->getDefaults()), OutputInterface::OUTPUT_RAW);

$output->write('<comment>Requirements</comment> ');
// we do not want to show the schemes and methods again that are also in the requirements for BC
$requirements = $route->getRequirements();
unset($requirements['_scheme'], $requirements['_method']);
$output->writeln($this->formatConfigs($requirements) ?: 'NO CUSTOM', OutputInterface::OUTPUT_RAW);

$output->write('<comment>Options</comment> ');
$output->writeln($this->formatConfigs($route->getOptions()), OutputInterface::OUTPUT_RAW);

$output->write('<comment>Path-Regex</comment> ');
$output->writeln($route->compile()->getRegex(), OutputInterface::OUTPUT_RAW);

if (null !== $route->compile()->getHostRegex()) {
$output->write('<comment>Host-Regex</comment> ');
$output->writeln($route->compile()->getHostRegex(), OutputInterface::OUTPUT_RAW);
}
$output->writeln(sprintf('<comment>Options</comment> %s', $options));
$output->write('<comment>Regex</comment> ');
$output->writeln(preg_replace('/^ /', '', preg_replace('/^/m', ' ', $route->compile()->getRegex())), OutputInterface::OUTPUT_RAW);
}

protected function formatValue($value)
Expand All @@ -173,4 +178,15 @@ protected function formatValue($value)

return preg_replace("/\n\s*/s", '', var_export($value, true));
}

private function formatConfigs(array $array)
{
$string = '';
ksort($array);
foreach ($array as $name => $value) {
$string .= ($string ? "\n" . str_repeat(' ', 13) : '') . $name . ': ' . $this->formatValue($value);
}

return $string;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class RouterMatchCommand extends ContainerAwareCommand
{
/**
* {@inheritDoc}
* {@inheritdoc}
*/
public function isEnabled()
{
Expand All @@ -41,7 +41,7 @@ public function isEnabled()
}

/**
* @see Command
* {@inheritdoc}
*/
protected function configure()
{
Expand All @@ -61,7 +61,7 @@ protected function configure()
}

/**
* @see Command
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Loading