asmblah / uniter

šŸŽ‰ PHP in the browser and Node.js => Docs: https://phptojs.com/
https://asmblah.github.io/uniter/
Other
446 stars 42 forks source link

Uncaught TypeError: propertyData.value is not a function #53

Closed phpengine closed 4 years ago

phpengine commented 5 years ago

Hi @asmblah ,

So, this one is a bit more difficult for me to point out the code of, but I've got it down to it happening during the instantiation of a class. I'm not sure what the best way to display a demo of the failed code is, as I'm running this within PHPDesktop/Chrome.

When I Try to instantiate this class... https://gist.github.com/phpengine/6ea043374e25b48364d9d88573007310

Which is called from line 21 of this... https://gist.github.com/phpengine/7f9d9382f3df722f6b749cb410fefe94

Then I get the following fatal error...

Uncaught TypeError: propertyData.value is not a function
    at prod_bundle.js:35976
    at Object.module.exports [as forOwn] (prod_bundle.js:4205)
    at ObjectValue.InternalClass (prod_bundle.js:35974)
    at Class.instantiate (prod_bundle.js:36870)
    at BarewordStringValue.instantiate (prod_bundle.js:39993)
    at Tools.createInstance (prod_bundle.js:33339)
    at Scope._main (prod_bundle.js:43099)
    at ObjectValue.wrapperFunc (prod_bundle.js:35449)
    at callMethod (prod_bundle.js:36530)
    at Class.callMethod (prod_bundle.js:36586)

The code in Uniter that appears to be being triggered is this...

                    // Go through and define the properties and their default values
                    // on the object from the class definition by initialising them
                    _.forOwn(definition.properties, function (propertyData, name) {
                        var instanceProperty = properties[name],
                            initialValue = propertyData.value();

Any ideas as to what might be causing this please? Or, is there an alternate way you'd like to to run / host the code that would help? I've uploaded the whole thing in a zip file that will run on linux, if you download the following https://repositories.internal.pharaohtools.com/index.php?control=BinaryServer&action=serve&item=uniter_phpdesktop_bug

Then extract the tarball

cd ptv_gui/phpdesktop
./phpdesktop --remote-debugging-port=10101

Then the application will open, and the terminal output will show the error. Also, it'll open the chrome debugging port, and 127.0.0.1:10101 will show the chrome console.

phpengine commented 5 years ago

Also hopefully helpful is that the same code works in Zend, as you can see from the terminal output.

phpengine commented 5 years ago

HI I've just made a workaround for this, so its not urgent at all for now, but would be a nice to know. I have just made all the properties and methods of the router class static, and that seems to have worked so no worries on this for now, thanks!

asmblah commented 5 years ago

@phpengine sorry for the delay in responding to this! I think I've broken this with some recent changes that were introduced to support visibility of properties (it was previously ignored). There is a branch of phpruntime called experimental that I need to finish tidying and merge back to master to do a stable release which I'm hoping to get to this weekend.

Thank you very much for the test tarball, I'll get that extracted and check that the latest phpruntime version will solve it for you as I'm sure you don't want to make all the class members static just to work around this šŸ™‚

phpengine commented 5 years ago

@asmblah great, I thought it might have been me. No worries, sometimes life gets in the way of programming :) Looking forward to the updates. Thanks

asmblah commented 5 years ago

@phpengine just as an update - there are still a few things to sort before the experimental branch can be merged back to master. Once it is, I'll let you know here šŸ‘

asmblah commented 5 years ago

@phpengine sorry for the massive delay - just to let you know, this is still on my radar. How are things going?

phpengine commented 5 years ago

Hey @asmblah, yeah things are going great actually. We'll be looking to release our first fully fledged Uniter Apps across Web/Mobile in the next couple of months. We made a couple of smaller SPA's, but these ones are much more complete. Loving it so far - thinking actually that one in particular seems reasonably likely to signal an end to contracting for me, which would be nice...

Thanks for the update and letting me know that it is on the radar, as actually Uniter is quite key for us doing the above :)

Not sure why this message didn't pop up on my feed as I'm watching the repo (and this issue)...

asmblah commented 5 years ago

Hi @phpengine - that's great to hear, sounds very exciting!

I'm just picking up the experimental branch changes tonight - looking to put out a new PHPRuntime release followed by Uniter either late this week or early next week.

Let me know if there are any other Uniter features you'd like to see for your apps! šŸ˜ƒ

Cheers!

asmblah commented 5 years ago

Hi @phpengine - just to give you an update, I've pushed up some changes to the experimental branch I mentioned above, but it's not quite ready for merging just yet. I'm going to continue with the remaining bits early this week.

It's going to be a big one - here is the current changeset: https://github.com/uniter/phpruntime/pull/6/files - so I need to make sure I get it right! šŸ˜…

asmblah commented 5 years ago

Evening @phpengine - just thought I'd give another update. I've pushed up some more changes to the experimental branch of PHPRuntime tonight. There are still some other niggles that need addressing and a couple of changes that are a bit too "experimental" to finish right now and so I may just remove them from this branch in order to make it mergeable. I'll keep you posted!

asmblah commented 5 years ago

Hi @phpengine - as noted on https://github.com/asmblah/uniter/issues/52, the release I've just published v2.13.0 should resolve this issue. Sorry again for the massive delay!

asmblah commented 5 years ago

Hi @phpengine - how are things? Could you let me know whether this resolved your issue if you get a chance - if not, just drop a note here and I'll be happy to take a look - thanks! šŸ˜ƒ

asmblah commented 4 years ago

Closing as this should be resolved in recent releases as above - feel free to reopen if you're still having problems with it though @phpengine