Merge branch '3.2'
* 3.2: Make .travis.yml more readable Fold Travis CI output by component [VarDumper] Minor tweaks to html/css dumps Add trhows PHPDoc in Application::run [Debug] Set exit status to 255 on error [HttpFoundation] Store IANA's RNG files in the repository [PropertyInfo] Remove a useless call to count() in SerializerExtractor [PropertyInfo] Prevent returning int values in some cases. [HttpFoundation] Fix getClientIp @return docblock Add @throws phpdoc unify PHPUnit config files
This commit is contained in:
commit
04ae502b0d
181
.travis.yml
181
.travis.yml
@ -43,63 +43,140 @@ services:
|
|||||||
- redis-server
|
- redis-server
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- stty cols 120
|
- |
|
||||||
- mkdir /tmp/slapd
|
# General configuration
|
||||||
- slapd -f src/Symfony/Component/Ldap/Tests/Fixtures/conf/slapd.conf -h ldap://localhost:3389 &
|
stty cols 120
|
||||||
- PHP=$TRAVIS_PHP_VERSION
|
mkdir /tmp/slapd
|
||||||
|
slapd -f src/Symfony/Component/Ldap/Tests/Fixtures/conf/slapd.conf -h ldap://localhost:3389 &
|
||||||
|
PHP=$TRAVIS_PHP_VERSION
|
||||||
|
[ -d ~/.composer ] || mkdir ~/.composer
|
||||||
|
cp .composer/* ~/.composer/
|
||||||
|
export PHPUNIT=$(readlink -f ./phpunit)
|
||||||
|
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
|
||||||
|
export COMPOSER_UP='composer update --no-progress --no-suggest --ansi'
|
||||||
|
|
||||||
|
# tfold is a helper to create folded reports
|
||||||
|
tfold () {
|
||||||
|
title=$1
|
||||||
|
fold=$(echo $title | sed -r 's/[^-_A-Za-z\d]+/./g')
|
||||||
|
shift
|
||||||
|
echo -e "travis_fold:start:$fold\\n\\e[1;34m$title\\e[0m"
|
||||||
|
bash -xc "$*" 2>&1 &&
|
||||||
|
echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
|
||||||
|
( echo -e "\\e[41mKO\\e[0m $title\\n" && exit 1 )
|
||||||
|
}
|
||||||
|
export -f tfold
|
||||||
|
|
||||||
|
# php.ini configuration
|
||||||
|
if [[ $PHP = hhvm* ]]; then
|
||||||
|
INI=/etc/hhvm/php.ini
|
||||||
|
else
|
||||||
|
INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
|
||||||
|
phpenv config-rm xdebug.ini || echo "xdebug not available"
|
||||||
|
fi
|
||||||
|
echo date.timezone = Europe/Paris >> $INI
|
||||||
|
echo memory_limit = -1 >> $INI
|
||||||
|
echo session.gc_probability = 0 >> $INI
|
||||||
|
echo opcache.enable_cli = 1 >> $INI
|
||||||
|
echo hhvm.jit = 0 >> $INI
|
||||||
|
echo apc.enable_cli = 1 >> $INI
|
||||||
|
echo extension = ldap.so >> $INI
|
||||||
|
echo extension = redis.so >> $INI
|
||||||
|
echo extension = memcached.so >> $INI
|
||||||
|
[[ $PHP = 5.* ]] && echo extension = mongo.so >> $INI
|
||||||
|
[[ $PHP = 5.* ]] && echo extension = memcache.so >> $INI
|
||||||
|
|
||||||
# Matrix lines for intermediate PHP versions are skipped for pull requests
|
# Matrix lines for intermediate PHP versions are skipped for pull requests
|
||||||
- if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then deps=skip; skip=1; fi
|
if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then
|
||||||
# A sigchild-enabled-PHP is used to test the Process component on the lowest PHP matrix line
|
deps=skip
|
||||||
- if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj; (cd php-$MIN_PHP; ./configure --enable-sigchild --enable-pcntl; make -j2); fi
|
skip=1
|
||||||
- if [[ ! $PHP = hhvm* ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi
|
else
|
||||||
- if [[ ! $skip ]]; then echo date.timezone = Europe/Paris >> $INI_FILE; fi
|
COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
|
||||||
- if [[ ! $skip ]]; then echo memory_limit = -1 >> $INI_FILE; fi
|
fi
|
||||||
- if [[ ! $skip ]]; then echo session.gc_probability = 0 >> $INI_FILE; fi
|
|
||||||
- if [[ ! $skip ]]; then echo opcache.enable_cli = 1 >> $INI_FILE; fi
|
- |
|
||||||
- if [[ ! $skip ]]; then echo hhvm.jit = 0 >> $INI_FILE; fi
|
# Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line
|
||||||
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi
|
if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then
|
||||||
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi
|
wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj &&
|
||||||
- if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.11 && echo apc.enable_cli = 1 >> $INI_FILE); fi
|
(cd php-$MIN_PHP && ./configure --enable-sigchild --enable-pcntl && make -j2)
|
||||||
- if [[ ! $skip && $PHP = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.6 && echo apc.enable_cli = 1 >> $INI_FILE); fi
|
fi
|
||||||
- if [[ ! $deps && $PHP = 5.* ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI_FILE); fi
|
|
||||||
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = memcached.so >> $INI_FILE; fi
|
- |
|
||||||
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = ldap.so >> $INI_FILE; fi
|
# Install extra PHP extensions
|
||||||
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = redis.so >> $INI_FILE; fi;
|
if [[ ! $skip && $PHP = 5.* ]]; then
|
||||||
- if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
|
([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI") &&
|
||||||
- if [[ ! $skip ]]; then [ -d ~/.composer ] || mkdir ~/.composer; cp .composer/* ~/.composer/; fi
|
tfold ext.apcu4 'echo yes | pecl install -f apcu-4.0.11'
|
||||||
- if [[ ! $skip ]]; then export PHPUNIT=$(readlink -f ./phpunit); fi
|
elif [[ ! $skip && $PHP = 7.* ]]; then
|
||||||
- if [[ ! $skip ]]; then ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/base.ldif; fi
|
tfold ext.apcu5 'echo yes | pecl install -f apcu-5.1.6'
|
||||||
- if [[ ! $skip ]]; then ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif; fi
|
fi
|
||||||
|
|
||||||
|
- |
|
||||||
|
# Load fixtures
|
||||||
|
if [[ ! $skip ]]; then
|
||||||
|
ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/base.ldif &&
|
||||||
|
ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif
|
||||||
|
fi
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- if [[ ! $skip && $deps ]]; then cp composer.json composer.json.orig; fi
|
- |
|
||||||
- if [[ ! $skip && $deps ]]; then echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json; fi
|
|
||||||
- if [[ ! $skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi
|
|
||||||
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
|
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
|
||||||
- if [[ ! $skip && $deps ]]; then php .github/build-packages.php HEAD^ $COMPONENTS; fi
|
if [[ ! $deps ]]; then
|
||||||
- if [[ ! $skip && $deps ]]; then mv composer.json composer.json.phpunit; mv composer.json.orig composer.json; fi
|
php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit
|
||||||
- if [[ ! $skip && ! $deps ]]; then php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit; fi
|
elif [[ ! $skip ]]; then
|
||||||
# For the master branch when deps=high, the version before master is checked out and tested with the locally patched components
|
export SYMFONY_DEPRECATIONS_HELPER=weak &&
|
||||||
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//); else SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*'); fi
|
cp composer.json composer.json.orig &&
|
||||||
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi
|
echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json &&
|
||||||
|
php .github/build-packages.php HEAD^ $COMPONENTS &&
|
||||||
|
mv composer.json composer.json.phpunit &&
|
||||||
|
mv composer.json.orig composer.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
- |
|
||||||
|
# For the master branch, when deps=high, the version before master is checked out and tested with the locally patched components
|
||||||
|
if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then
|
||||||
|
SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//) &&
|
||||||
|
git fetch origin $SYMFONY_VERSION &&
|
||||||
|
git checkout -m FETCH_HEAD &&
|
||||||
|
COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
|
||||||
|
elif [[ ! $skip ]]; then
|
||||||
|
SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
|
||||||
|
fi
|
||||||
|
|
||||||
|
- |
|
||||||
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one
|
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one
|
||||||
- if [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]]; then LEGACY=,legacy; fi
|
[[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]] && LEGACY=,legacy
|
||||||
- export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
|
|
||||||
- if [[ ! $skip && $deps ]]; then export SYMFONY_DEPRECATIONS_HELPER=weak; fi
|
export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
|
||||||
- if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi
|
if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi
|
||||||
- if [[ ! $skip ]]; then composer update --no-suggest; fi
|
|
||||||
|
- if [[ ! $skip ]]; then $COMPOSER_UP; fi
|
||||||
- if [[ ! $skip ]]; then ./phpunit install; fi
|
- if [[ ! $skip ]]; then ./phpunit install; fi
|
||||||
- if [[ ! $skip && ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
|
- |
|
||||||
|
# phpinfo
|
||||||
|
if [[ ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
|
||||||
|
|
||||||
|
- |
|
||||||
|
run_tests () {
|
||||||
|
set -e
|
||||||
|
if [[ $skip ]]; then
|
||||||
|
echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"
|
||||||
|
elif [[ $deps = high ]]; then
|
||||||
|
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'"
|
||||||
|
elif [[ $deps = low ]]; then
|
||||||
|
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'" &&
|
||||||
|
# Test the PhpUnit bridge on PHP 5.3, using the original phpunit script
|
||||||
|
tfold src/Symfony/Bridge/PhpUnit \
|
||||||
|
"cd src/Symfony/Bridge/PhpUnit && wget https://phar.phpunit.de/phpunit-4.8.phar && phpenv global 5.3 && $COMPOSER_UP && php phpunit-4.8.phar"
|
||||||
|
elif [[ $PHP = hhvm* ]]; then
|
||||||
|
$PHPUNIT --exclude-group benchmark,intl-data
|
||||||
|
else
|
||||||
|
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
|
||||||
|
tfold tty-group $PHPUNIT --group tty
|
||||||
|
if [[ $PHP = ${MIN_PHP%.*} ]]; then
|
||||||
|
echo -e "1\\n0" | xargs -I{} bash -c "tfold src/Symfony/Component/Process.sigchild{} SYMFONY_DEPRECATIONS_HELPER=weak ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- REPORT=' && echo -e "\\e[32mOK\\e[0m {}\\n\\n" || (echo -e "\\e[41mKO\\e[0m {}\\n\\n" && $(exit 1))'
|
- (run_tests)
|
||||||
- if [[ $skip ]]; then echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"; fi
|
|
||||||
- if [[ ! $deps && ! $PHP = hhvm* ]]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'"$REPORT"; fi
|
|
||||||
- if [[ ! $deps && ! $PHP = hhvm* ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi
|
|
||||||
- if [[ ! $deps && $PHP = hhvm* ]]; then $PHPUNIT --exclude-group benchmark,intl-data; fi
|
|
||||||
- if [[ ! $deps && $PHP = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'echo "\\nPHP --enable-sigchild enhanced={}" && SYMFONY_DEPRECATIONS_HELPER=weak ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi
|
|
||||||
- if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --no-suggest --ansi; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY"$REPORT"; fi
|
|
||||||
- if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --no-suggest --ansi --prefer-lowest --prefer-stable; $PHPUNIT --exclude-group tty,benchmark,intl-data'"$REPORT"; fi
|
|
||||||
# Test the PhpUnit bridge using the original phpunit script
|
|
||||||
- if [[ $deps = low ]]; then (cd src/Symfony/Bridge/PhpUnit && wget https://phar.phpunit.de/phpunit-4.8.phar); fi
|
|
||||||
- if [[ $deps = low ]]; then (cd src/Symfony/Bridge/PhpUnit && phpenv global 5.3 && php --version && composer update && php phpunit-4.8.phar); fi
|
|
||||||
|
@ -64,6 +64,7 @@ a.doc:hover {
|
|||||||
|
|
||||||
.anchor {
|
.anchor {
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -7em;
|
padding-top: 7em;
|
||||||
|
margin-top: -7em;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,8 @@ class Application
|
|||||||
* @param OutputInterface $output An Output instance
|
* @param OutputInterface $output An Output instance
|
||||||
*
|
*
|
||||||
* @return int 0 if everything went fine, or an error code
|
* @return int 0 if everything went fine, or an error code
|
||||||
|
*
|
||||||
|
* @throws \Exception When running fails. Bypass this when {@link setCatchExceptions()}.
|
||||||
*/
|
*/
|
||||||
public function run(InputInterface $input = null, OutputInterface $output = null)
|
public function run(InputInterface $input = null, OutputInterface $output = null)
|
||||||
{
|
{
|
||||||
|
@ -203,6 +203,8 @@ class Command
|
|||||||
*
|
*
|
||||||
* @return int The command exit code
|
* @return int The command exit code
|
||||||
*
|
*
|
||||||
|
* @throws \Exception When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}.
|
||||||
|
*
|
||||||
* @see setCode()
|
* @see setCode()
|
||||||
* @see execute()
|
* @see execute()
|
||||||
*/
|
*/
|
||||||
|
@ -100,6 +100,7 @@ class ErrorHandler
|
|||||||
private static $stackedErrors = array();
|
private static $stackedErrors = array();
|
||||||
private static $stackedErrorLevels = array();
|
private static $stackedErrorLevels = array();
|
||||||
private static $toStringException = null;
|
private static $toStringException = null;
|
||||||
|
private static $exitCode = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers the error handler.
|
* Registers the error handler.
|
||||||
@ -511,6 +512,9 @@ class ErrorHandler
|
|||||||
*/
|
*/
|
||||||
public function handleException($exception, array $error = null)
|
public function handleException($exception, array $error = null)
|
||||||
{
|
{
|
||||||
|
if (null === $error) {
|
||||||
|
self::$exitCode = 255;
|
||||||
|
}
|
||||||
if (!$exception instanceof \Exception) {
|
if (!$exception instanceof \Exception) {
|
||||||
$exception = new FatalThrowableError($exception);
|
$exception = new FatalThrowableError($exception);
|
||||||
}
|
}
|
||||||
@ -586,7 +590,7 @@ class ErrorHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $error) {
|
if ($exit = null === $error) {
|
||||||
$error = error_get_last();
|
$error = error_get_last();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,15 +614,21 @@ class ErrorHandler
|
|||||||
} else {
|
} else {
|
||||||
$exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
|
$exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
|
||||||
}
|
}
|
||||||
} elseif (!isset($exception)) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (isset($exception)) {
|
||||||
|
self::$exitCode = 255;
|
||||||
$handler->handleException($exception, $error);
|
$handler->handleException($exception, $error);
|
||||||
|
}
|
||||||
} catch (FatalErrorException $e) {
|
} catch (FatalErrorException $e) {
|
||||||
// Ignore this re-throw
|
// Ignore this re-throw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($exit && self::$exitCode) {
|
||||||
|
$exitCode = self::$exitCode;
|
||||||
|
register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<phpunit backupGlobals="false"
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
backupStaticAttributes="false"
|
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
|
||||||
|
backupGlobals="false"
|
||||||
colors="true"
|
colors="true"
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
processIsolation="false"
|
|
||||||
stopOnFailure="false"
|
|
||||||
syntaxCheck="false"
|
|
||||||
bootstrap="vendor/autoload.php"
|
bootstrap="vendor/autoload.php"
|
||||||
failOnRisky="true"
|
failOnRisky="true"
|
||||||
failOnWarning="true"
|
failOnWarning="true"
|
||||||
|
@ -888,7 +888,7 @@ class Request
|
|||||||
* ("Client-Ip" for instance), configure it via "setTrustedHeaderName()" with
|
* ("Client-Ip" for instance), configure it via "setTrustedHeaderName()" with
|
||||||
* the "client-ip" key.
|
* the "client-ip" key.
|
||||||
*
|
*
|
||||||
* @return string The client IP address
|
* @return string|null The client IP address
|
||||||
*
|
*
|
||||||
* @see getClientIps()
|
* @see getClientIps()
|
||||||
* @see http://en.wikipedia.org/wiki/X-Forwarded-For
|
* @see http://en.wikipedia.org/wiki/X-Forwarded-For
|
||||||
|
@ -918,7 +918,7 @@ class ResponseTest extends ResponseTestCase
|
|||||||
)));
|
)));
|
||||||
|
|
||||||
$ianaHttpStatusCodes->load('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml');
|
$ianaHttpStatusCodes->load('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml');
|
||||||
if (!$ianaHttpStatusCodes->relaxNGValidate('https://www.iana.org/assignments/http-status-codes/http-status-codes.rng')) {
|
if (!$ianaHttpStatusCodes->relaxNGValidate(__DIR__.'/schema/http-status-codes.rng')) {
|
||||||
self::fail('Invalid IANA\'s HTTP status code list.');
|
self::fail('Invalid IANA\'s HTTP status code list.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version='1.0'?>
|
||||||
|
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||||
|
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
|
||||||
|
ns="http://www.iana.org/assignments">
|
||||||
|
|
||||||
|
<include href="iana-registry.rng"/>
|
||||||
|
|
||||||
|
<start>
|
||||||
|
<element name="registry">
|
||||||
|
<ref name="registryMeta"/>
|
||||||
|
<element name="registry">
|
||||||
|
<ref name="registryMeta"/>
|
||||||
|
<zeroOrMore>
|
||||||
|
<element name="record">
|
||||||
|
<optional>
|
||||||
|
<attribute name="date"><ref name="genericDate"/></attribute>
|
||||||
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<attribute name="updated"><ref name="genericDate"/></attribute>
|
||||||
|
</optional>
|
||||||
|
<element name="value"><ref name="genericRange"/></element>
|
||||||
|
<element name="description"><text/></element>
|
||||||
|
<ref name="references"/>
|
||||||
|
</element>
|
||||||
|
</zeroOrMore>
|
||||||
|
</element>
|
||||||
|
<ref name="people"/>
|
||||||
|
</element>
|
||||||
|
</start>
|
||||||
|
|
||||||
|
</grammar>
|
@ -0,0 +1,198 @@
|
|||||||
|
<?xml version='1.0'?>
|
||||||
|
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||||
|
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
|
||||||
|
ns="http://www.iana.org/assignments">
|
||||||
|
|
||||||
|
<define name="registryMeta">
|
||||||
|
<interleave>
|
||||||
|
<attribute name="id"><data type="ID"/></attribute>
|
||||||
|
<optional><element name="title"><ref name="text_with_references"/></element></optional>
|
||||||
|
<optional><element name="created"><ref name="genericDate"/></element></optional>
|
||||||
|
<optional><element name="updated"><data type="date"/></element></optional>
|
||||||
|
<optional><element name="registration_rule"><ref
|
||||||
|
name="text_with_references"/></element></optional>
|
||||||
|
<optional><element name="expert"><text/></element></optional>
|
||||||
|
<optional><element name="description"><ref name="text_with_references"/></element></optional>
|
||||||
|
<zeroOrMore><element name="note"><ref name="text_with_references"/></element></zeroOrMore>
|
||||||
|
<ref name="references"/>
|
||||||
|
<optional><element name="hide"><empty/></element></optional>
|
||||||
|
<zeroOrMore><element name="category"><text/></element></zeroOrMore>
|
||||||
|
<zeroOrMore><ref name="range"/></zeroOrMore>
|
||||||
|
<optional><ref name="file"/></optional>
|
||||||
|
</interleave>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="range">
|
||||||
|
<element name="range">
|
||||||
|
<interleave>
|
||||||
|
<element name="value"><text/></element>
|
||||||
|
<optional><element name="hex"><text/></element></optional>
|
||||||
|
<element name="registration_rule"><ref name="text_with_references"/></element>
|
||||||
|
<optional><element name="note"><ref name="text_with_references"/></element></optional>
|
||||||
|
<optional><ref name="xref"/></optional>
|
||||||
|
</interleave>
|
||||||
|
</element>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="people">
|
||||||
|
<element name="people">
|
||||||
|
<zeroOrMore>
|
||||||
|
<element name="person">
|
||||||
|
<attribute name="id"><data type="ID"/></attribute>
|
||||||
|
<optional><element name="name"><text/></element></optional>
|
||||||
|
<optional><element name="org"><text/></element></optional>
|
||||||
|
<zeroOrMore><element name="uri"><data type="anyURI"/></element></zeroOrMore>
|
||||||
|
<optional><element name="updated"><ref name="genericDate"/></element></optional>
|
||||||
|
</element>
|
||||||
|
</zeroOrMore>
|
||||||
|
</element>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="xref">
|
||||||
|
<element name="xref">
|
||||||
|
<optional>
|
||||||
|
<attribute name="lastupdated"><ref name="genericDate"/></attribute>
|
||||||
|
</optional>
|
||||||
|
<choice>
|
||||||
|
<group>
|
||||||
|
<attribute name="type"><value>uri</value></attribute>
|
||||||
|
<attribute name="data"><data type="anyURI"/></attribute>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<attribute name="type"><value>rfc</value></attribute>
|
||||||
|
<attribute name="data">
|
||||||
|
<data type="string">
|
||||||
|
<param name="pattern">(rfc|bcp|std)\d+</param>
|
||||||
|
</data>
|
||||||
|
</attribute>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<attribute name="type"><value>rfc-errata</value></attribute>
|
||||||
|
<attribute name="data"><data type="positiveInteger"/></attribute>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<attribute name="type"><value>draft</value></attribute>
|
||||||
|
<attribute name="data">
|
||||||
|
<data type="string">
|
||||||
|
<param name="pattern">(draft|RFC)(-[a-zA-Z0-9]+)+</param>
|
||||||
|
</data>
|
||||||
|
</attribute>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<attribute name="type"><value>registry</value></attribute>
|
||||||
|
<attribute name="data"><data type="NCName"/></attribute>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<attribute name="type"><value>person</value></attribute>
|
||||||
|
<attribute name="data"><data type="NCName"/></attribute>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<attribute name="type"><value>text</value></attribute>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<attribute name="type"><value>note</value></attribute>
|
||||||
|
<attribute name="data"><data type="positiveInteger"/></attribute>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<attribute name="type"><value>unicode</value></attribute>
|
||||||
|
<attribute name="data">
|
||||||
|
<data type="string">
|
||||||
|
<param name="pattern">ucd\d+\.\d+\.\d+</param>
|
||||||
|
</data>
|
||||||
|
</attribute>
|
||||||
|
</group>
|
||||||
|
</choice>
|
||||||
|
<text/>
|
||||||
|
</element>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="references">
|
||||||
|
<zeroOrMore>
|
||||||
|
<ref name="xref"/>
|
||||||
|
</zeroOrMore>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="text_with_references">
|
||||||
|
<interleave>
|
||||||
|
<zeroOrMore>
|
||||||
|
<text/>
|
||||||
|
<optional><ref name="xref"/></optional>
|
||||||
|
</zeroOrMore>
|
||||||
|
</interleave>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="richText">
|
||||||
|
<zeroOrMore>
|
||||||
|
<choice>
|
||||||
|
<interleave>
|
||||||
|
<ref name="text_with_references"/>
|
||||||
|
<optional><element name="br"><empty/></element></optional>
|
||||||
|
</interleave>
|
||||||
|
<element name="paragraph">
|
||||||
|
<interleave>
|
||||||
|
<ref name="text_with_references"/>
|
||||||
|
<optional><element name="br"><empty/></element></optional>
|
||||||
|
</interleave>
|
||||||
|
</element>
|
||||||
|
<element name="artwork"><text/></element>
|
||||||
|
</choice>
|
||||||
|
</zeroOrMore>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="genericRange">
|
||||||
|
<data type="string">
|
||||||
|
<param name="pattern">(\d+|0x[\da-fA-F]+)(\s*-\s*(\d+|0x[\da-fA-F]+))?</param>
|
||||||
|
</data>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="genericDate">
|
||||||
|
<choice>
|
||||||
|
<data type="date"/>
|
||||||
|
<data type="gYearMonth"/>
|
||||||
|
</choice>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="hex32">
|
||||||
|
<data type="string">
|
||||||
|
<param name="pattern">0x[0-9]{8}</param>
|
||||||
|
</data>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="binary">
|
||||||
|
<data type="string">
|
||||||
|
<param name="pattern">[0-1]+</param>
|
||||||
|
</data>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="footnotes">
|
||||||
|
<zeroOrMore>
|
||||||
|
<element name="footnote">
|
||||||
|
<attribute name="anchor"><data type="positiveInteger"/></attribute>
|
||||||
|
<interleave>
|
||||||
|
<zeroOrMore>
|
||||||
|
<text/>
|
||||||
|
<optional><ref name="xref"/></optional>
|
||||||
|
</zeroOrMore>
|
||||||
|
</interleave>
|
||||||
|
</element>
|
||||||
|
</zeroOrMore>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="file">
|
||||||
|
<element name="file">
|
||||||
|
<attribute name="type">
|
||||||
|
<choice>
|
||||||
|
<value>legacy</value>
|
||||||
|
<value>mib</value>
|
||||||
|
<value>template</value>
|
||||||
|
<value>json</value>
|
||||||
|
</choice>
|
||||||
|
</attribute>
|
||||||
|
<optional>
|
||||||
|
<attribute name="name"/>
|
||||||
|
</optional>
|
||||||
|
<data type="anyURI"/>
|
||||||
|
</element>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
</grammar>
|
@ -70,7 +70,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||||||
$properties = array();
|
$properties = array();
|
||||||
foreach ($reflectionProperties as $reflectionProperty) {
|
foreach ($reflectionProperties as $reflectionProperty) {
|
||||||
if ($reflectionProperty->isPublic()) {
|
if ($reflectionProperty->isPublic()) {
|
||||||
$properties[$reflectionProperty->name] = true;
|
$properties[$reflectionProperty->name] = $reflectionProperty->name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,10 +86,10 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||||||
if (!$reflectionClass->hasProperty($propertyName) && !preg_match('/^[A-Z]{2,}/', $propertyName)) {
|
if (!$reflectionClass->hasProperty($propertyName) && !preg_match('/^[A-Z]{2,}/', $propertyName)) {
|
||||||
$propertyName = lcfirst($propertyName);
|
$propertyName = lcfirst($propertyName);
|
||||||
}
|
}
|
||||||
$properties[$propertyName] = true;
|
$properties[$propertyName] = $propertyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
return array_keys($properties);
|
return array_values($properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,7 +50,7 @@ class SerializerExtractor implements PropertyListExtractorInterface
|
|||||||
$serializerClassMetadata = $this->classMetadataFactory->getMetadataFor($class);
|
$serializerClassMetadata = $this->classMetadataFactory->getMetadataFor($class);
|
||||||
|
|
||||||
foreach ($serializerClassMetadata->getAttributesMetadata() as $serializerAttributeMetadata) {
|
foreach ($serializerClassMetadata->getAttributesMetadata() as $serializerAttributeMetadata) {
|
||||||
if (count(array_intersect($context['serializer_groups'], $serializerAttributeMetadata->getGroups())) > 0) {
|
if (array_intersect($context['serializer_groups'], $serializerAttributeMetadata->getGroups())) {
|
||||||
$properties[] = $serializerAttributeMetadata->getName();
|
$properties[] = $serializerAttributeMetadata->getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class ReflectionExtractorTest extends TestCase
|
|||||||
|
|
||||||
public function testGetProperties()
|
public function testGetProperties()
|
||||||
{
|
{
|
||||||
$this->assertEquals(
|
$this->assertSame(
|
||||||
array(
|
array(
|
||||||
'bal',
|
'bal',
|
||||||
'parent',
|
'parent',
|
||||||
@ -50,6 +50,7 @@ class ReflectionExtractorTest extends TestCase
|
|||||||
'a',
|
'a',
|
||||||
'DOB',
|
'DOB',
|
||||||
'Id',
|
'Id',
|
||||||
|
'123',
|
||||||
'c',
|
'c',
|
||||||
'd',
|
'd',
|
||||||
'e',
|
'e',
|
||||||
|
@ -116,4 +116,8 @@ class Dummy extends ParentDummy
|
|||||||
public function getId()
|
public function getId()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function get123()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<phpunit backupGlobals="false"
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
backupStaticAttributes="false"
|
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
|
||||||
|
backupGlobals="false"
|
||||||
colors="true"
|
colors="true"
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
processIsolation="false"
|
|
||||||
stopOnFailure="false"
|
|
||||||
syntaxCheck="false"
|
|
||||||
bootstrap="vendor/autoload.php"
|
bootstrap="vendor/autoload.php"
|
||||||
failOnRisky="true"
|
failOnRisky="true"
|
||||||
failOnWarning="true"
|
failOnWarning="true"
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<phpunit backupGlobals="false"
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
backupStaticAttributes="false"
|
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
|
||||||
|
backupGlobals="false"
|
||||||
colors="true"
|
colors="true"
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
processIsolation="false"
|
|
||||||
stopOnFailure="false"
|
|
||||||
syntaxCheck="false"
|
|
||||||
bootstrap="vendor/autoload.php"
|
bootstrap="vendor/autoload.php"
|
||||||
failOnRisky="true"
|
failOnRisky="true"
|
||||||
failOnWarning="true"
|
failOnWarning="true"
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<phpunit backupGlobals="false"
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
backupStaticAttributes="false"
|
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
|
||||||
|
backupGlobals="false"
|
||||||
colors="true"
|
colors="true"
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
processIsolation="false"
|
|
||||||
stopOnFailure="false"
|
|
||||||
syntaxCheck="false"
|
|
||||||
bootstrap="vendor/autoload.php"
|
bootstrap="vendor/autoload.php"
|
||||||
failOnRisky="true"
|
failOnRisky="true"
|
||||||
failOnWarning="true"
|
failOnWarning="true"
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<phpunit backupGlobals="false"
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
backupStaticAttributes="false"
|
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
|
||||||
|
backupGlobals="false"
|
||||||
colors="true"
|
colors="true"
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
processIsolation="false"
|
|
||||||
stopOnFailure="false"
|
|
||||||
syntaxCheck="false"
|
|
||||||
bootstrap="vendor/autoload.php"
|
bootstrap="vendor/autoload.php"
|
||||||
failOnRisky="true"
|
failOnRisky="true"
|
||||||
failOnWarning="true"
|
failOnWarning="true"
|
||||||
|
@ -807,7 +807,7 @@ EOHTML
|
|||||||
$attr['href'] = $href;
|
$attr['href'] = $href;
|
||||||
}
|
}
|
||||||
if (isset($attr['href'])) {
|
if (isset($attr['href'])) {
|
||||||
$v = sprintf('<a href="%s">%s</a>', esc($this->utf8Encode($attr['href'])), $v);
|
$v = sprintf('<a href="%s" target="_blank" rel="noopener noreferrer">%s</a>', esc($this->utf8Encode($attr['href'])), $v);
|
||||||
}
|
}
|
||||||
if (isset($attr['lang'])) {
|
if (isset($attr['lang'])) {
|
||||||
$v = sprintf('<code class="%s">%s</code>', esc($attr['lang']), $v);
|
$v = sprintf('<code class="%s">%s</code>', esc($attr['lang']), $v);
|
||||||
|
@ -100,7 +100,7 @@ EODUMP;
|
|||||||
|
|
||||||
$expectedDump = <<<'EODUMP'
|
$expectedDump = <<<'EODUMP'
|
||||||
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
|
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
|
||||||
<span class=sf-dump-index>0</span> => "<a href="%sStubCasterTest.php:0"><span class=sf-dump-str title="55 characters">Symfony\Component\VarDumper\Tests\Caster\StubCasterTest</span></a>"
|
<span class=sf-dump-index>0</span> => "<a href="%sStubCasterTest.php:0" target="_blank" rel="noopener noreferrer"><span class=sf-dump-str title="55 characters">Symfony\Component\VarDumper\Tests\Caster\StubCasterTest</span></a>"
|
||||||
</samp>]
|
</samp>]
|
||||||
</bar>
|
</bar>
|
||||||
EODUMP;
|
EODUMP;
|
||||||
@ -120,7 +120,7 @@ EODUMP;
|
|||||||
|
|
||||||
$expectedDump = <<<'EODUMP'
|
$expectedDump = <<<'EODUMP'
|
||||||
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
|
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
|
||||||
<span class=sf-dump-index>0</span> => "<a href="%sFooInterface.php:10"><span class=sf-dump-str title="5 characters">hello</span></a>"
|
<span class=sf-dump-index>0</span> => "<a href="%sFooInterface.php:10" target="_blank" rel="noopener noreferrer"><span class=sf-dump-str title="5 characters">hello</span></a>"
|
||||||
</samp>]
|
</samp>]
|
||||||
</bar>
|
</bar>
|
||||||
EODUMP;
|
EODUMP;
|
||||||
@ -161,7 +161,7 @@ EODUMP;
|
|||||||
|
|
||||||
$expectedDump = <<<'EODUMP'
|
$expectedDump = <<<'EODUMP'
|
||||||
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
|
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
|
||||||
<span class=sf-dump-index>0</span> => "<a href="%sFooInterface.php:5"><span class=sf-dump-str title="5 characters">hello</span></a>"
|
<span class=sf-dump-index>0</span> => "<a href="%sFooInterface.php:5" target="_blank" rel="noopener noreferrer"><span class=sf-dump-str title="5 characters">hello</span></a>"
|
||||||
</samp>]
|
</samp>]
|
||||||
</bar>
|
</bar>
|
||||||
EODUMP;
|
EODUMP;
|
||||||
|
Reference in New Issue
Block a user