Laravel "[b" character on version 4.1.x - laravel

Installed Laravel 4.1.30 (because I can't use 4.2 on a RHEL5 server - no PHP 5.4), all seemed to go OK, but noticed the sequence "[B" showing up when a user is logged into my test application.
I even see that just getting the Laravel version:
./artisan --version
[BLaravel Framework version 4.1.30
On v4.2, I'm not seeing that.
./artisan --version
Laravel Framework version 4.2.6
I cannot upgrade the version of Laravel on the server because of no PHP5.4 support (the server isn't mine). Any idea what is causing the stray "[B"? It's an issue because as I mentioned, it also shows up in my application.
e.g.
Section from a blade view:
#section('content')
(here1)
#if(Auth::check())
(auth)
#else
(not-auth)
#endif
(here2)
Displays this on the site:
(here1) [B (auth) (here2)

I had this issue at one point as well where I would get a "/" whenever I ran artisan commands etc.. it turned out I had a / before one of my opening <?php tags that I missed. /<?php. Just do a quick search/replace on the [B string in your project and hopefully you can locate the offending file.

Related

having issues with laravel 9 breeze , i have hosted it successfully everything working fine ... but breeze login and register wont work on production

this is my error on production level
Vite manifest not found at: /home/codarhqc/codar/public/build/manifest.json (View: /home/codarhqc/codar/resources/views/layouts/guest.blade.php) (View: /home/codarhqc/codar/resources/views/layouts/guest.blade.php)
You can delete the following file bootstrap/cache/config.php or better if you can make a route in your web.php file with a function that runs: php artisan optimize:clear.
This should remove the problem.

Laravel nova keeps throwing exception Route [nova.login] not defined

I've already posted this to https://github.com/laravel/nova-issues sadly hadn't got any love from there, so I'd like to know if anyone experienced this issue and how they resolved it.
Laravel Version: 5.7.27
Nova Version: 1.2
PHP Version: 7.2.12
Operating System and Version: MacOS 10.13.6
Browser type and version: Chrome (Latest) FireFox (Latest)
Description:
Whenever I access my nova route in /admin <-- (this is where my nova resides) I get this exception thrown from/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php line 389, throw new InvalidArgumentException("Route [{$name}] not defined."), my nova was installled correctly and currently I don't have any other existing app routes this is a fresh install of laravel and fresh install of nova.
It was working fine until I introduced the custom path.
Steps To Reproduce:
Change the 'path' => '/admin'
Run php artisan config:clear or php artisan config:cache
Check your NovaServiceProvider.php and make sure it has withAuthenticationRoutes() in the routes() function like this:
protected function routes()
{
Nova::routes()
->withAuthenticationRoutes()
->withPasswordResetRoutes()
->register();
}

Unable to find PHPUnit\Framework\Constraint\Constraint in Laravel BrowserKit package after upgrade to 5.4

I'm upgrading an old Laravel personal project from 5.2 to 5.4. The upgrade to 5.3 seems to have gone OK, but now I'm moving to 5.4 I've run into an issue.
The project used the old testing layer so I've installed the BrowserKit testing package to maintain backward compatibility. I also created the following base test case for the Browserkit tests:
<?php
namespace Tests;
use Laravel\BrowserKitTesting\TestCase as BaseTestCase;
abstract class BrowserKitTestCase extends BaseTestCase
{
use CreatesApplication;
public $baseUrl = 'http://localhost';
}
The tests for the models, which use the normal test case, work fine, but when I run any of the tests that use the BrowserKit test case, I see the following error message:
PHP Fatal error: Class 'PHPUnit\Framework\Constraint\Constraint' not found in /home/matthew/Projects/myproject/vendor/laravel/browser-kit-testing/src/Constraints/PageConstraint.php on line 10
PHP Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/matthew/Projects/myproject/vendor/laravel/framework/src/Illuminate/Container/Container.php:895
Stack trace:
#0 /home/matthew/Projects/myproject/vendor/laravel/framework/src/Illuminate/Container/Container.php(735): Illuminate\Container\Container->notInstantiable('Illuminate\\Cont...')
#1 /home/matthew/Projects/myproject/vendor/laravel/framework/src/Illuminate/Container/Container.php(608): Illuminate\Container\Container->build('Illuminate\\Cont...')
#2 /home/matthew/Projects/myproject/vendor/laravel/framework/src/Illuminate/Container/Container.php(575): Illuminate\Container\Container->resolve('Illuminate\\Cont...')
#3 /home/matthew/Projects/myproject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(728): Illuminate\Container\Container->make('Illuminate\\Cont...')
#4 /home/matthew/Projects/myproject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExce in /home/matthew/Projects/myproject/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 895
Google hasn't been much use with this and the error message is not terribly illuminating. It seems to be something to do with the namespace because the class PHPUnit\Framework\Constraint\Constraint doesn't appear to exist, but I'm not sure how to resolve the issue. I've upgraded the version of PHPUnit to 5.7 as necessary, but that doesn't resolve the issue. Can anyone suggest what the issue might be?
EDIT: Just thought to try downgrading the version to 1.0 and that seems to solve the problem for now, so maybe version 2.0 is intended to work with PHPUnit 6? Still, hopefully this post will help someone out in future.
I ran into this today also.
Instead of downgrading laravel/browser-kit-testing from ~2.0 to ~1.0, I upgraded "phpunit/phpunit" from 5.7 to ~6.0 and that fixed the problem.
I agree that it is related to the PHPUnit namespaces. There is a commit to laravel/browser-kit-testing from May 25 with a title of "Use PHPUnit 6.0 namespaced classes."
Downgrading laravel/browser-kit-testing to 1.0 seemed to resolve the issue, so I'm guessing it's something to do with the namespaces for PHPUnit.
I think you need to instruct your test runner to use the bootstrap autoloader file containing PHPUnit class aliases.
try
phpunit --bootstrap bootstrap/autoload_test.php
If you are using a phpunit.xml configuration file, make sure your phpunit tag contains bootstrap="bootstrap/autoload_test.php" amongst your other set options, like the following:
<phpunit bootstrap="bootstrap/autoload_test.php">
You can instruct your test runner to read your phpunit.xml like so:
phpunit --configuration phpunit.xml

Undefined class Route (Laravel in PhpStorm)

How can I fix this alert in PhpStorm?
And also how to get autocompletion for Route and other Facades?
Check the Laracasts walkthrough
1) Go to: https://github.com/barryvdh/laravel-ide-helper
2) Click on the gist
Generated version for L5: https://gist.github.com/barryvdh/5227822
3) Click on "Raw" to get the current version (as of June 22, 2016 it is):
https://gist.githubusercontent.com/barryvdh/5227822/raw/4d4b0ca26055fa4753b38edeb94fad2396c497c0/_ide_helper.php
4) Make sure you're in your root directory (this is mine)
cd /var/www/html/project
5) Download the gist:
wget https://gist.githubusercontent.com/barryvdh/5227822/raw/4d4b0ca26055fa4753b38edeb94fad2396c497c0/_ide_helper.php
6) Add "_ide_helper.php" to the .gitignore file
sudo nano .gitignore
Add "_ide_helper.php" on a new line at the bottom
7) Download the .gitignore and _ide_helper.php files into PhpStorm
This is what my PhpStorm project directory looks like afterwards:
8) After the files are downloaded into PhpStorm, the "Undefined class" error will disappear and autocompletion will now work. Might need to restart it.
There is greate IDE support for Laravel shipped from Baryvdh:
https://github.com/barryvdh/laravel-ide-helper
after you install it you just call in the console:
php artisan ide-helper:generate
which generate alll facede shortcuts in _ide_helper.php file (which you have to exclude from git)
There is also something special for PhpStorm:
php artisan ide-helper:meta
which will give Laravel container context for example:
$foo = app(Foo::class);
PhpStorm will know that the $foo variable is type of Foo class.
I know this is an old thread, but it is still relevant. For me, I decided to add the following to my routes/web.php since I don't want to have to worry about regenerating meta data for the app.
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Auth;
Edit: The above does not add any overhead to PHP as the use simply acts as a reference for PHP.
I solved this problem simply by installing the Laravel idea plugin.
Use the following link:
https://laravel-idea.com/
You can install it on your phpstorm.
Its good feature is that you can use it for 30 days for free and pay the amount after satisfaction.

syntax error at server for the code works fine at localhost... it is weird! :/

I have an interesting issue :/ I use CodeIgniter and the code below is working fine at my localhost, but when I upload to server I come cross with an error message like
Parse error: syntax error, unexpected
T_OBJECT_OPERATOR in
/home3/blabla/public_html/blablabla/applications/frontend/models/our_work_model.php
on line 99
function next_project($sort_work)
{
$query = $this->db->select('wname')->order_by('sort', 'asc')->getwhere('works', array('sort >' => $sort_work, 'case_study != ' => ""), 1, 0); //line 99
any idea? appreciate helps! thanks!
I know chaining like that only works in PHP5 - is the server perhaps running an older version of PHP?
Given your last question: __construct() { issue for PHP4 and PHP5. maybe an another reason
I'd say you're running PHP4.
How do you know that your CodeIgniter installation is actually using PHP 5? It could be the case that there are several PHP installations in that machine. To test it, create a PHP file in your server with the following code:
<?php
phpinfo();
?>
Then let us know what version it is showing.
initially i was getting a blank page. so i removed this
error_reporting((E_ALL & ~E_DEPRECATED));
yes if you are using codeigniter and you have to make ove code to this
error_reporting((E_ALL));
and then you will get the error above. and i found it was due to php5 being unused.

Resources