Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix maxDimensions #7022

Closed
wants to merge 2 commits into from
Closed

Fix maxDimensions #7022

wants to merge 2 commits into from

Commits on Jul 15, 2015

  1. Fix maxDimensions

    The current Hash::maxDimensions function calls Hash::dimensions to try to get the maximum depth of the passed in array.  However, this ends up only getting the depth of the first element of each 1st dimension element in the array passed to maxDimensions.  The function needs to be called recursively in order to get the depth of ALL of the elements in all of the dimensions of the passed in array.
    
    I made the maxDimensions function more closely resemble the deprecated Set::countDim function in order to restore the correct functionality.
    
    Example:
    $data = array(
    			 0 => array(
    				 0 => 'Some Value',
    				 1 => array(
    					 0 => 'Some other Value'
    				 )
    			 ),
    			 1 => array(
    				 0 => 'Some Value',
    			 )
    		 );
    
    Returns 2 under the current version of maxDimensions.
    Returns 3 with the changes proposed above.
    Chris Valliere committed Jul 15, 2015
    Configuration menu
    Copy the full SHA
    301906f View commit details
    Browse the repository at this point in the history
  2. Fix maxDimensions - comments

    Added comments for $count param
    Chris Valliere committed Jul 15, 2015
    Configuration menu
    Copy the full SHA
    b51b839 View commit details
    Browse the repository at this point in the history