|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-01-10 08:01 UTC] kalle@php.net
-Status: Open
+Status: Suspended
[2017-01-10 08:01 UTC] kalle@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 07:00:01 2025 UTC |
Description: ------------ I'm not sure how to describe this bug (feature request) better than the code below. Anyway, thanks for your work. What you've done is great! Reproduce code: --------------- <?php $js = new JSContext; $window = new StdClass; $js->assign('window', $window); $script = <<<JS window.onload = function () { return 'foobar'; }; window.onload(); JS; var_dump($js->evaluateScript($script)); var_dump($window->onload instanceof Closure); Expected result: ---------------- string 'foobar' (length=6) boolean true Actual result: -------------- Exception: TypeError: window.onload is not a function in... for the first var_dump() and false for the second var_dump(). The onload property is actually an instance of StdClass, which isn't necessarily false for JavaScript, as functions are objects. Unfortunately StdClass isn't callable in PHP. Having onload being an instance of Closure would be much better.