jaxon-php / jaxon-js

The Jaxon javascript library https://www.jaxon-php.org.
BSD 3-Clause "New" or "Revised" License
4 stars 2 forks source link

Cannot read properties of undefined when turning on debug in v4.8.2 #30

Closed walmartshopper closed 3 weeks ago

walmartshopper commented 3 weeks ago

When I set core.debug.on to true in version 4.8.2 or 4.8.3, I get the following error in the dev console. Jaxon calls still work, but the debugging window doesn't pop up. I have tried setting related options such as core.debug.output_id and core.debug.verbose but still get the error.

I also tried running the demo code below in jaxon 5.0.0rc1. I get the same error, however the debug window does pop up in that version.

image

Example code to reproduce below.

<?php

  require_once($_SERVER['DOCUMENT_ROOT']."/vendor/autoload.php");
  use Jaxon\Jaxon;
  use function Jaxon\jaxon;

  $jaxon = jaxon();
  $jaxon->setOption('core.debug.on', true);

  $jaxon->register(Jaxon::CALLABLE_FUNCTION, "hello");

  function hello()
  {
      $response = jaxon()->newResponse();
      $response->assign('test_div', 'innerHTML', 'Hello World');
      return $response;
  }
  if($jaxon->canProcessRequest()) { $jaxon->processRequest(); }

?>
<html>
    <head>
      <?php print $jaxon->getScript(true, true); ?>
    </head>
    <body>
      <button type="button" onclick="jaxon_hello();">Print Hello World</button>
      <br>
      <div id='test_div'></div>
      <div id='debug'></div>
    </body>
</html>
feuzeu commented 3 weeks ago

Fixed in release https://github.com/jaxon-php/jaxon-js/releases/tag/v4.0.5.