mirror of
https://github.com/tag1consulting/d7_to_d10_migration.git
synced 2025-06-19 02:45:12 +00:00
Initial commit
This commit is contained in:
commit
c5e731d8ae
2773 changed files with 600767 additions and 0 deletions
drupal7/web/misc/brumann/polyfill-unserialize
4
drupal7/web/misc/brumann/polyfill-unserialize/.gitignore
vendored
Normal file
4
drupal7/web/misc/brumann/polyfill-unserialize/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
/vendor/
|
||||
/phpunit.xml
|
||||
/.composer.lock
|
||||
|
20
drupal7/web/misc/brumann/polyfill-unserialize/.travis.yml
Normal file
20
drupal7/web/misc/brumann/polyfill-unserialize/.travis.yml
Normal file
|
@ -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
|
21
drupal7/web/misc/brumann/polyfill-unserialize/LICENSE
Normal file
21
drupal7/web/misc/brumann/polyfill-unserialize/LICENSE
Normal file
|
@ -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.
|
61
drupal7/web/misc/brumann/polyfill-unserialize/README.md
Normal file
61
drupal7/web/misc/brumann/polyfill-unserialize/README.md
Normal file
|
@ -0,0 +1,61 @@
|
|||
Polyfill unserialize [](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.
|
26
drupal7/web/misc/brumann/polyfill-unserialize/composer.json
Normal file
26
drupal7/web/misc/brumann/polyfill-unserialize/composer.json
Normal file
|
@ -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": "denis.brumann@sensiolabs.de"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Brumann\\Polyfill\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\Brumann\\Polyfill\\": "tests/"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"require": {
|
||||
"php": "^5.3|^7.0"
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue