I have some code in my application:
$dmMain->tblOrgList->append();
This code written with auto-completion, so everything is correct.
But, when I trying to execute this code, I have error:
Fatal error: Call to a member function append() on a non-object in
C:\Users\ASAP\Documents\HTML5 Builder\Projects\VitoOrgList\index.php
on line 18
Can somebody advice, where I can find a trouble?
Thanks
I found the solution.
Really, I have no big PHP experience :-]
I just added before calling $dmMain methods in function body:
global $dmMain;
Related
We got an error at the top of some pages: Warning: Invalid argument supplied for foreach() in /public_html/classes/Hook.php on line 491.
I've read that it could be a problem with the foreach loop or arrays, but I don't know php and don't know how to fix it.
In line 491 I find: foreach ($results as $result) {
Another problem is that when I enter a category from the client side, I can't go to the 2nd/3rd/4th/5th page, only one page is displayed and the next ones don't want to load. The error Warning: Invalid argument supplied for foreach() in /public_html/classes/Hook.php on line 491 appears on pages that do not want to load.
I also get an error after enabling debug mode:
PrestaShopBundle\EntityTab.
The association PrestaShopBundle\EntityTab#tabLangs refers to the owning side field PrestaShopBundle\EntityTabLang#tab which does not exist.
I changed:
#ORM\OneToMany(targetEntity="PrestaShopBundle\Entity\TabLang", mappedBy="tab")
to
#ORM\OneToMany(targetEntity="PrestaShopBundle\Entity\TabLang", mappedBy="id")
insrc/PrestaShopBundle/Entity/Tab.php but it doesn't help.
PHP debug info debug info
I managed to solve the problem - I had to change active to m.active in the body of the sql query. Thank you
I try to build a vue SPA and encounter this error
vite v2.9.15 building for production...
✓ 124 modules transformed.
[rollup-plugin-dynamic-import-variables] Assigning to rvalue (3271:44)
file: /ORIGINAL-P1/LARAVEL-BREW/BrewersCompanion/vue/src/components/RecipeEditor.vue:3271:44
error during build:
SyntaxError: Assigning to rvalue (3271:44)
at Parser.pp$4.raise (/ORIGINAL-P1/LARAVEL-BREW/BrewersCompanion/vue/node_modules/rollup/dist/shared/rollup.js:19738:13)
at Parser.pp$7.toAssignable (/ORIGINAL-P1/LARAVEL-BREW/BrewersCompanion/vue/node_modules/rollup/dist/shared/rollup.js:18231:12)
at Parser.pp$5.parseMaybeAssign (/ORIGINAL-P1/LARAVEL-BREW/BrewersCompanion/vue/node_modules/rollup/dist/shared/rollup.js:18754:21)
at Parser.pp$5.parseParenAndDistinguishExpression (/ORIGINAL-P1/LARAVEL-BREW/BrewersCompanion/vue/node_modules/rollup/dist/shared/rollup.js:19209:28)
at Parser.pp$5.parseExprAtom (/ORIGINAL-P1/LARAVEL-BREW/BrewersCompanion/vue/node_modules/rollup/dist/shared/rollup.js:19072:41)
at Parser.pp$5.parseExprSubscripts (/ORIGINAL-P1/LARAVEL-BREW/BrewersCompanion/vue/node_modules/rollup/dist/shared/rollup.js:18905:19)
at Parser.pp$5.parseMaybeUnary (/ORIGINAL-P1/LARAVEL-BREW/BrewersCompanion/vue/node_modules/rollup/dist/shared/rollup.js:18871:17)
at Parser.pp$5.parseExprOps (/ORIGINAL-P1/LARAVEL-BREW/BrewersCompanion/vue/node_modules/rollup/dist/shared/rollup.js:18798:19)
at Parser.pp$5.parseMaybeConditional (/ORIGINAL-P1/LARAVEL-BREW/BrewersCompanion/vue/node_modules/rollup/dist/shared/rollup.js:18781:19)
at Parser.pp$5.parseMaybeAssign (/ORIGINAL-P1/LARAVEL-BREW/BrewersCompanion/vue/node_modules/rollup/dist/shared/rollup.js:18748:19)
The builder points to line 3271 but I am pretty sure that there is not right hand variable assignation i.e. no error here.
To confirm my thinking, as it is in a rather long function that returns a value I decide to comment this function and to replace it by a very short one returning a number, like this.
function currentTemperature(time, time_step) {
return 373;
}
The program continues to compile pretty well with npm run dev
But npm run build returns the same error still pointing on the same line that is now in a comment.
My question is how to locate my error as the builder returns an invalid location ?
I am using Visual Studio Code
Thank you in advance for help.
I followed the official Guide from Typo3 for creating a new extension (https://docs.typo3.org/m/typo3/book-extbasefluid/9.5/en-us/4-FirstExtension/Index.html). But when I finished, the page with the plugin gives me only an ERROR 500. No Error-Log anyway.
When I enabled ErrorDisplay I found, that there was a problem with boolean values. So I deleted them and tried again. Again all I got was ERROR 500. ErrorDisplay said the constructor cannot have a return value - hu?? Found inline 7 - but the declaration is in line 22 -??
public function __construct(int $j = 0, int $n = 0, int $i = 0, int $p = 0, int $y = 0, int $a = 0): void {...}
So I tried to delete the return value. But then it told me, that the class couldn't be found. Next, I tried to find anything about that error but found even less than nothing.
I wasn't even able to find extensions that are implementing the way explained by the official guide. Is there anybody who can tell me, what is going wrong and where I can find a solution - I have no idea anymore.
After hours and hours trial and error I found the solution. The Problem is, that Typo3 doesn't give a proper error message due to failing with the exception handling. You have to enable normal PHP Errors to get a clue what is wrong. If there is any php error, Typo3 fails and gives an reflection error, because it thinks the class isn't available.
First Error was: following the official guide instructions for first extension. Compiler ist failing if you try to give the constructor a return value.
Second Error: Typo3 doesn't recognize if a parameter in constructor is missing. It tries to take the next parameter and fails by comparing the parameters type.
Third Error: If the class is missing the instructions for underlying symphony framework the reflection also fails with registering the class without giving any error message.
After I found and corrected all the errors, all worked fine.
I am trying the fusionauth-node-client and following the wiki https://fusionauth.io/docs/v1/tech/client-libraries/node. But I am getting the following error
const client = new FusionAuthClient('6b87a398-39f2-4692-927b-13188a81a9a3', 'http://localhost:9011');
^
TypeError: FusionAuthClient is not a constructor
at Object.<anonymous>
I have pasted the exact code mentioned in the doc still it is not working. Can anyone help me in identifying what I am missing here.
I dug around in the library and noticed that we are exporting several objects and our example is no longer correct.
To get the client you need to change your syntax a little bit to get the correct object.
const {FusionAuthClient} = require('fusionauth-node-client');
This translates to: require the library fusionauth-node-client and give me the FusionAuthClient from inside it. There are also a RESTClient and JWTManager available in the library but you shouldn't need either of those to code with FusionAuth.
I will also update our example to correct this discrepancy.
I am trying to learn how to use Jasmine and Sinon for testing a Backbone application, and I was following this tutorial. Nevertheless, I ran into a problem that I don't know how to solve.
Most likely the solution is simple, but I need some guidance ...
In my project.spec.js file this is the code that is giving the problem:
it("should not save when name is empty", function() {
var eventSpy = sinon.spy();
this.project.bind("error", eventSpy);
this.project.save({"name": ""});
expect(this.eventSpy.calledOnce).toBeTruthy();
expect(this.eventSpy.calledWith(
this.project,
"cannot have an empty name"
)).toBeTruthy();
});
And this is the specific error that can be seen in the browser:
Failing 1 spec
7 specs | 1 failing
Project model should not save when name is empty.
TypeError: Object #<Object> has no method 'spy'
TypeError: Object #<Object> has no method 'spy'
at null.<anonymous> (http://localhost:8888/__spec__/models/project.spec.js:53:26)
at jasmine.Block.execute (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:1024:15)
at jasmine.Queue.next_ (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:2025:31)
at jasmine.Queue.start (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:1978:8)
at jasmine.Spec.execute (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:2305:14)
at jasmine.Queue.next_ (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:2025:31)
at onComplete (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:2021:18)
at jasmine.Suite.finish (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:2407:5)
at null.onComplete (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:2451:10)
at jasmine.Queue.next_ (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:2035:14)
In addition to the sinon.js library, I have installed the jasmine-sinon.js library (both are in the vendor/assets/javascripts folder and are included in the application.js file).
Thank you,
Alexandra
I faced this problem when I downloaded sinon.js file from GitHub (without Sinon folder). I solved the problem by downloading the library from http://sinonjs.org/
I'm going to post this as an answer, based on the comment thread above. We've narrowed down the problem to the line where sinon.spy() is called, so it's not specific to this test but to how sinon is being loaded.
I suspect the problem is that you're including sinon and jasmine-sinon in application.js, when they should really go in spec/javascripts/spec.js (in the same format). Try changing that and see if anything changes.
UPDATE:
Based on the comment thread below, it seems the code is getting to the this.project.save(...) line but the validations aren't working: I know this because if you're getting a POST error in the console, it means that backbone actually made the request (which it should not have because the name is empty). So you should go back and check the code you are actually testing.
I know this thread is old, but I had a similar issue today with this when going through this tutorial http://tinnedfruit.com/2011/03/25/testing-backbone-apps-with-jasmine-sinon-2.html. It looks like Backbone made a change and it calls the 'invalid' event when invalid model data is provided, not 'error'.
If you run into this error try changing:
it("should not save when name is empty", function() {
...
this.project.bind("error", eventSpy);
...
});
To:
it("should not save when name is empty", function() {
...
this.project.bind("invalid", eventSpy);
...
});
This resolved the issue for me.