Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slug doesn't revert locale correctly #815

Open
Jenselme opened this issue Sep 11, 2017 · 0 comments
Open

Slug doesn't revert locale correctly #815

Jenselme opened this issue Sep 11, 2017 · 0 comments

Comments

@Jenselme
Copy link

Expected and Actual Behavior

I am using Slug.php to generate slugs in a phalcon project. The project is configured to display the dates in French. However, after I generate a slug, the dates are in English. If I don't create a slug, the dates are in French as expected.

I expect the date to be always in French.

Locale value (from setlocale(LC_ALL, '0');):

LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=fr_FR.utf8;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C

I use the Slug like this:

$slug = SlugGenerator::generate($str);

Sample controller:

<?php

namespace Controllers;

use Phalcon\Utils\Slug;

class TestController extends Base\ViewController
{
    public function indexAction()
    {
        $this->view->setVars(['slug' => Slug::generate('à moi')]);
    }
}

Sample view

<div class="row page-content sale">
    {{ slug }}

    <div class="date">
        <span class="day-string">{{ strftime("%a", strtotime('2017-10-22T08:00:00.000Z')) }}</span>
        <span class="day">{{ strftime("%d", strtotime('2017-10-22T08:00:00.000Z')) }}</span>
        <span class="month">{{ strftime("%b", strtotime('2017-10-22T08:00:00.000Z')) }}</span>
    </div>
</div>

I was able to track the error to this line: if I comment it, the locales are correctly restaure. Is the operation it does really required?

Details

  • Phalcon Framework version: 3.2.1
  • Phalcon Incubator version: v3.2.2
  • PHP Version: 7.1.6
  • Operating System: Linux inside docker
  • Server: Nginx
  • Other related info (Database, table schema): NA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants