This commit is contained in:
Fabien Potencier 2011-06-08 12:12:55 +02:00
parent 8d262bf1c6
commit 62e4342a86
58 changed files with 127 additions and 75 deletions

View File

@ -181,7 +181,7 @@ class EntityChoiceList extends ArrayChoiceList
// entity ID for performance reasons
$id = current($this->getIdentifierValues($entity));
}
if (null === $group) {
// Flat list of choices
$this->choices[$id] = $value;
@ -189,7 +189,7 @@ class EntityChoiceList extends ArrayChoiceList
// Nested choices
$this->choices[$group][$id] = $value;
}
$this->entities[$id] = $entity;
}
}
@ -242,6 +242,7 @@ class EntityChoiceList extends ArrayChoiceList
if (count($this->identifier) > 1) {
// $key is a collection index
$entities = $this->getEntities();
return isset($entities[$key]) ? $entities[$key] : null;
} else if ($this->entities) {
return isset($this->entities[$key]) ? $this->entities[$key] : null;

View File

@ -33,7 +33,7 @@ class UniqueEntity extends Constraint
/**
* The validator must be defined as a service with this name.
*
*
* @return string
*/
public function validatedBy()

View File

@ -17,7 +17,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* The AssetWriterCacheWarmer processes and writes the asset files.
*
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class AssetWriterCacheWarmer implements CacheWarmerInterface

View File

@ -133,6 +133,7 @@ class AsseticExtension extends Extension
{
$processor = new Processor();
$configuration = new Configuration($debug, $bundles);
return $processor->processConfiguration($configuration, $configs);
}

View File

@ -31,13 +31,13 @@ class AssetManagerCacheWarmerTest extends \PHPUnit_Framework_TestCase
;
$am->expects($this->once())->method('load');
$container = $this
->getMockBuilder('Symfony\\Component\\DependencyInjection\\Container')
->setConstructorArgs(array())
->getMock()
;
$container
->expects($this->once())
->method('get')

View File

@ -25,7 +25,7 @@ class AssetWriterCacheWarmerTest extends \PHPUnit_Framework_TestCase
public function testWarmUp()
{
$am = $this->getMock('Assetic\\AssetManager');
$writer = $this
->getMockBuilder('Assetic\\AssetWriter')
->disableOriginalConstructor()
@ -37,19 +37,19 @@ class AssetWriterCacheWarmerTest extends \PHPUnit_Framework_TestCase
->method('writeManagerAssets')
->with($am)
;
$container = $this
->getMockBuilder('Symfony\\Component\\DependencyInjection\\Container')
->setConstructorArgs(array())
->getMock()
;
$container
->expects($this->once())
->method('get')
->with('assetic.asset_manager')
->will($this->returnValue($am))
;
;
$warmer = new AssetWriterCacheWarmer($container, $writer);
$warmer->warmUp('/path/to/cache');

View File

@ -168,6 +168,7 @@ abstract class AbstractDoctrineExtension extends Extension
if (!$bundleConfig['prefix']) {
$bundleConfig['prefix'] = $bundle->getNamespaceName().'\\'.$this->getMappingObjectDefaultName();
}
return $bundleConfig;
}

View File

@ -31,7 +31,7 @@
<!-- form field factory guesser -->
<parameter key="form.type_guesser.doctrine.class">Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser</parameter>
<!-- validator -->
<parameter key="doctrine.orm.validator.unique.class">Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator</parameter>
</parameters>
@ -60,7 +60,7 @@
<service id="doctrine.orm.configuration" class="%doctrine.orm.configuration.class%" abstract="true" public="false" />
<service id="doctrine.orm.entity_manager.abstract" class="%doctrine.orm.entity_manager.class%" factory-class="%doctrine.orm.entity_manager.class%" factory-method="create" abstract="true" />
<!-- validator -->
<service id="doctrine.orm.validator.unique" class="%doctrine.orm.validator.unique.class%">
<tag name="validator.constraint_validator" alias="doctrine.orm.validator.unique" />

View File

@ -22,6 +22,7 @@ class XMLSchemaTest extends \PHPUnit_Framework_TestCase
$schemaFiles[] = array($element->getPathname());
}
}
return $schemaFiles;
}

View File

@ -29,14 +29,14 @@ class Shell extends BaseShell
{
return <<<EOF
<info>
_____ __ ___
/ ____| / _| |__ \
_____ __ ___
/ ____| / _| |__ \
| (___ _ _ _ __ ___ | |_ ___ _ __ _ _ ) |
\___ \| | | | '_ ` _ \| _/ _ \| '_ \| | | | / /
____) | |_| | | | | | | || (_) | | | | |_| |/ /_
\___ \| | | | '_ ` _ \| _/ _ \| '_ \| | | | / /
____) | |_| | | | | | | || (_) | | | | |_| |/ /_
|_____/ \__, |_| |_| |_|_| \___/|_| |_|\__, |____|
__/ | __/ |
|___/ |___/
__/ | __/ |
|___/ |___/
</info>
EOF

View File

@ -18,7 +18,7 @@
<argument /><!-- Cache Implementation -->
<argument /><!-- Debug-Flag -->
</service>
<service id="annotations.file_cache_reader" class="%annotations.file_cache_reader.class%" public="false">
<argument type="service" id="annotations.reader" />
<argument /><!-- Cache-Directory -->

View File

@ -116,7 +116,7 @@
function switchIcons(id1, id2) {
var icon1, icon2, visibility1, visibility2;
icon1 = document.getElementById(id1);
icon2 = document.getElementById(id2);

View File

@ -1,9 +1,9 @@
{% if trace.function %}
at
at
<strong>
<abbr title="{{ trace.class }}">{{ trace.short_class }}</abbr>
{{ trace.type ~ trace.function }}
</strong>
</strong>
({{ trace.args|format_args }})
<br />
{% endif %}

View File

@ -20,7 +20,7 @@ use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\BaseBundle\BaseBundle;
class TemplateFinderTest extends TestCase
{
public function testFindAllTemplates()
{
{
$kernel = $this
->getMockBuilder('Symfony\Component\HttpKernel\Kernel')
->disableOriginalConstructor()

View File

@ -63,6 +63,7 @@ class MonologExtension extends Extension
if ($a['priority'] == $b['priority']) {
return 0;
}
return $a['priority'] < $b['priority'] ? -1 : 1;
});
foreach ($handlers as $handler) {
@ -110,6 +111,7 @@ class MonologExtension extends Extension
switch ($handler['type']) {
case 'service':
$container->setAlias($handlerId, $handler['id']);
return $handlerId;
case 'stream':

View File

@ -53,6 +53,7 @@ class InitAclCommand extends Command
foreach ($tables as $table) {
if (in_array($table, $tableNames, true)) {
$output->writeln(sprintf('The table "%s" already exists. Aborting.', $table));
return;
}
}

View File

@ -123,6 +123,7 @@ class SecurityExtension extends Extension
// custom ACL provider
if (isset($config['provider'])) {
$container->setAlias('security.acl.provider', $config['provider']);
return;
}

View File

@ -20,7 +20,7 @@
<service id="security.authentication.factory.digest" class="Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\HttpDigestFactory">
<tag name="security.listener.factory" />
</service>
<service id="security.authentication.factory.remember_me" class="Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\RememberMeFactory">
<tag name="security.listener.factory" />
</service>

View File

@ -7,7 +7,7 @@
<config>
<acl />
<encoder class="JMS\FooBundle\Entity\User1" algorithm="plaintext" />
<encoder class="JMS\FooBundle\Entity\User2" algorithm="sha1" encode-as-base64="false" iterations="5" />
@ -19,7 +19,7 @@
<provider name="default">
<user name="foo" password="foo" roles="ROLE_USER" />
</provider>
<provider name="digest">
<user name="foo" password="foo" roles="ROLE_USER, ROLE_ADMIN" />
</provider>
@ -34,7 +34,7 @@
</provider>
<provider name="service" id="user.manager" />
<provider name="chain" providers="service, doctrine, basic" />
<firewall name="simple" pattern="/login" security="false" />

View File

@ -4,11 +4,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sec="http://symfony.com/schema/dic/security"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<imports>
<import resource="container1.xml"/>
</imports>
<sec:config>
<sec:acl provider="foo" />
</sec:config>

View File

@ -4,18 +4,18 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sec="http://symfony.com/schema/dic/security"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<imports>
<import resource="merge_import.xml"/>
</imports>
<sec:config>
<sec:provider name="default" id="foo" />
<sec:firewall name="main" form-login="false">
<sec:http-basic />
</sec:firewall>
<sec:role id="FOO" value="MOO" />
</sec:config>

View File

@ -4,14 +4,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:srv="http://symfony.com/schema/dic/services"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<config>
<firewall name="main">
<form-login login-path="/login" />
</firewall>
<role id="FOO" value="BAR" />
<role id="ADMIN" value="USER" />
<role id="ADMIN" value="USER" />
</config>
</srv:container>

View File

@ -28,7 +28,7 @@ security:
id: user.manager
chain:
providers: [service, doctrine, basic]
firewalls:
simple: { pattern: /login, security: false }

View File

@ -1,6 +1,6 @@
imports:
- { resource: container1.yml }
security:
acl:
provider: foo

View File

@ -3,7 +3,7 @@ security:
main:
form_login:
login_path: /login
role_hierarchy:
FOO: BAR
ADMIN: USER

View File

@ -1,7 +1,7 @@
form_login:
pattern: /login
defaults: { _controller: FormLoginBundle:Login:login }
form_login_check:
pattern: /login_check
defaults: { _controller: FormLoginBundle:Login:loginCheck }
@ -9,11 +9,11 @@ form_login_check:
form_login_homepage:
pattern: /
defaults: { _controller: FormLoginBundle:Login:afterLogin }
form_login_custom_target_path:
pattern: /foo
defaults: { _controller: FormLoginBundle:Login:afterLogin }
form_login_redirect_to_protected_resource_after_login:
pattern: /protected-resource
defaults: { _controller: FormLoginBundle:Login:afterLogin }

View File

@ -5,16 +5,16 @@
{% if error %}
<div>{{ error.message }}</div>
{% endif %}
<form action="{{ path('form_login_check') }}" method="post">
<label for="username">Username:</label>
<input type="text" id="username" name="_username" value="{{ last_username }}" />
<label for="password">Password:</label>
<input type="password" id="password" name="_password" />
<input type="hidden" name="_target_path" value="" />
<input type="submit" name="login" />
</form>

View File

@ -4,15 +4,15 @@ imports:
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
providers:
in_memory:
users:
johannes: { password: test, roles: [ROLE_USER] }
firewalls:
# This firewall doesn't make sense in combination with the rest of the
# configuration file, but it's here for testing purposes (do not use
# configuration file, but it's here for testing purposes (do not use
# this file in a real world scenario though)
login_form:
pattern: ^/login$

View File

@ -1,7 +1,7 @@
framework:
templating: { engines: ['twig'] }
# Twig Configuration
# Twig Configuration
twig:
debug: %kernel.debug%
strict_variables: %kernel.debug%

View File

@ -19,7 +19,7 @@
{% endif %}
<div id="main">
<div class="clear_fix">
<div id="collector_wrapper">
<div id="collector_content">

View File

@ -3,7 +3,7 @@
{% block body %}
<div id="content">
{% include 'WebProfilerBundle:Profiler:header.html.twig' only %}
<div id="resume">
<p>
<strong>No request matching the token "{{ token }}".</strong>

View File

@ -31,7 +31,7 @@ class WebProfilerExtensionTest extends TestCase
{
private $kernel;
/**
* @var Symfony\Component\DependencyInjection\Container $container
* @var Symfony\Component\DependencyInjection\Container $container
*/
private $container;

View File

@ -132,7 +132,7 @@ class Cookie
throw new \InvalidArgumentException(sprintf('The URL "%s" is not valid.', $url));
}
$parts = array_merge($urlParts, $parts);
$values['domain'] = $parts['host'];
$values['path'] = substr($parts['path'], 0, strrpos($parts['path'], '/'));
}

View File

@ -194,6 +194,7 @@ class ParameterBag implements ParameterBagInterface
}
$self = $this;
return preg_replace_callback('/(?<!%)%([^%]+)%/', function ($match) use ($self, $resolving) {
$key = strtolower($match[1]);
if (isset($resolving[$key])) {

View File

@ -21,7 +21,7 @@ class DataEvent extends Event
/**
* Constructs an event.
*
*
* @param FormInterface $form The associated form
* @param mixed $data The data
*/
@ -30,21 +30,21 @@ class DataEvent extends Event
$this->form = $form;
$this->data = $data;
}
/**
* Returns the form at the source of the event.
*
*
* @return FormInterface
*/
public function getForm()
{
return $this->form;
}
/**
* Returns the data associated with this event.
*
* @return type
*
* @return type
*/
public function getData()
{

View File

@ -15,8 +15,8 @@ class FilterDataEvent extends DataEvent
{
/**
* Allows updating with some filtered data
*
* @param mixed $data
*
* @param mixed $data
*/
public function setData($data)
{

View File

@ -74,7 +74,7 @@ class FormTypeGuesserChain implements FormTypeGuesserInterface
*
* @param \Closure $closure The closure to execute. Accepts a guesser
* as argument and should return a Guess instance
*
*
* @return FieldFactoryGuess The guess with the highest confidence
*/
private function guess(\Closure $closure)

View File

@ -133,7 +133,7 @@ class FileBag extends ParameterBag
foreach (array_keys($data['name']) as $key) {
$files[$key] = $this->fixPhpFilesArray(array(
'error' => $data['error'][$key],
'name' => $data['name'][$key],
'name' => $data['name'][$key],
'type' => $data['type'][$key],
'tmp_name' => $data['tmp_name'][$key],
'size' => $data['size'][$key]

View File

@ -333,7 +333,7 @@ class Request
/**
* Gets the Session.
*
*
* @return Session|null The session
*/
public function getSession()
@ -365,7 +365,7 @@ class Request
/**
* Sets the Session.
*
*
* @param Session $session The Session
*/
public function setSession(Session $session)
@ -466,7 +466,7 @@ class Request
/**
* Gets the request's scheme.
*
*
* @return string
*/
public function getScheme()
@ -476,7 +476,7 @@ class Request
/**
* Returns the port on which the request is made.
*
*
* @return string
*/
public function getPort()
@ -505,7 +505,7 @@ class Request
/**
* Returns the requested URI.
*
*
* @return string
*/
public function getRequestUri()
@ -580,7 +580,7 @@ class Request
/**
* Checks whether the request is secure or not.
*
*
* @return Boolean
*/
public function isSecure()
@ -621,7 +621,7 @@ class Request
/**
* Sets the request method.
*
*
* @param string $method
*/
public function setMethod($method)
@ -735,7 +735,7 @@ class Request
/**
* Checks whether the method is safe or not.
*
*
* @return Boolean
*/
public function isMethodSafe()
@ -771,7 +771,7 @@ class Request
/**
* Gets the Etags.
*
*
* @return array The entity tags
*/
public function getETags()

View File

@ -33,7 +33,7 @@ class ResponseHeaderBag extends HeaderBag
$this->set('cache-control', '');
}
}
/**
* {@inheritdoc}
*/

View File

@ -32,6 +32,7 @@ class ArraySessionStorage implements SessionStorageInterface
if ($destroy) {
$this->data = array();
}
return true;
}

View File

@ -24,6 +24,7 @@ class DayOfYearTransformer extends Transformer
public function format(\DateTime $dateTime, $length)
{
$dayOfYear = $dateTime->format('z') + 1;
return $this->padLeft($dayOfYear, $length);
}

View File

@ -111,6 +111,7 @@ class FullTransformer
if (isset($this->transformers[$dateChars[0]])) {
$transformer = $this->transformers[$dateChars[0]];
return $transformer->format($dateTime, $length);
} else {
// handle unimplemented characters
@ -178,6 +179,7 @@ class FullTransformer
if (isset($transformers[$transformerIndex])) {
$transformer = $transformers[$transformerIndex];
$captureName = str_repeat($transformerIndex, $length);
return "(?P<$captureName>" . $transformer->getReverseMatchingRegExp($length) . ')';
}
}, $escapedPattern);
@ -207,6 +209,7 @@ class FullTransformer
if (preg_match("/^'+$/", $quoteMatch)) {
return str_replace("''", "'", $quoteMatch);
}
return str_replace("''", "'", substr($quoteMatch, 1, -1));
}

View File

@ -24,6 +24,7 @@ class MinuteTransformer extends Transformer
public function format(\DateTime $dateTime, $length)
{
$minuteOfHour = (int) $dateTime->format('i');
return $this->padLeft($minuteOfHour, $length);
}

View File

@ -33,6 +33,7 @@ class QuarterTransformer extends Transformer
return 'Q' . $quarter;
default:
$map = array(1 => '1st quarter', 2 => '2nd quarter', 3 => '3rd quarter', 4 => '4th quarter');
return $map[$quarter];
}
}

View File

@ -24,6 +24,7 @@ class SecondTransformer extends Transformer
public function format(\DateTime $dateTime, $length)
{
$secondOfMinute = (int) $dateTime->format('s');
return $this->padLeft($secondOfMinute, $length);
}

View File

@ -323,6 +323,7 @@ class StubIntlDateFormatter
$dateTime = $this->createDateTime(0);
$transformer = new FullTransformer($this->getPattern(), $this->getTimeZoneId());
return $transformer->parse($dateTime, $value);
}
@ -409,6 +410,7 @@ class StubIntlDateFormatter
}
$this->timeZoneId = $timeZone;
return true;
}

View File

@ -284,6 +284,7 @@ class StubNumberFormatter
$value = $this->formatNumber($value, $fractionDigits);
$ret = $symbol.$value;
return $negative ? '('.$ret.')' : $ret;
}
@ -320,6 +321,7 @@ class StubNumberFormatter
$fractionDigits = $this->getAttribute(self::FRACTION_DIGITS);
$value = $this->round($value, $fractionDigits);
return $this->formatNumber($value, $fractionDigits);
}
@ -503,6 +505,7 @@ class StubNumberFormatter
$this->attributes[$attr] = $value;
$this->initializedAttributes[$attr] = true;
return true;
}
@ -644,6 +647,7 @@ class StubNumberFormatter
private function formatNumber($value, $precision)
{
$precision = $this->getUnitializedPrecision($value, $precision);
return number_format($value, $precision, '.', $this->getAttribute(self::GROUPING_USED) ? ',' : '');
}
@ -751,6 +755,7 @@ class StubNumberFormatter
private function normalizeFractionDigitsValue($value)
{
$value = (int) $value;
return (0 > $value) ? 0 : $value;
}
}

View File

@ -48,10 +48,12 @@ class SessionAuthenticationStrategy implements SessionAuthenticationStrategyInte
case self::MIGRATE:
$request->getSession()->migrate();
return;
case self::INVALIDATE:
$request->getSession()->invalidate();
return;
default:

View File

@ -45,6 +45,7 @@ class XmlEncoder extends SerializerAwareEncoder implements DecoderInterface, Nor
} else {
$this->appendNode($this->dom, $data, $this->rootNodeName);
}
return $this->dom->saveXML();
}
@ -63,8 +64,10 @@ class XmlEncoder extends SerializerAwareEncoder implements DecoderInterface, Nor
$data['@'.$attrkey] = (string) $attr;
}
$data['#'] = (string) $xml;
return $data;
}
return $this->parseXml($xml);
}
@ -97,6 +100,7 @@ class XmlEncoder extends SerializerAwareEncoder implements DecoderInterface, Nor
$frag = $this->dom->createDocumentFragment();
$frag->appendXML($val);
$node->appendChild($frag);
return true;
}
@ -138,6 +142,7 @@ class XmlEncoder extends SerializerAwareEncoder implements DecoderInterface, Nor
{
if ($fragment instanceof \DOMDocumentFragment) {
$node->appendChild($fragment);
return true;
}
@ -201,6 +206,7 @@ class XmlEncoder extends SerializerAwareEncoder implements DecoderInterface, Nor
$data[$key] = $value;
}
}
return $data;
}
@ -244,6 +250,7 @@ class XmlEncoder extends SerializerAwareEncoder implements DecoderInterface, Nor
$append = $this->appendNode($parentNode, $data, $key);
}
}
return $append;
}
if (is_object($data)) {
@ -255,8 +262,10 @@ class XmlEncoder extends SerializerAwareEncoder implements DecoderInterface, Nor
if (!$parentNode->parentNode->parentNode) {
$root = $parentNode->parentNode;
$root->removeChild($parentNode);
return $this->appendNode($root, $data, $this->rootNodeName);
}
return $this->appendNode($parentNode, $data, 'data');
}
throw new \UnexpectedValueException('An unexpected value could not be serialized: '.var_export($data, true));
@ -282,6 +291,7 @@ class XmlEncoder extends SerializerAwareEncoder implements DecoderInterface, Nor
if ($appendNode) {
$parentNode->appendChild($node);
}
return $appendNode;
}

View File

@ -33,6 +33,7 @@ class CustomNormalizer extends SerializerAwareNormalizer
{
$object = new $class;
$object->denormalize($this->serializer, $data, $format);
return $object;
}

View File

@ -134,6 +134,7 @@ class GetSetMethodNormalizer extends SerializerAwareNormalizer
return true;
}
}
return false;
}

View File

@ -47,6 +47,7 @@ class Serializer implements SerializerInterface
if (!$this->encoders[$format] instanceof NormalizationAwareInterface) {
$data = $this->normalize($data);
}
return $this->encode($data, $format);
}
@ -70,6 +71,7 @@ class Serializer implements SerializerInterface
foreach ($data as $key => $val) {
$normalized[$key] = $this->normalize($val, $format);
}
return $normalized;
}
if (is_object($data)) {
@ -79,6 +81,7 @@ class Serializer implements SerializerInterface
foreach ($data as $key => $val) {
$data[$key] = $this->normalize($val, $format);
}
return $data;
}
throw new \UnexpectedValueException('An unexpected value could not be normalized: '.var_export($data, true));
@ -100,6 +103,7 @@ class Serializer implements SerializerInterface
if (!isset($this->encoders[$format])) {
throw new \UnexpectedValueException('No encoder registered for the '.$format.' format');
}
return $this->encoders[$format]->encode($data, $format);
}
@ -111,6 +115,7 @@ class Serializer implements SerializerInterface
if (!isset($this->decoders[$format])) {
throw new \UnexpectedValueException('No decoder registered for the '.$format.' format');
}
return $this->decoders[$format]->decode($data, $format);
}
@ -133,6 +138,7 @@ class Serializer implements SerializerInterface
foreach ($this->normalizers as $normalizer) {
if ($normalizer->supportsNormalization($object, $class, $format)) {
$this->normalizerCache[$class][$format] = $normalizer;
return $normalizer->normalize($object, $format);
}
}
@ -158,6 +164,7 @@ class Serializer implements SerializerInterface
foreach ($this->normalizers as $normalizer) {
if ($normalizer->supportsDenormalization($data, $class, $format)) {
$this->denormalizerCache[$class][$format] = $normalizer;
return $normalizer->denormalize($data, $class, $format);
}
}

View File

@ -111,5 +111,5 @@ EOF;
{
unset($this->violations[$offset]);
}
}

View File

@ -46,6 +46,7 @@ abstract class FilesLoader extends LoaderChain
foreach ($paths as $path) {
$loaders[] = $this->getFileLoaderInstance($path);
}
return $loaders;
}

View File

@ -357,6 +357,7 @@ class Inline
case ctype_digit($scalar):
$raw = $scalar;
$cast = intval($scalar);
return '0' == $scalar[0] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw);
case in_array(strtolower($scalar), $trueValues):
return true;

View File

@ -340,6 +340,7 @@ class Parser
if (!array_key_exists($value, $this->refs)) {
throw new ParserException(sprintf('Reference "%s" does not exist (%s).', $value, $this->currentLine));
}
return $this->refs[$value];
}
@ -483,6 +484,7 @@ class Parser
{
//checking explicitly the first char of the trim is faster than loops or strpos
$ltrimmedLine = ltrim($this->currentLine, ' ');
return $ltrimmedLine[0] === '#';
}

View File

@ -108,12 +108,15 @@ class Unescaper
return $this->convertEncoding("\x20\x29", self::ENCODING, 'UCS-2BE');
case 'x':
$char = pack('n', hexdec(substr($value, 2, 2)));
return $this->convertEncoding($char, self::ENCODING, 'UCS-2BE');
case 'u':
$char = pack('n', hexdec(substr($value, 2, 4)));
return $this->convertEncoding($char, self::ENCODING, 'UCS-2BE');
case 'U':
$char = pack('N', hexdec(substr($value, 2, 8)));
return $this->convertEncoding($char, self::ENCODING, 'UCS-4BE');
}
}