I am trying to call the API but I keep getting a soap error that can't load the file. I found that the reason is there are about 3 blank lines at the top of the XML file that is returned. I found this by doing wget url.
This use to work just fine, when I debug through the API controller the response or xml looks fine all the way through, I don't see any spaces at all. I have no idea what might be causing this. I don't think there is anything we modified that would do this.
UPDATE:: I have found that it appears to be because of an observer class I made for the controller_action_predispatch event. It appears I have some spaces above the
I'm not completely sure of what I am talking about as far as I've never used the API, but you should try to look at the end of the file which generates your XML for a closing '?>'. If there is this closing PHP marker, remove it and try again you API call...
In Magento, PHP file should never be ended by a closing php marker '?>'.
edit: as said in comments, also look at spaces before the opening tag '<?php'.
First thing need to check is api.php file in root folder, most of api blank space issues will come if any empty lines added in api.php file before starting
Related
I am doing below code in Laravel 5.5 with mpdf 8.0
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML('Hello World');
$mpdf->Output("test","I");
It outputs gibberish/garbage values, seemingly showing pdf file in raw form.
Some findings
If I use $mpdf->Output($reportPath, 'F'); (saving it to file) and the opening that. It opens the file as expected.
If I place die(); after $mpdf->Output("test","I"); it shows the document.
My suspicion is, it has something something to do with Content-type:application/pdf not being set by default but I have also tried using header("Content-type:application/pdf"); before Output but of no use. it is still showing Content-Type: text/html; charset=UTF-8 in response header in Network tab of chrome (also tried Firefox).
Some back-story
It used to work on php7.3 just fine, but I have to update it to php7.4 due to some library and multiple application on a single server scenario.
Also start using a sub-domain for my application instead of placing the directories after the domain.
I'm looking for
A solution that doesn't require me to place die; at the end of output.
Or some clue in on why this has started happening or/and perhaps why I need to place die; after Output.
Any other solution.
The goal is to provide some ref. for people encountering same issues in future, since I have spent hours and haven't anything that specifically address such issue.
Ok, so I found out that I can't just rely on $this->mpdf->Output('test.pdf',"I") to output my result (though it was working previously with the same line) to the browser.
Because for some reason it has started to send Content-Type:text/html value in Content-Type header so I had to change that.
Solution
I did it as below:
return response($this->mpdf->Output('test.pdf',"I"),200)->header('Content-Type','application/pdf');
recently i'm facing strange issue with my app which wasn't exist at least until yesterday!
If I try to open certain urls such as myapp.dev/blog or myapp.dev/categories etc. I get error of
Sorry, the page you are looking for could not be found.
but if I change my url to something like myapp.dev/t/blog it will load the page!
any idea?
Update
Route::get('/categories', 'frontend\FrontendController#totalcategories')->name('allcategories')->where('slug', '[\w\d\-\_]+');
try to move your at end of file or start of file in web.php. In my case sometime it's behave if while your url getting conflict with each other.
in my case my was like routes this
Route::get('{status}/category','TempController#index');
Route::get('category/t','TempController#store');
Simply I just moved myfirst line at end of file. and worked fine.
This happend because Laravel treat first Segment of URL as argument.
I'm working on a custom module that will describe an external table to the Views module. Inside my module folder I have the required mymodule.views.inc file. However, whenever this file is present and my custom module is enabled Drupal constantly gives Ajax HTTP Error pop ups when I use a site feature that has Ajax (any of the spinning daisies trigger this). The pop up always contains the module code in mymodule.views.inc after it says Ajax Error. The weird thing is every time I load the front page the PHP code in mymodule.views.inc is always displayed on the top of the front page.
I've seen this problem on SO and other sites a lot, but most of the time it can be traced back to an updated jquery.js file or a php.ini setting that will give scripts more time to run. So far neither of those fixes have worked. The only way I can make it go away for now is to either disable my custom module, or rename mymodule.views.inc to something else.
Here's an example of what the message looks like (not verbatim copy, since I can't copy from these alert messages in Chrome).
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /?q=admin/structure/views/view/viewiamtryingtocreate/preview/page/ajax
StatusText: parseerror
ResponseText: /*
* header file to my mymodule.views.inc
* file I wrote
*/
//more php code follows
//lots of unicode characters intermittently show up in my source code
\u003C\/div\u003E\n...
//source code continues with lots of unicode characters, not sure what's at the bottom because the alert box is bigger than my screen and I can't scroll on it
Does anyone else know what could be going on?
This error is caused by drupalforfirebug, disabling drupal for firebug should help. or else this patch should work.
Found it. Syntax error hiding at the top of mymodule.views.inc. There was some weird formatting before the opening PHP tag. Not sure why php --syntax-check mymodule.php didn't catch it (I copied mymodule.views.inc to mymodule.php so that I could run the syntax checker on it).
i cant verify my webapp using maven-failsave because the web-jetty.xml referenced a missing dtd (http://jetty.mortbay.org/configure.dtd).
Any ideas? Can i disable the dtd-check?
Where can i get the content of http://jetty.mortbay.org/configure.dtd?
old one should work, I'll look into that, but you can also get it at:
http://www.eclipse.org/jetty/configure.dtd
[edit] An update on this:
We have a number of redirects in place as we try and keep the really old xml file doctypes valid. We recently wired up a redirect from jetty.codehaus.org to www.eclipse.org/jetty which has resulted in a number of validation errors on these old urls. This is being addressed but if it impacts you updating to www.eclipse.org/jetty/configure.dtd is the best solution so the redirect game is no longer played.
i got this error
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header
information - headers already sent by
(output started at
/home/rapcomdk/public_html/system/language/danish/imglib_lang.php:1)
Filename: helpers/url_helper.php Line
Number: 541
i dont know what the problem is
here is my controller:
http://pastebin.com/EMtcMgsB
and here is my model file:
http://pastebin.com/iH6xQFGA
hope some one can help me out
Check and make sure in system/language/danish/imglib_lang.php that you have no whitespace before the <?php tag and make sure you do not have a closing ?> php tag in the file.
In addition to jondavidjohn's answer, if you're using Unicode encoding for the files, make sure there's not a byte order mark starting off the file. On some platforms, this can wreak havoc on PHP processing.
Make sure there are no errors in codeigniter, sometimes the errors can be covered by other errors, such as one error lead to another.
The problem is in system/language/danish/imglib_lang.php, which must have some character before the <?php part by the time it is parsed on the server. What's happening is that helpers\url_helper.php is trying to redirect (using this code;)
case 'refresh' : header("Refresh:0;url=".$uri);
But is failing because imglib_lang.php, line 1 has already sent some non-header text to the response. Since headers come first, it's giving you the warning.
I wonder at it working locally but not on the deployment server. It may be that the file is not being transferred cleanly, or that the servers use different versions of PHP with different handlings of character sets.
Several checks;
Be absolutely sure there is no BOM at the front of system/language/danish/imglib_lang.php. Let us know why you are certain. If you've edited the file in Notepad on windows, for instance, it'll have gained the Byte Order Mark. It can be very hard to tell since some tools 'swallow' the mark. Also make sure there's no plain whitespace.
When you save imglib_lang.php, make sure you save it in ASCII.
Compare local and remote versions of PHP. If there are differences, update your local copy to the same as the servers, and retest.
Check that the file is being transferred perfectly. If you are putting the file up using FTP, then FTP may be modifying it as it transfers it. FTP has two modes - an ASCII mode and a BINARY mode. If the files are being transferred as ASCII, then there may be some rewriting of the file going on. Try making sure imglib_lang.php is being transferred as BINARY to make sure the exact file is being uploaded.
If you think that you have everything configured correctly, maybe your library (or specifically, imglib_lang.php) is simply producing PHP warnings or notices. If you can get a hold of your logs from your host, it would be helpful.
Otherwise, you can try to turn off PHP's error reporting:
error_reporting(0);
(you can place that line in your index.php)