aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-07-05 10:35:41 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-07-05 10:39:00 +0200
commit2df6f61d536ebad833bea5e68900fab38bbc80ab (patch)
tree94dc6274cf11f06f531b390e7485825d2ce4545d
parentb6c13352913d7cf51f4184306a8dc7d0b5621156 (diff)
downloadIterator-2df6f61d536ebad833bea5e68900fab38bbc80ab.zip
Iterator-2df6f61d536ebad833bea5e68900fab38bbc80ab.tar.gz
Iterator-2df6f61d536ebad833bea5e68900fab38bbc80ab.tar.bz2
Find another workaround for the PHP bug #65136.
The previous fix did not work in rare cases. This fix seems to work well. It avoids a seg fault and a bus error (when compiled with --enable-dtrace).
-rw-r--r--Recursive/Directory.php34
1 files changed, 6 insertions, 28 deletions
diff --git a/Recursive/Directory.php b/Recursive/Directory.php
index f3cc294..4a5c37d 100644
--- a/Recursive/Directory.php
+++ b/Recursive/Directory.php
@@ -53,21 +53,15 @@ class Directory extends \RecursiveDirectoryIterator {
*
* @var \Hoa\Iterator\Recursive\Directory string
*/
- protected $_splFileInfoClass = null;
+ protected $_splFileInfoClass = null;
/**
* Relative path.
+ * Using an array is a workaround for the bug #65136.
*
* @var \Hoa\Iterator\Recursive\Directory string
*/
- protected $_relativePath = null;
-
- /**
- * Relative path (workaround for the bug #65136).
- *
- * @var \Hoa\Iterator\Recursive\Directory string
- */
- protected $_childRelativePath = null;
+ protected $_relativePath = array();
@@ -128,7 +122,7 @@ class Directory extends \RecursiveDirectoryIterator {
public function getChildren ( ) {
$out = parent::getChildren();
- $out->setChildRelativePath($this->getRelativePath());
+ $out->setRelativePath($this->getRelativePath());
if($out instanceof \RecursiveDirectoryIterator)
$out->setSplFileInfoClass($this->_splFileInfoClass);
@@ -159,21 +153,7 @@ class Directory extends \RecursiveDirectoryIterator {
*/
public function setRelativePath ( $path ) {
- $this->_relativePath = $path;
-
- return;
- }
-
- /**
- * Set relative path (workaround for the bug #65136).
- *
- * @access private
- * @param string $relativePath Relative path.
- * @return string
- */
- private function setChildRelativePath ( $path ) {
-
- $this->_childRelativePath = $path;
+ $this->_relativePath[0] = $path;
return;
}
@@ -186,9 +166,7 @@ class Directory extends \RecursiveDirectoryIterator {
*/
public function getRelativePath ( ) {
- return isset($this->_childRelativePath)
- ? $this->_childRelativePath // workaround for the bug #65136.
- : $this->_relativePath;
+ return $this->_relativePath[0];
}
}