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

Strange characters after artisan optimize #14197

Closed
Macsch15 opened this issue Jul 1, 2016 · 15 comments
Closed

Strange characters after artisan optimize #14197

Macsch15 opened this issue Jul 1, 2016 · 15 comments

Comments

@Macsch15
Copy link

Macsch15 commented Jul 1, 2016

Hello,
I have issue on my vagrant box (php7dev), after php artisan optimize (via composer install/update) I got strange characters on any page (CLI/phpunit too):
2016-07-01_15-08-11

Everything is fine when I remove file:

/bootstrap/cache/compiled.php

Laravel Framework version 5.2.39
PHP 5.6.16-dev (cli) (built: Oct 22 2015 16:13:30)
Debian GNU/Linux 8.2 (jessie)
Composer version 1.1.3 2016-06-26 15:42:08

Can someone explain this? I can't reproduce this on my shared hosting.
Thanks

@GrahamCampbell
Copy link
Member

What does your compiled file look like?

@Macsch15
Copy link
Author

Macsch15 commented Jul 2, 2016

compiled.zip

@GrahamCampbell
Copy link
Member

Looks fine to me. Did you compile that file on the same server you're running the code on?

@GrahamCampbell
Copy link
Member

GrahamCampbell commented Jul 3, 2016

What happens if you run optimize with the force flag?

@Macsch15
Copy link
Author

Macsch15 commented Jul 3, 2016

Did you compile that file on the same server you're running the code on?

Yes.

What happens if you run optimize with the force flag?

The same results.

@JoostK
Copy link
Contributor

JoostK commented Jul 3, 2016

It has probably something to do with the file encoding. Your compiled.php shows the following under OS X:

$ file -I compiled.php 
# compiled.php: application/octet-stream; charset=binary

When ran on a different PHP file I get text/x-php; charset=us-ascii.

@Macsch15
Copy link
Author

Macsch15 commented Jul 3, 2016

2016-07-03_15-42-58

@JoostK
Copy link
Contributor

JoostK commented Jul 3, 2016

Try creating the file yourself with the contents copied over. I'm not convinced the file is what it should be 😅

@thecrypticace
Copy link
Contributor

thecrypticace commented Jul 4, 2016

Just a guess but it seems to me that the file is being interpreted as UTF-16BE (BE = Big Endian) and not UTF-8. Though, I'm not sure why. Perhaps there's a setting your php.ini file that's causing this?

Try running php -i | grep encoding on your vagrant box and report the details back here. I'm guessing one of the settings is going to say UTF-16.

This is what the file looks like when interpreting as UTF-16BE:

screen shot 2016-07-03 at 21 20 49

@Macsch15
Copy link
Author

Macsch15 commented Jul 4, 2016

php -i | grep encoding output:
2016-07-04_16-11-09

@thecrypticace
Copy link
Contributor

That's definitely strange. Not sure what the issue is.

@Macsch15
Copy link
Author

Macsch15 commented Jul 4, 2016

I discover something, when I fire artisan optimize on PHP 5.5 (PHP 5.5.31-dev (cli) (built: Oct 22 2015 16:24:08)) everything is fine.

compiled.php from PHP 5.6:
compiled56.zip

and PHP 5.5
compiled55.zip

2016-07-04_17-50-56

PHP 7.0 - the same problem

@themsaid
Copy link
Member

themsaid commented Oct 4, 2016

Hello everyone, any updates on this issue? Still facing the problem? is it fixed? Don't seem to be able to regenerate and the thread makes it look like it happens randomly :)

@Macsch15
Copy link
Author

After this update:


Updating dependencies (including require-dev)
  - Removing symfony/var-dumper (v3.1.4)
  - Installing symfony/var-dumper (v3.1.5)
    Downloading: 100%

  - Removing symfony/translation (v3.1.4)
  - Installing symfony/translation (v3.1.5)
    Downloading: 100%

  - Removing symfony/routing (v3.1.4)
  - Installing symfony/routing (v3.1.5)
    Loading from cache

  - Removing symfony/process (v3.1.4)
  - Installing symfony/process (v3.1.5)
    Downloading: 100%

  - Removing symfony/http-foundation (v3.1.4)
  - Installing symfony/http-foundation (v3.1.5)
    Downloading: 100%

  - Removing symfony/event-dispatcher (v3.1.4)
  - Installing symfony/event-dispatcher (v3.1.5)
    Loading from cache

  - Removing psr/log (1.0.0)
  - Installing psr/log (1.0.2)
    Downloading: 100%

  - Removing symfony/debug (v3.1.4)
  - Installing symfony/debug (v3.1.5)
    Downloading: 100%

  - Removing symfony/http-kernel (v3.1.4)
  - Installing symfony/http-kernel (v3.1.5)
    Downloading: 100%

  - Removing symfony/finder (v3.1.4)
  - Installing symfony/finder (v3.1.5)
    Downloading: 100%

  - Removing symfony/console (v3.1.4)
  - Installing symfony/console (v3.1.5)
    Downloading: 100%

  - Removing ramsey/uuid (3.5.0)
  - Installing ramsey/uuid (3.5.1)
    Downloading: 100%

  - Removing nikic/php-parser (v2.1.0)
  - Installing nikic/php-parser (v2.1.1)
    Downloading: 100%

  - Removing league/flysystem (1.0.27)
  - Installing league/flysystem (1.0.28)
    Downloading: 100%

  - Removing laravel/framework (v5.3.6)
  - Installing laravel/framework (v5.3.18)
    Downloading: 100%

  - Removing symfony/yaml (v3.1.4)
  - Installing symfony/yaml (v3.1.5)
    Downloading: 100%

  - Removing phpunit/phpunit-mock-objects (3.2.7)
  - Installing phpunit/phpunit-mock-objects (3.4.0)
    Downloading: 100%

  - Removing phpdocumentor/reflection-docblock (3.1.0)
  - Installing phpdocumentor/reflection-docblock (3.1.1)
    Downloading: 100%

  - Removing myclabs/deep-copy (1.5.2)
  - Installing myclabs/deep-copy (1.5.4)
    Downloading: 100%

  - Removing phpunit/phpunit (5.5.4)
  - Installing phpunit/phpunit (5.6.1)
    Downloading: 100%

  - Removing symfony/css-selector (v3.1.4)
  - Installing symfony/css-selector (v3.1.5)
    Downloading: 100%

  - Removing symfony/dom-crawler (v3.1.4)
  - Installing symfony/dom-crawler (v3.1.5)
    Loading from cache

This issue is not existing anymore. I still have no idea why.

@themsaid
Copy link
Member

Let's close it then since there were zero progress anyways :) Please feel free to ping me if the problem re-appeared in a 5.3 installation.

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

5 participants