I know laravel caches blade files, and when there is an error in blade, in version 5.3 error would be something like this :
Undefined offset: 0 (View:b5c0ef4df49585eadd7fc1fa15b2d8a03e8c3bdd.php) line: 47
Then I can go to cached files and find the exact line,
But in version 5.4 laravel reference the exact blade file(not cached file) but without a line number! Something like this :
Undefined offset: 0 (View: C:\wamp64\www\project\resources\views\events\partial\event_details_members.blade.php)
in Collection.php (line 1537)
Now how to find the error?
UPDATE
I know where the problem is, and how to fix that, But I want Laravel to tell me this automatically whether I have to look for it manually. what if the blade file is very big?
As of Laravel 5.7, the output shows stack frames on the left side and details of selected frame on right side. If you cruise through the stack, you'll find that one of the entries in there is the parsed version of your blade file (normally located near the (main) frame towards the bottom of the stack). Clicking this frame will take you to the exact line of the blade file that resulted in that exception.
its not an easy way to find the error which raised in a cached view file.
but if your debug mode is off and you are going to find it out very quick,
I suggest this following steps:
I know this is not tidy.
1- find error in ./storage/laravel/log/today.log :
for example:
(b5c0ef4df49585eadd7fc1fa15b2d8a03e8c3bdd.php) (line : 47)
2- output the files content usng cat :
cat ./storage/framework/view/b5c0ef4df49585eadd7fc1fa15b2d8a03e8c3bdd.php
(file name from error log)
3- copy the content from terminal to an editor (from first line to the end)
4- you can find the buggy line.
You can use Laravel Debugbar. This is easy to use. Follow below link you will get what you want.
https://github.com/barryvdh/laravel-debugbar
Related
I am unable to create a new package from module builder. In module builder, when I enter a package name and key and hit save, it does nothing.
When I inspect in chrome, the console logs the following error:
Uncaught TypeError: Cannot read property 'value' of undefined
at validate_form (sugar_grp1.js:228)
at check_form (sugar_grp1.js:160)
at Object.handleSave (ModuleBuilder.js:905)
at HTMLInputElement.onclick (/XXXXXX/index.php?module=ModuleBuilder&action=index&type=mb#ajaxUILoc=&mbContent=module%3DModuleBuilder%26action%3Dpackage%26new%3D1:1)
Any suggestions on what I can look at or do to debug?
I'm using SuiteCRM 7.7.8
Php 7
I thought this might be a permissions issue, so i made sure all folders and files are 755 and tried to create the package again but got the same error.
I do not have any custom modules. this was the first one im trying to build.
I get similar errors if i try to export a module in studio also.
When I dig deeper, the exact line that fails in sugar_grp1.js is var current_module=document.getElementsByName("view_module")[0].value;
There is no element with name view_module on the page. It appears that this is happening to other users also. Please see: https://suitecrm.com/community/forum/suitecrm-7-0-discussion/12418-unable-to-create-package-in-module-builder#42665
UPDATE: I have done the usual repair and rebuild everything along with JS groupings and JS. Still the same.
An easy solution, see following steps:
Open /cache/include/javascript/sugar_grp1.js
Go to line 228 or find the next text:
var current_fields='';var current_module=document.getElementsByName("view_module")[0].value;$.ajax({type:"GET",url:"index.php?to_pdf=1&module=ModuleBuilder&action=getModuleFields¤t_module="+current_module,async:false,success:function(result){current_fields=JSON.parse(result);},error:function(xhr,status,error){var err=eval("("+xhr.responseText+")");}});for(k=0;k<current_fields.length;k++){if(isError!=true){val=current_fields[k].toUpperCase();if((operator=="=="&&val==item1)||(operator=="!="&&val!=item1)){isError=true;add_error_style(formname,validate[formname][i][nameIndex],'Invalid Value: Field Name already exists');}}}
Remove this line.
QuickRepair.
Clear your Browser Cache and try again.
I have a Laravel application in production server that produces exception when rendering the view. The log file printed stacktraces about where the exception happened, but with hashed name of view.
How do I get the original path and the filename of hashed view? Since I can only debug from the error log in the server. For example with this stacktrace, I want to find the original file path and name of 698a6499f344ea0485830fd76f437b7ae1833431.php
ErrorException: Undefined property: stdClass::$balance_perdana in /var/app/current/storage/framework/views/698a6499f344ea0485830fd76f437b7ae1833431.php:44
Stack trace:
#0 /var/app/current/storage/framework/views/698a6499f344ea0485830fd76f437b7ae1833431.php(44): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8, 'Undefined prope...', '/var/app/curren...', 44, Array)
#1 /var/app/current/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(42): include('/var/app/curren...')
There are solution that uses laravel debugbar (https://github.com/barryvdh/laravel-debugbar) to help find the related view, but I think this is not a good practice, activate debug mode in production environment.
Laravel stores compiled version file to speed up system execution.
Once your file is compiled and if you do not make changes into it then laravel direct executes this compiled version and this is how laravel executes fast process work.
So, displaying original name of file is not feasible.
Now for the solution, you can comment out your blade file name with <!-- BLADEFILENAME--> into particular file. So while facing any error then you can understand that which file is this.
Review Reference: Laravel blade debug view name on error
I am getting an error like this:
Array to string conversion
Inside:
/var/.../vendor/cartalyst/sentry/src/Cartalyst/Sentry/SentryServiceProvider.php
Code snippet where the error was thrown:
throw new \InvalidArgumentException("Invalid hasher [$hasher] chosen for Sentry.");
I was doing ordianry work in one of my controllers and this error occured when I clicked on one of the buttons inside my blade.
I have commented the code out but the error still is being displayed, not only on this one page but on every single one in my project. I can't even go to my /home/index.php page.
I have done
composer update
inside my project but that did not help. What can fix the problem?
#update
Yes I have checked sentry config file before I've made a new topic. I have the same problem when I load older versions (which do not contain the latest changes I've made today) of my project on to apache server which is running on Ubuntu 14.04.
Ideas what causes the problem?
In the config for Sentry you have to define a hasher.
It has to be a string. It can be 'native', 'bcrypt', 'sha256' or 'whirlpool'. Apparently in your app, it's not a string, but an array. Check your configuration. It's probably in app/config/packages/cartalyst/sentry/config.php
I'm using the Barryvdh/laravel-dompdf which is a laravel 5 wrapper for the domPDF library (Link to GIT). But after I ran a composer update on my project, I get a error message when I try to convert a html file to a pdf file. The error is as follow FatalErrorException in class.pdf.php line 1876: Call to undefined method Cpdf::o_rapport(). I couldn't find a solution for the specific problem so I tried to downgrade the version of the Barryvdh/laravel-dompdfand run composer again, but that didn't help. So after that I looked at the stacktrace and tried finding the piece of code that fires the FatalError, but nowhere in the code the method o_rapport() is being called, even if I use the search function of my IDE to search my complete project for this method, no reference are found so that is a dead end aswell.
Now I want to ask if someone did encounter the same problem as me and how to fix this.
I was trying to extend tx_news with some extra fields and was getting an error so I installed this extension to see if that worked: https://github.com/cyberhouse/t3ext-newsauthor
I get the same error on the news pages with my extension and the reference extension:
Sorry, the requested view was not found.
The technical reason is: No template was found. View could not be
resolved for action "error" in class
"Tx_Fluidpages_Controller_PageController".
and the following errors in the be log:
Core: Error handler (FE): PHP Warning: file_get_contents(): Filename
cannot be empty in
/var/www/ukcg6/typo3_src-6.1.7/typo3/sysext/fluid/Classes/View/TemplateView.php
line 187
I am using Typo3 6.1 with:
Fluidpages 2.1.0
Fluidcontent 3.1.0
Flux 6.0.3
VHS 1.8.5
I don't have time to setup your stack here now, but I'll try to help with some general advice on how to trace and locate such kinds of errors.
Basically you will need to trace the error back from the TemplateView.php line 187.
Starting there you look for the variable which is the filename. You can var_dump() that variable and it will probably be "null".
Then you follow that variable back to its origin in backwards order. That means each time this variable gets passed you search for the place in the source code where the function which gets it as a parameter is called.
Doing this you'll definitely find the point where something goes wrong. The filename variable is not properly set and that means one of the previously called functions which should set it screwed up.