Path

ez projects / ezjscore / forum / general / ezcss_load breaks on empty...


ezcss_load breaks on empty cells

You need to be logged in to post messages in the forums. New users may register here.

Romain Petit

Member since:
02 November 2009

Posts: 1

Wednesday 13 July 2011 4:22:49 pm

Hi,

For information:
If the parameter 'css_files' of the operator contains an empty cell, the next files will not be loaded.
It happens in the 'flattenArray' function in 'ezjscpackertemplatefunctions.php'.
So instead of verifying all my ini files etc... I've replaced:




   static protected function flattenArray( $array )


   {


       $arrayFlatten = array();


       while( isset( $array[0] ) )


       {


            $item = array_shift( $array );


            if ( is_array( $item ) )


                $array = array_merge( $item, $array );


            else


                $arrayFlatten[] = $item;


       }


       return $arrayFlatten;


   }




by




   static protected function flattenArray( $array )


   {


       $arrayFlatten = array();


       while( count( $array ) )


       {


            $item = array_shift( $array );


            if ( is_array( $item ) )


                $array = array_merge( $item, $array );


            else


                $arrayFlatten[] = $item;


       }


       return $arrayFlatten;


   }




Very usefull project !
Up

André R.

Member since:
14 January 2008

Posts: 170

Thursday 14 July 2011 11:10:17 am

Thanks!

Changed it to "!empty( $array )", much faster then count() ;)

And as it is a language construct, it is just as fast as isset(), so bad habit of mine to use isset() to see if array is empty..
commit: https://github.com/ezsystems/ezjs...6f183b3ba4db537a148492af9af271de45f7

Lead Engineer eZ Publish
@: http://twitter.com/andrerom

Up

You need to be logged in to post messages in the forums. New users may register here.