This repository was archived by the owner on Jan 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Better polyfill support for Stdlib and Session #3966
Merged
Freeaqingme
merged 24 commits into
zendframework:master
from
weierophinney:hotfix/polyfill-via-class-alias
Mar 6, 2013
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
b412389
Reworked polyfill support for Zend\Stdlib\ArrayObject
weierophinney 1e287e0
Reworked polyfill support for Zend\Session
weierophinney aaedc2a
Solved failing test in ArrayObject tests
weierophinney 1232872
Fix failing Zend\Session test under 5.3.3
weierophinney 3bf2855
Re-added autoload.php files
weierophinney 843ac05
Fix typo
weierophinney 05bc3b1
Fix polyfill support issue in CSRF validator
weierophinney 41dbee9
Typehint on AbstractContainer, but instantiate Container
weierophinney d1e7d9d
Renamed compat autoload files and marked as deprecated
weierophinney 010f534
Remove class_exists check
weierophinney a94f497
Fake scanners out
weierophinney 5ead25d
Class stubs to force classmap generation
weierophinney e206193
Allow finding class definitions following halt_compiler
weierophinney 00ee382
Added note in README about new polyfill support
weierophinney 2af4f12
Updated README to detail full change for polyfills
weierophinney ee14182
Trigger E_USER_DEPRECATED in deprecated polyfill autoload files
weierophinney e6724fc
Simpler polyfill support
weierophinney 7aededd
Revert changes to ClassFileLocator
weierophinney 5761918
Revert changes to CSRF validator
weierophinney ecd744f
Added "build/" to gitignore
weierophinney 9a6cde7
Updated README
weierophinney eb3f0cc
Mark all polyfill bases as abstract
weierophinney 049d94c
Don't need an additional polyfill class for Container
weierophinney a1adc02
Do not need 5.3.3 polyfill for SessionArrayStorage
weierophinney File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,10 +1,11 @@ | ||
| nbproject | ||
| .idea | ||
| .buildpath | ||
| .DS_Store | ||
| .idea | ||
| .project | ||
| .settings/ | ||
| tmp/ | ||
| .DS_Store | ||
| composer.lock | ||
| .*.sw* | ||
| .*.un~ | ||
| build/ | ||
| composer.lock | ||
| nbproject | ||
| tmp/ |
This file contains hidden or 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 hidden or 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 hidden or 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
37 changes: 37 additions & 0 deletions
37
library/Zend/Session/Container/PhpReferenceCompatibility.php
This file contains hidden or 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,37 @@ | ||
| <?php | ||
| /** | ||
| * Zend Framework (http://framework.zend.com/) | ||
| * | ||
| * @link http://github.com/zendframework/zf2 for the canonical source repository | ||
| * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) | ||
| * @license http://framework.zend.com/license/new-bsd New BSD License | ||
| */ | ||
|
|
||
| namespace Zend\Session\Container; | ||
|
|
||
| use Zend\Session\AbstractContainer; | ||
|
|
||
| /** | ||
| * Session storage container for PHP 5.3.4 and above. | ||
| */ | ||
| abstract class PhpReferenceCompatibility extends AbstractContainer | ||
| { | ||
| /** | ||
| * Retrieve a specific key in the container | ||
| * | ||
| * @param string $key | ||
| * @return mixed | ||
| */ | ||
| public function &offsetGet($key) | ||
| { | ||
| $ret = null; | ||
| if (!$this->offsetExists($key)) { | ||
| return $ret; | ||
| } | ||
| $storage = $this->getStorage(); | ||
| $name = $this->getName(); | ||
| $ret =& $storage[$name][$key]; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the change needed? (This is the original formatting from @mwillbanks -- just moved to a new file.) |
||
|
|
||
| return $ret; | ||
| } | ||
| } | ||
This file contains hidden or 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
40 changes: 40 additions & 0 deletions
40
library/Zend/Session/Storage/SessionArrayStorage/PhpReferenceCompatibility.php
This file contains hidden or 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,40 @@ | ||
| <?php | ||
| /** | ||
| * Zend Framework (http://framework.zend.com/) | ||
| * | ||
| * @link http://github.com/zendframework/zf2 for the canonical source repository | ||
| * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) | ||
| * @license http://framework.zend.com/license/new-bsd New BSD License | ||
| */ | ||
|
|
||
| namespace Zend\Session\Storage\SessionArrayStorage; | ||
|
|
||
| use Zend\Session\Storage\AbstractSessionArrayStorage; | ||
|
|
||
| /** | ||
| * PHP 5.3.4 and greater variant of SessionArrayStorage | ||
| */ | ||
| abstract class PhpReferenceCompatibility extends AbstractSessionArrayStorage | ||
| { | ||
| /** | ||
| * Get Offset | ||
| * | ||
| * @param mixed $key | ||
| * @return mixed | ||
| */ | ||
| public function &__get($key) | ||
| { | ||
| return $_SESSION[$key]; | ||
| } | ||
|
|
||
| /** | ||
| * Offset Get | ||
| * | ||
| * @param mixed $key | ||
| * @return mixed | ||
| */ | ||
| public function &offsetGet($key) | ||
| { | ||
| return $_SESSION[$key]; | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
library/Zend/Session/compatibility/Storage/SessionArrayStorage.php
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
| @@ -1,11 +1,14 @@ | ||
| <?php | ||
| if (version_compare(PHP_VERSION, '5.3.4', 'lt')) { | ||
| if (!class_exists('Zend\Stdlib\ArrayObject', false) | ||
| && file_exists(__DIR__ . '/../../Stdlib/compatibility/autoload.php') | ||
| ) { | ||
| require __DIR__ . '/../../Stdlib/compatibility/autoload.php'; | ||
| } | ||
| /** | ||
| * Zend Framework (http://framework.zend.com/) | ||
| * | ||
| * @link http://github.com/zendframework/zf2 for the canonical source repository | ||
| * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) | ||
| * @license http://framework.zend.com/license/new-bsd New BSD License | ||
| * @deprecated | ||
| */ | ||
|
|
||
| require_once __DIR__ . '/Container.php'; | ||
| require_once __DIR__ . '/Storage/SessionArrayStorage.php'; | ||
| } | ||
| /** | ||
| * Legacy purposes only, to prevent code that references it from breaking. | ||
| */ | ||
| trigger_error('Polyfill autoload support (file library/Zend/Session/compatibility/autoload.php) is no longer necessary; please remove your require statement referencing this file', E_USER_DEPRECATED); |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this paragraph have some kind of caption or title? If we add more to this readme, it would ease on legibility. Although I'm not entirely sure this is merely hypothetical.
Also, this is part of the changelog for 2.1.4. Shouldn't we also add it to the change log for 2.2, so that people who upgrade from minor to minor release get to see the list of changes? (I'm not sure discussing this on this PR is the right place to do so though).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will go into CHANGELOG.md when we release 2.1.4, and that always gets merged back to develop as well.
IF we have more updates we want to call out, we can add additional subheaders; with only one, there's no need yet.