diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 9f2482d5ad..3823cd6eab 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -22,6 +22,8 @@ use Symfony\Component\Validator\Validation; abstract class FrameworkExtensionTest extends TestCase { + private static $containerCache = array(); + abstract protected function loadFromFile(ContainerBuilder $container, $file); public function testCsrfProtection() @@ -470,6 +472,10 @@ abstract class FrameworkExtensionTest extends TestCase protected function createContainerFromFile($file, $data = array()) { + $cacheKey = md5($file.serialize($data)); + if (isset(self::$containerCache[$cacheKey])) { + return self::$containerCache[$cacheKey]; + } $container = $this->createContainer($data); $container->registerExtension(new FrameworkExtension()); $this->loadFromFile($container, $file); @@ -478,7 +484,7 @@ abstract class FrameworkExtensionTest extends TestCase $container->getCompilerPassConfig()->setRemovingPasses(array()); $container->compile(); - return $container; + return self::$containerCache[$cacheKey] = $container; } protected function createContainerFromClosure($closure, $data = array()) diff --git a/src/Symfony/Component/Finder/SplFileInfo.php b/src/Symfony/Component/Finder/SplFileInfo.php index c7fbe02191..31a3f86a67 100644 --- a/src/Symfony/Component/Finder/SplFileInfo.php +++ b/src/Symfony/Component/Finder/SplFileInfo.php @@ -38,6 +38,8 @@ class SplFileInfo extends \SplFileInfo /** * Returns the relative path. * + * This path does not contain the file name. + * * @return string the relative path */ public function getRelativePath() @@ -48,6 +50,8 @@ class SplFileInfo extends \SplFileInfo /** * Returns the relative path name. * + * This path contains the file name. + * * @return string the relative path name */ public function getRelativePathname() diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 202c6e8645..f2ed70450a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -17,11 +17,6 @@ use Symfony\Component\HttpFoundation\Request; class RequestTest extends \PHPUnit_Framework_TestCase { - public function testConstructor() - { - $this->testInitialize(); - } - public function testInitialize() { $request = new Request(); diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 6660950b7a..98fa66a940 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -240,9 +240,6 @@ class Process * The callback receives the type of output (out or err) and some bytes from * the output in real-time while writing the standard input to the process. * It allows to have feedback from the independent process during execution. - * If there is no callback passed, the wait() method can be called - * with true as a second parameter then the callback will get all data occurred - * in (and since) the start call. * * @param callable|null $callback A PHP callback to run whenever there is some * output available on STDOUT or STDERR @@ -474,7 +471,11 @@ class Process $this->readPipes(false, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true); - return $this->stdout; + if (false === $ret = stream_get_contents($this->stdout, -1, 0)) { + return ''; + } + + return $ret; } /** @@ -492,16 +493,13 @@ class Process { $this->requireProcessIsStarted(__FUNCTION__); - $data = $this->getOutput(); - - $latest = substr($data, $this->incrementalOutputOffset); + $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset); + $this->incrementalOutputOffset = ftell($this->stdout); if (false === $latest) { return ''; } - $this->incrementalOutputOffset = strlen($data); - return $latest; } @@ -536,7 +534,11 @@ class Process $this->readPipes(false, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true); - return $this->stderr; + if (false === $ret = stream_get_contents($this->stderr, -1, 0)) { + return ''; + } + + return $ret; } /** @@ -555,16 +557,13 @@ class Process { $this->requireProcessIsStarted(__FUNCTION__); - $data = $this->getErrorOutput(); - - $latest = substr($data, $this->incrementalErrorOutputOffset); + $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset); + $this->incrementalErrorOutputOffset = ftell($this->stderr); if (false === $latest) { return ''; } - $this->incrementalErrorOutputOffset = strlen($data); - return $latest; } @@ -795,23 +794,33 @@ class Process /** * Adds a line to the STDOUT stream. * + * @internal + * * @param string $line The line to append */ public function addOutput($line) { $this->lastOutputTime = microtime(true); - $this->stdout .= $line; + + fseek($this->stdout, 0, SEEK_END); + fwrite($this->stdout, $line); + fseek($this->stdout, $this->incrementalOutputOffset); } /** * Adds a line to the STDERR stream. * + * @internal + * * @param string $line The line to append */ public function addErrorOutput($line) { $this->lastOutputTime = microtime(true); - $this->stderr .= $line; + + fseek($this->stderr, 0, SEEK_END); + fwrite($this->stderr, $line); + fseek($this->stderr, $this->incrementalErrorOutputOffset); } /** @@ -1393,8 +1402,8 @@ class Process $this->exitcode = null; $this->fallbackStatus = array(); $this->processInformation = null; - $this->stdout = null; - $this->stderr = null; + $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+'); + $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+'); $this->process = null; $this->latestSignal = null; $this->status = self::STATUS_READY; diff --git a/src/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.php b/src/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.php index d00ff1cfae..1032cb200d 100644 --- a/src/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.php +++ b/src/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.php @@ -27,7 +27,7 @@ interface VoterInterface /** * Checks if the voter supports the given attribute. * - * @param string $attribute An attribute + * @param mixed $attribute An attribute (usually the attribute name string) * * @return bool true if this Voter supports the attribute, false otherwise */ diff --git a/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php index 83c3c14384..e3f09a9436 100644 --- a/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php @@ -59,8 +59,6 @@ class CustomNormalizer extends SerializerAwareNormalizer implements NormalizerIn */ public function supportsDenormalization($data, $type, $format = null) { - $class = new \ReflectionClass($type); - - return $class->isSubclassOf('Symfony\Component\Serializer\Normalizer\DenormalizableInterface'); + return is_subclass_of($type, 'Symfony\Component\Serializer\Normalizer\DenormalizableInterface'); } }