I have a web app that used FPDI to create pdf files, using laravel 5.7, setasign/fpdi-fpdf ^2.0 and PHP 7.4.
I recently upgraded to laravel 9 (also upgrading respective dependencies) and because the meta package was depcrecated, I now use "setasign/fpdf": "^1.8", "setasign/fpdi": "^2.0" as well as PHP 8.0.26
Now when trying to run my script I get the error "FPDF Error: Invalid Call" with the whole trace in the error handler, but I find this error message only semi informative.
Any ideas how I can debug this error?
Does FPDI have issues with PHP8? I didn't see any mention of that in the documentation.
thanks in advance!
From FPDF code, the error is shown when state == 1
fpdf.php#L1458
protected function _out($s)
{
// Add a line to the current page
if($this->state==2)
$this->pages[$this->page] .= $s."\n";
elseif($this->state==0)
$this->Error('No page has been added yet');
elseif($this->state==1)
$this->Error('Invalid call');
elseif($this->state==3)
$this->Error('The document is closed');
}
And state 1 is when the page ends
fpdf.php#L1128
protected function _endpage()
{
$this->state = 1;
}
Which happens when you close the document by calling output() (and when you switch to the next page but that automatically opens the next page).
So you might also have to read the new documentation of FPDF and adapt the code related to it.
Related
I have created a spring-boot server for handling stripe webhooks.
However, webhooks are working - I am getting an event, but when i try to get the value of dataObjectDeserializer.getObject() its null. Any ideas why that might be and how to fix it.
Here is the code:
Event event = null;
try {
event = Webhook.constructEvent(
payload, sigHeader, endpointSecret
);
} catch (SignatureVerificationException e) {
// Invalid signature
logger.info("Webhook error while validating signature.");
return "";
}
EventDataObjectDeserializer dataObjectDeserializer = event.getDataObjectDeserializer();
StripeObject stripeObject = null;
if (dataObjectDeserializer.getObject().isPresent()) {
stripeObject = dataObjectDeserializer.getObject().get();
} else {
// Deserialization failed, probably due to an API version mismatch.
// Refer to the Javadoc documentation on `EventDataObjectDeserializer` for
// instructions on how to handle this case, or return an error here.
}
I ran into the same issue recently.
In my case (Which I believe might be yours as well). Is that the Event is not being properly deserialized because a version mismatch between the API you are using in your account and the models of the Stripe SDK in your project. You can check this by looking into: Event.getApiVersion() and Stripe.API_VERSION.
If they differ then you will need to properly upgrade them and take in consideration migration guidelines if they apply to your scenario.
On my case since it was a first time I didn't need to go through any migration and I just simply when to my dash board and upgrade the sdk:
Dashboard Note: It displays rollback because I did upgrade it. If you haven't you will have a "Upgrade" option available.
You can find more info on their documentation page:
Upgrade Stripe API
Versioning
Hope this helps!
It looks like Vuepress is made for public docs, but we decided to add client and server security to protect some of the doc pages. But unfortunately although oidc-client (https://github.com/IdentityModel/oidc-client-js/wiki) works during dev, it throws exception when build.
I get ReferenceError: window is not defined and when I try to trick the compiler with const window = window || { location: {} }; I get TypeError: Cannot read property 'getItem' of undefined
Any idea how to make this work?
This was driving me nuts also. I discovered the component I was trying to add was looking at window.location in its code - this was triggering the error.
My understanding is that the build process has not access to Browser things like window etc.
As soon as I removed the window.location bit from my code things built just fine and all is well.
So I'm trying to create a plugin that uses PrettyDialog (https://github.com/mjn1369/PrettyDialog) using the latest NativeScript seed.
However I've run into the following error when compiling:
Error: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
That happens using the following code, and calling show() (TypeScript):
export class PrettyAlert {
show() {
const alert = this.createAlert();
}
createAlert(width?: number) {
return new libs.mjn.prettydialog.PrettyDialog(app.android.context);
}
}
I've been looking into the error here (pure Android): You need to use a Theme.AppCompat theme (or descendant) with this activity
But none of the solutions have worked.
I figure it possible somehow, but I'm new a plugin building, and I'm sure there's some quirks I need to understand.
There are similar plugins - fancyalert / cfalert already if you are not very choosy about PrettyDialog.
NativeScript introduced support for AppCompatActivity from v5.x which seems just hit live. You should bypass this error if you upgrade to latest version.
I am using nopCommerce 3.3. The admin uses the Kendo UI grid. On occassion, my pages fail to load. I see a dialog box that says error happened that will not disappear. I have found this code on my page:
function display_kendoui_grid_error(n) {
if(n.errors)
if(typeof n.errors=="string")
alert(n.errors);
else {
var t="The following errors have occurred:";
$.each(n.errors, function(n,i) {
i.errors && (t+="\n", t+=i.errors.join("\n"))
});
alert(t)
}
else
alert("Error happened")
}
I have noticed that CSS fails to load sometimes and possibly, some JS files fail to load. I am running IIS 8 using .NET 4.51. How do I found out the exact error message?
I ran a breakpoint on the code. n.errors is undefined. Is there another place to look for an error?
I upgraded my hosting plan to a dedicated server and it works. nopCommerce needs a lot of MB in the app pool to operate properly.
Set a breakpoint and see what n is, or print out the entire object by changing alert("Error happened") to something like:
alert("Error happened: " + JSON.stringify(n));
If these are errors that the user shouldn't see, then you should use console.error("the message"); instead. of an alert. Then you can see the messages as errors in the devtools console. You can also then just write whole objects to the console: console.error(n);
I get an error in Magento 1.6.1.0 backend:
System -> Permissions -> Users -> Edit user
When I try to access this page nothing gets loaded into content area. Page layout and menus are displayed but the form for user editing is not.
In Firbug it throws the following error:
$("user_user_roles") is null
This line comes from
app/design/adminhtml/default/default/template/permissions/user_roles_grid_js.phtml
which has not been touched.
I did an update from 1.6.0.0 to 1.6.1.0 ... could create and edit users in the old version but I am not able to do it now. Could not find anything on the web for this error.
Please let me know if there is a fix to this.
I also got this error. Here is what I did to fix.
Open file Roles.php in app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tab/Roles.php and add getRowUrl() function:
public function getRowUrl($row) {
return $this->getUrl('*/*/edit');
}
Hope this helps,
Neo.