Skip to content

Commit

Permalink
https://github.com/cabinetsbay/catalog/issues/28
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Jun 10, 2024
1 parent 664241c commit 6861662
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions Core/lib/array/first.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* @used-by df_caller_c()
* @used-by df_caller_entry()
* @used-by df_error_create()
* @used-by df_sort()
* @used-by df_store_code_from_url()
* @used-by dfa_group()
* @used-by dfa_try()
Expand Down
17 changes: 16 additions & 1 deletion Core/lib/array/sort.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,23 @@ function df_sort(array $a, $f = null, bool $isGet = false, string $l = ''):array
* 2024-06-10
* 1) "The gallery images on category pages should be ordered according to their file names":
* https://github.com/cabinetsbay/catalog/issues/28
* 2) The following code does not work correctly for an unknwon reason:
* $c = new Collator('');
* $a = ['3628/swuc_5_7.jpg', '3628/swuc_1_1.jpg', '3628/swuc_4.jpg', '3628/swuc_1.jpg'];
* $c->sort($a);
* https://3v4l.org/LlLrB
* It returns:
* Array (
* [0] => 3628/swuc_5_7.jpg
* [1] => 3628/swuc_1_1.jpg
* [2] => 3628/swuc_4.jpg
* [3] => 3628/swuc_1.jpg
* )
* 3) `echo intval(is_numeric('3628/swuc_5_7.jpg'));` returns `0`: https://3v4l.org/SDiX7
* 4) The code from 2 with @see Collator::SORT_STRING works correctly: https://3v4l.org/FMcdf
*/
$isList ? $c->sort($a) : $c->asort($a);
$mode = is_string(df_first($a)) ? Collator::SORT_STRING : Collator::SORT_REGULAR;
$isList ? $c->sort($a, $mode) : $c->asort($a, $mode);
}
else {
if ($isGet) {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mage2pro/core"
,"version": "11.2.0"
,"version": "11.2.1"
,"description": "Mage2.PRO core package."
,"type": "magento2-module"
,"homepage": "https://mage2.pro"
Expand Down

0 comments on commit 6861662

Please sign in to comment.