php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69532 array_multisort is chocking when using it's own constants
Submitted: 2015-04-25 14:40 UTC Modified: 2015-04-26 01:46 UTC
From: deivid dot garcia dot garcia at gmail dot com Assigned: pajoye (profile)
Status: Closed Package: *General Issues
PHP Version: master-Git-2015-04-25 (snap) OS: Windows 8.1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: deivid dot garcia dot garcia at gmail dot com
New email:
PHP Version: OS:

 

 [2015-04-25 14:40 UTC] 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);


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-25 15:09 UTC] nikic@php.net
I can't reproduce this error. (Ubuntu, current master)
 [2015-04-25 15:36 UTC] 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 16:15 UTC] nikic@php.net
The error will be thrown if you add a "namespace Foo;" at the top.
 [2015-04-25 16:49 UTC] nikic@php.net
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=75b4fa079f1c13188895bfbe47dc561e17c59382
Log: Fix bug #69532
 [2015-04-25 16:49 UTC] nikic@php.net
-Status: Open +Status: Closed
 [2015-04-26 01:46 UTC] pajoye@php.net
-Assigned To: +Assigned To: pajoye
 [2015-04-26 01:46 UTC] pajoye@php.net
I cannot reproduce either, on windows, just to confirm.
 [2016-07-20 11:39 UTC] davey@php.net
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=75b4fa079f1c13188895bfbe47dc561e17c59382
Log: Fix bug #69532
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 06:01:29 2024 UTC