Loading...
 
Skip to main content

_getGalleryChildrenIds{List,Tree} does not work correctly in php 5.2.x

Status
Closed
Subject
_getGalleryChildrenIds{List,Tree} does not work correctly in php 5.2.x
Version
4.x
Category
  • Error
  • Less than 30-minutes fix
Feature
File Gallery (elFinder or standard UI)
Resolution status
Invalid
Submitted by
HobbyBlobby
Lastmod by
Ushindi Gedeon
Rating
(0)
Description

Not all galleries are listed (for example when uploading a file).

The problem is (IMO):

  1. $allIds is given as reference
  2. foreach go through the array (with an internal iterator)
  3. in next recursion step an other foreach is called (but with the same $allIds-object)
  4. the iterator reaches the end of the array and the loop goes a recursion step back
  5. the "outer" forach continues, but the iterator of $allIds is at the end of the array
  6. no other item is checked, if one of the inner recursion steps reach the end of the array
Solution
Copy to clipboard
make a copy of $allIds everytime "_getGalleryChildrenIds{List,Tree}"

is called:

Copy to clipboard
function _getGalleryChildrenIdsList( $allIds, &$subtree, $parentId ) { ...} function _getGalleryChildrenIdsTree( $allIds, &$subtree, $parentId ) { ...}


Workaround
Importance
7
Easy to solve?
8
Priority
56
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
3095
Created
Sunday 28 March, 2010 13:07:32 UTC
by HobbyBlobby
LastModif
Monday 01 June, 2026 20:38:31 UTC


Show PHP error messages