@godzilaravel how are you displaying it in the blade?
Why the string `http:` and `https:` are not displayed ?
When any output contains the string http: or https: it's not displayed !
example :
Route::get('test', function () {
//dd('http://test https://test');
return 'http://test https://test';
});
the code above returns : //test //test instead of http://test https://test !
but with dd('http://test https://test'); it works !
Is it related to the APP_ENV ?
Yes same problem ,
Route::get('test', function () {
return view('test', ['name' => 'https:// and http://']);
});
returns : // and //
@godzilaravel can you show the contents of your 'test' blade file?
@godzilaravel not sure what else you have installed but I get the same results @kyawnaingthu
Route::get('test', function () {
return 'http://test https://test';
});
Route::get('test2', function () {
//dd('http://test https://test');
return view('test', ['name' => 'http://test https://test']);
});
test.blade.php
{{ $name }}
<br>
{!! $name !!}
results:
http://test https://test
http://test https://test
what version of Laravel have you got?
Now I upgraded just today Laravel to 6 but I had this probleme since the previous version 5.8 !
@godzilaravel I don’t have anything running laravel 6 to test unfortunately.
You could try without html entities being applied by doing
{!! $name !!}
same result , http: and https: are not displaying !
I changed also the php version to 7.4 and always same problem
I also deleted the vendor and I did composer install
Can you disable JavaScript on your browser temporarily to see if it’s anything front end, stripping the http: part?
If you switch to using my blade (without any bootstrap or css) what does that return?
even if I disabled JS I have the same problem ,
but when I dd('https:// and http://'); I can see http: and https:
So :
Route::get('404', function () {
return 'https:// and http://'; ==> http: is hidden
dd('https:// and http://'); ==> http: is NOT hidden
return view('errors.404', ['name' => 'https:// and http://']); http: is hidden (js and css disabled)
});
Did you test in another browser or in an incognito tab?
What dev server are you using? Can you try php artisan serve
@sinnbeck I'm using Laravel homestead. Yes I used all kinds of browsers .
And did you try running php artisan serve and opening the webpage from there? Just to rule out homestead
Same error with php artisan serve and laravel homestead and also in remote server !
Also with fresh installation of homestead when they pull this project
can you screenshot what it display in browser and with the inspector inspecting the element...
this is not screenshot. I had tried to copy and paste your code in web.php and created a view, the result is just showing the full "http://test https://test" as expected....
i want to see the exactly what your browser showing (whether we can find any other odd things) and the inspector's result...
Is the project available on github so others can try it? It seems that noone can recreate the error, so I think it is project specific.
My best bet, is that you have some custom code that strips out http and https
It's a company project and it's not available on GitHub.
I was thinking to your solution to strip http and https
$data = str_replace(['http:', 'https:'], ['[http]', '[https]'], $value);
return json_decode($data);
But is it possible to make one function to make this strip for the whole project ?
So I imagine this happens for all your developers? Perhaps do a search in the app folder for http and see what you find. Perhaps there is a service provider that strips all http and http
@sinnbeck Yes that's true,
I did a search for http I really found nothing about it !
Can you post your composer.json file? Perhaps a package is doing it.
Here the package.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5",
"doctrine/dbal": "^3.0",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"intervention/image": "^2.5",
"laravel/framework": "6.0.*",
"laravel/socialite": "^4.1",
"laravel/tinker": "^1.0",
"laravelcollective/html": "^6.2",
"league/oauth2-client": "^2.4",
"maatwebsite/excel": "^3.1",
"renatomarinho/laravel-page-speed": "^1.8",
"revolution/laravel-google-sheets": "^5.4",
"spatie/laravel-activitylog": "^3.6"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^7.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
I guess that problem is with renatomarinho/laravel-page-speed
https://github.com/renatomarinho/laravel-page-speed
And exactly TrimUrls middleware.
I am 99% sure that it is this package, as it is made to remove unneeded html (like http and https)
renatomarinho/laravel-page-speed
Edit: Found it! :)
https://github.com/renatomarinho/laravel-page-speed/blob/master/src/Middleware/TrimUrls.php#L14
Perhaps you can add the routes to the whitelist: https://github.com/renatomarinho/laravel-page-speed/blob/master/config/laravel-page-speed.php#L25
Yessssssss ! @sinnbeck @michaloravec
Thanks and thanks and thanks again !
Now when I disable it from the .env it works! LARAVEL_PAGE_SPEED_ENABLE=false
Consider whitelisting the routes where you dont want it, as I suggested :)
This is not an ordinary behavior for a Laravel system, perhaps some customization to prevent hyperlink had implemented in the system by your company...
i would advice that should discuss/consult with the project owner or senior teammate who in-charge on the project...
Please or to participate in this conversation.