"false" showing up mysteriously in terminal? - mysql

Terminal is giving me an issue where it prints "false"
Additionally, "false" shows up before the html view in the Laravel output.
I am running into this on codecourse's Classified's Site tutorial
Any idea how to remedy?
More detail:
I think what set this off was I changed the config/database.php for mysql from strict = true to false (have since changed back).
After changing mysql strict = true, I reloaded vagrant with provision on and did a migrate:reset and migrate then reseeded the database. Yet, when I run commands in terminal (eg. php artisan migrate), 'false' gets displayed on the next line before the migrations happen. and annoyingly, my website displays "false" in the top of the view, before the html doctype in the source gets written I took a look around the routes and views and cannot see how the false is creeping in there (especially since I changed it back to true!)
Any idea how to remedy, or suggestions for what to try?
See sample terminal Code below
vagrant#homestead:~/code/fresh$ php artisan migrate
falseMigrating: 2018_02_16_130447_create_listings_table
Migrated: 2018_02_16_130447_create_listings_table
vagrant#homestead:~/code/fresh$ php artisan make:controller Listing\ListingController
falseController created successfully.
vagrant#homestead:~/code/fresh$
Thank you Sam for the answer, I had accidentally put "false" ABOVE the start of the php declaration on the first line of my database config file

A PHP file can contain non-php and remain valid, i.e the following is valid:
false <?php echo '<h1>Hello World!</h1>'; ?>
That would produce the following:
false <h1>Hello World!</h1>
Laravel configuration files are simple PHP files that return an array, that file is included by the framework and the app configuration is populated from the values in the array. The behaviour you're seeing is indicative of a file within your application containing content that shouldn't be there, and based on what you were doing when the issue occured it's probably one of your configuration files.
Run the following command from your project root:
$ grep -r "false" config
Then review each instance of "false". You'll most likely find that at the top of your config/database.php file you've mistakenly placed false before the opening tag <?php.
For future reference, if you're using version control it is much easier to identify the cause of issues like this because you can step through every change you've made since the issue started. GitHub has a great desktop client that makes version control very easy :-)

Related

Auth::user() always return null

recently I have installed spatie/permissions in a fresh Laravel 9 installation. before I install this package whenever I called Auth::user() it returns back with the result with the currently authenticated user. but now after I installed spatie/permissions it always returns null in any controller, but it's working normally in views.
is there anyone have the same issue here. and how he managed to fix it.
I would start by clearing the config cache
php artisan optimize:clear
php artisan config:clear
Then i would check you have published the config file and set up the settings correctly. If you've modified the config file at all, try returning it to the default settings.
I've never experienced this issue before, the spatie package doesn't normally change the Auth, just the access roles/permissions that you have to add to the code
One other thing to note, each role/permission has a guard associated with it. Ensure it's the default guard

PhpStorm showing "unvailable" breakpoint whereas execution is suspended

I'm sometimes stuck while attempting to debug my code.
Debug Session is active, code execution is suspended :
But I cannot see what really happens, as the breakpoint show "unavailable" ("no parking" symbol):
Does anybody know about this sign ?
I still haven't found any information about it on JetBrains sites... that's why I'm here :-)
(PhpStorm 2020.3, using docker containers (linux containers) with Docker Desktop/ Windows 10)
[EDIT] :
I just noticed that "break at first line in php script" seem to be functioning though:
But I have these weird breakpoints instead of red "normal" ones, and an highlighted line.
I tried restarting my docker containers, same issue. This produces seemingly randomly and gets solved after a while ... (reboot ?...)
[EDIT] SOLVED
The path mapping (local<->docker) for the root of my project was empty (how did it happen...) in my docker configuration in PhPStorm.
I'm not sure how this problem occured, but I'll be able to solve it next time if it's back.
If you try to disable "break at first line in php scripts" you may get the message :
17:38 Debug session was finished without being paused It may be
caused by path mappings misconfiguration or not synchronized local and
remote projects. To figure out the problem check path mappings
configuration for 'docker-server' server at PHP|Servers or enable
Break at first line in PHP scripts option (from Run menu). Do not
show again
In my case, the path mapping for the root of my project was incomplete "Absolute path on the server" was emtpy. I don't know how it happened but you could check :
In PHP | Servers

Reload webpack dev server when json file has being changed

I am using https://github.com/wbkd/webpack-starter that works great.
I want server to restart when I am changing the json file that I placed in to src folder. How would you do that?
This particular json file I am using only in build time - no need that file when my content running in the browser.
If I change my josn file browser does not restarts, but even if I restart it manually I can not see my changes, only if I stop and start server changes appeared in browser. My json file contains some strings that I am replacing in my html during webpack build <%= config.title %>.
Here is the webpack config files https://github.com/wbkd/webpack-starter/tree/master/webpack
I was trying to set watch: true but didn't help.
Also I modify this line https://github.com/wbkd/webpack-starter/blob/master/webpack/webpack.config.dev.js#L12 to that:
devServer: {
inline: true,
contentBase: [Path.resolve(__dirname, '../src/myconfig.json'],
watchContentBase: true
},
but have no difference
Currently I solved my problem using nodemon:
"start": "nodemon --watch content/myconfig.json 'webpack-dev-server --open --config webpack/webpack.config.dev.js'"
However I have another problem, after server restated I have always new tab opened but it would be nice if just current tab gets reloaded, not sure if it is possible.
If you know better solution let me know.

Accessing files folder in Bolt CMS throws exception

I made a fully functioning website with the Bolt CMS system on my home (development) system. After finishing and testing everything, I've put the site on the production webserver and it works like a charm, except for one thing: accessing, uploading and selecting files does not work. Furthermore, when I try to access the files section in the backend (http://.../bolt/files) I get the error:
Whoops\Exception\ErrorException thrown with message "syntax error, unexpected '['"
Stacktrace:
#0 in /home/etxean/domains/etxean.net/public_html/vendor/league/flysystem/src/Filesystem.php:154
This is inside the writeStream function I checked file permissions and these are okay. Any idea where to look to debug this error?
#lxg is correct in that this is being caused by a PHP 5.3/5.4 error.
To maintain compatibility with 5.3 we use a forked version of the Flysystem repo, but it seems that you are loading the real one.
I'm guessing this may be because you have installed Bolt as a composer package rather than downloading the distribution version.
If so then you can add the fork to your composer.json file in the root of your Bolt site. It should look like this:
"repositories": [{
"type": "vcs",
"url": "http://github.com/rossriley/flysystem"
}],
then run a composer update and the Flysystem package will be replaced with the fork.
The file in question uses the PHP 5.4. array notation.
Prior to 5.4, an array would always be declared like
$foo = array(1, 2, 3);
Since PHP 5.4, you can use the JS(ON)/Python style array notation:
$foo = [1, 2, 3];
Solution: If you want to use this library, you should upgrade your server to at least PHP 5.4.
Theoretically, you could also modify the source file to run with PHP 5.3, but that would be a really bad idea in regard to maintainability.

Mysql command line restore error "The system cannot find the file specified."

Ive got a rather strange issue, ive got an automated build tool that is calling through to the mysql command line to teardown then setup a database from an SQL file.
On one computer it is working fine, and its basically calling:
Mysql -h {Connection::Host} -u {Connection::User} --password={Connection::Password} < {sqlFile}
Ive just checked it out on another computer and tried to build and it keeps giving me the error "The system cannot find the file specified.". The MySQL versions are the same 5.1 and no other files have changed. The only thing that i know is different is where the build files are deployed... at home they are deployed to:
d:/code/projects/xxxxx/
whereas on this computer that doesn't work it is deployed to:
c:\Documents and Settings\xxxxxx\My Documents\Projects\Other\xxxxxx\
The interwebs brought back a few possibilities such as the spaces within the path, however ive tried adding the -i to the command (ignore spaces) and it made no difference.
Anyone have any ideas?
It's most likely the spaces in the path. The part after the space will be passed to the program as a different parameter.
Try surrounding {sqlFile} with double quotes.
Mysql .... < "{sqlFile}"