Bug #69532 [Opn->Csd]: array_multisort is chocking when using it's own constants
| From: | nikic@php.net | Date: | Sat, 25 Apr 2015 16:49:32 +0000 |
| Subject: | Bug #69532 [Opn->Csd]: array_multisort is chocking when using it's own constants | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-192340@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69532&edit=1
ID: 69532
Updated by: nikic@php.net
Reported by: deivid dot garcia dot garcia at gmail dot com
Summary: array_multisort is chocking when using it's own
constants
-Status: Open
+Status: Closed
Type: Bug
Package: *General Issues
Operating System: Windows 8.1
PHP Version: master-Git-2015-04-25 (snap)
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=75b4fa079f1c13188895bfbe47dc561e17c59382
Log: Fix bug #69532
Previous Comments:
------------------------------------------------------------------------
[2015-04-25 16:15:13] nikic@php.net
The error will be thrown if you add a "namespace Foo;" at the top.
------------------------------------------------------------------------
[2015-04-25 15:36:05] deivid dot garcia dot garcia at gmail dot com
Sorry, looks like the sample script works OK.
But the report (sample line and exception message) is legitimate.
I am unable to build a sample isolated script that triggers the error, but I can't imagine how
can any previous code can mess up things to the point where passing SORT_ASC makes array_multisort
choke.
------------------------------------------------------------------------
[2015-04-25 15:09:37] nikic@php.net
I can't reproduce this error. (Ubuntu, current master)
------------------------------------------------------------------------
[2015-04-25 14:40:36] deivid dot garcia dot garcia at gmail dot com
Description:
------------
array_multisort is chocking when using it's own constants:
EngineException: Cannot pass parameter 4 by reference in
Drupal\Core\Extension\ExtensionDiscovery->sort() (line 321 of D:\DRUPAL
OFICIAL\drupal\core\lib\Drupal\Core\Extension\ExtensionDiscovery.php).
array_multisort($origins, SORT_ASC, $profiles, SORT_ASC, $all_files);
It get's solved by using variables:
$p = SORT_ASC;
array_multisort($origins, $p, $profiles, $p, $all_files);
Test script:
---------------
<?php
$origins = array();
$profiles = array();
$all_files = array();
array_multisort($origins, SORT_ASC, $profiles, SORT_ASC, $all_files);
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69532&edit=1