Giter VIP home page Giter VIP logo

Comments (15)

rcoelho avatar rcoelho commented on May 30, 2024

Dreamhost and Bluehost both support PHP 5.4. I'm not against bumping it.

from yii2.

resurtm avatar resurtm commented on May 30, 2024

In my opinion it's not very good to increase minimal required PHP version because of one short static helper method does not work. :-)

I have a quick and ugly but working solution of this issue—will try to polish it.

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

The issue is mainly about the constant SORT_FLAG_CASE. We should NOT bump up minimal requirement of PHP because of this. We can add a new parameter $caseSensitive (before $sortFlag). This parameter should be used in the similar way as $ascending.

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

Related issue (multibyte case-insensitive comparison): #26

from yii2.

resurtm avatar resurtm commented on May 30, 2024

@qiangxue, it's not the single issue. I've tested the following code under PHP 5.3.3:

$arr = array(
    array(
        'id'=>99,
        'title'=>'test3',
    ),
    array(
        'id'=>100,
        'title'=>'test2',
    ),
    array(
        'id'=>101,
        'title'=>'test1',
    ),
);

ArrayHelper::multisort($arr, 'title');

And got:

Warning: Parameter 1 to array_multisort() expected to be a reference, value given in /home/resurtmkz/www/test/ArrayHelper.php on line 276

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

Does the unit test pass on your machine? What is line 276 on your side?

from yii2.

resurtm avatar resurtm commented on May 30, 2024

Does the unit test pass on your machine?

Unfortunately PEAR and PHPUnit are not installed on that machine at all. I'll try to run unit tests against 5.3.3 soon (during the next day).

What is line 276 on your side?

Yes, sorry. I've changed a bit ArrayHelper.php file without modifying code behavior. My line 276 is:

call_user_func_array('array_multisort', $args);

from yii2.

resurtm avatar resurtm commented on May 30, 2024

I've tried to run unit tests on 5.3.11 and the error described above doesn't occur. This code works good as well.

Actually this is a bug in PHP itself:

  1. Open PHP change log: http://php.net/ChangeLog-5.php
  2. Find substring "Version 5.3.11".
  3. Find substring "Fixed bug #61273".
  4. https://bugs.php.net/bug.php?id=61273

I would like to propose raising minimal requirements to 5.3.11 (since it was fixed in 5.3.11).

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

Thanks for your investigation. I added this to #35
Let's make the final decision about the minimal version requirement later.
We may need to consider a workaround if we decide to use a version prior to 5.3.11.

from yii2.

samdark avatar samdark commented on May 30, 2024

I've just tried 5.3.24 and the error Use of undefined constant SORT_FLAG_CASE - assumed 'SORT_FLAG_CASE' is there.

from yii2.

tonydspaniard avatar tonydspaniard commented on May 30, 2024

@qiangxue would you consider adding more methods to this object? Can we propose?

from yii2.

samdark avatar samdark commented on May 30, 2024

Yes, you can propose if these aren't duplicating standard PHP ones.

from yii2.

tonydspaniard avatar tonydspaniard commented on May 30, 2024

Thanks @samdark

from yii2.

distancelove10 avatar distancelove10 commented on May 30, 2024

Please help me,i use yii2 advanced,but i uploaded into server with php version 5.3,it is not working,i dont known ,because hositng is sharing,

from yii2.

cebe avatar cebe commented on May 30, 2024

you have to use PHP 5.4 or higher. Please do not comment on old issues. use the forum to ask further questions. Github is for bug tracking.

from yii2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.