-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to Drupal 7.67. For more information, see https://www.drupal.o…
- Loading branch information
1 parent
5075a31
commit 4b8e906
Showing
30 changed files
with
1,723 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/vendor/ | ||
/phpunit.xml | ||
/.composer.lock | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
language: php | ||
|
||
sudo: false | ||
|
||
php: | ||
- '5.3' | ||
- '5.4' | ||
- '5.5' | ||
- '5.6' | ||
- '7.0' | ||
- '7.1' | ||
|
||
before_install: | ||
- phpenv config-rm xdebug.ini | ||
- composer self-update | ||
|
||
install: | ||
- composer install | ||
|
||
script: phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2016 Denis Brumann | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
Polyfill unserialize [![Build Status](https://travis-ci.org/dbrumann/polyfill-unserialize.svg?branch=master)](https://travis-ci.org/dbrumann/polyfill-unserialize) | ||
=== | ||
|
||
Backports unserialize options introduced in PHP 7.0 to older PHP versions. | ||
This was originally designed as a Proof of Concept for Symfony Issue [#21090](https://github.com/symfony/symfony/pull/21090). | ||
|
||
You can use this package in projects that rely on PHP versions older than PHP 7.0. | ||
In case you are using PHP 7.0+ the original `unserialize()` will be used instead. | ||
|
||
From the [documentation](https://secure.php.net/manual/en/function.unserialize.php): | ||
|
||
> Warning: Do not pass untrusted user input to unserialize(). Unserialization can | ||
> result in code being loaded and executed due to object instantiation | ||
> and autoloading, and a malicious user may be able to exploit this. | ||
This warning holds true even when `allowed_classes` is used. | ||
|
||
Requirements | ||
------------ | ||
|
||
- PHP 5.3+ | ||
|
||
Installation | ||
------------ | ||
|
||
You can install this package via composer: | ||
|
||
``` | ||
composer require brumann/polyfill-unserialize "^1.0" | ||
``` | ||
|
||
Known Issues | ||
------------ | ||
|
||
There is a mismatch in behavior when `allowed_classes` in `$options` is not | ||
of the correct type (array or boolean). PHP 7.1 will issue a warning, whereas | ||
PHP 7.0 will not. I opted to copy the behavior of the former. | ||
|
||
Tests | ||
----- | ||
|
||
You can run the test suite using PHPUnit. It is intentionally not bundled as | ||
dev dependency to make sure this package has the lowest restrictions on the | ||
implementing system as possible. | ||
|
||
Please read the [PHPUnit Manual](https://phpunit.de/manual/current/en/installation.html) | ||
for information how to install it on your system. | ||
|
||
You can run the test suite as follows: | ||
|
||
``` | ||
phpunit -c phpunit.xml.dist tests/ | ||
``` | ||
|
||
Contributing | ||
------------ | ||
|
||
This package is considered feature complete. As such I will likely not update it | ||
unless there are security issues. | ||
|
||
Should you find any bugs or have questions, feel free to submit an Issue or a Pull Request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "brumann/polyfill-unserialize", | ||
"description": "Backports unserialize options introduced in PHP 7.0 to older PHP versions.", | ||
"type": "library", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Denis Brumann", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Brumann\\Polyfill\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Tests\\Brumann\\Polyfill\\": "tests/" | ||
} | ||
}, | ||
"minimum-stability": "stable", | ||
"require": { | ||
"php": "^5.3|^7.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" | ||
backupGlobals="false" | ||
colors="true" | ||
bootstrap="vendor/autoload.php" | ||
> | ||
<php> | ||
<ini name="error_reporting" value="-1" /> | ||
</php> | ||
|
||
<testsuites> | ||
<testsuite name="Brumann\Polyfill Test Suite"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory>./src/</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace Brumann\Polyfill; | ||
|
||
final class Unserialize | ||
{ | ||
/** | ||
* @see https://secure.php.net/manual/en/function.unserialize.php | ||
* | ||
* @param string $serialized Serialized data | ||
* @param array $options Associative array containing options | ||
* | ||
* @return mixed | ||
*/ | ||
public static function unserialize($serialized, array $options = array()) | ||
{ | ||
if (PHP_VERSION_ID >= 70000) { | ||
return \unserialize($serialized, $options); | ||
} | ||
if (!array_key_exists('allowed_classes', $options)) { | ||
$options['allowed_classes'] = true; | ||
} | ||
$allowedClasses = $options['allowed_classes']; | ||
if (true === $allowedClasses) { | ||
return \unserialize($serialized); | ||
} | ||
if (false === $allowedClasses) { | ||
$allowedClasses = array(); | ||
} | ||
if (!is_array($allowedClasses)) { | ||
trigger_error( | ||
'unserialize(): allowed_classes option should be array or boolean', | ||
E_USER_WARNING | ||
); | ||
$allowedClasses = array(); | ||
} | ||
|
||
$sanitizedSerialized = preg_replace_callback( | ||
'/(^|;)O:\d+:"([^"]*)":(\d+):{/', | ||
function ($match) use ($allowedClasses) { | ||
list($completeMatch, $leftBorder, $className, $objectSize) = $match; | ||
if (in_array($className, $allowedClasses)) { | ||
return $completeMatch; | ||
} else { | ||
return sprintf( | ||
'%sO:22:"__PHP_Incomplete_Class":%d:{s:27:"__PHP_Incomplete_Class_Name";%s', | ||
$leftBorder, | ||
$objectSize + 1, // size of object + 1 for added string | ||
\serialize($className) | ||
); | ||
} | ||
}, | ||
$serialized | ||
); | ||
|
||
return \unserialize($sanitizedSerialized); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.idea | ||
vendor/ | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.