php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #59038 Print error message with not only line number but also specified text
Submitted: 2010-01-20 01:06 UTC Modified: 2010-02-21 17:48 UTC
From: hoshino at labs dot cybozu dot co dot jp Assigned:
Status: Closed Package: spidermonkey (PECL)
PHP Version: 5_3.1RC2 OS: Linux/Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hoshino at labs dot cybozu dot co dot jp
New email:
PHP Version: OS:

 

 [2010-01-20 01:06 UTC] hoshino at labs dot cybozu dot co dot jp
Description:
------------
This prints not only line number but also specified string text when an error occurs in interpreting javascript code. Specify a prefer string to the second argument of evaluateScript() function call. It will help your debug javascript code in PHP. Of course it can be omitted.

The patch is spidermonkey-line-number.patch on http://developer.cybozu.co.jp/oss/2010/01/spidermonkey-ph.html

Reproduce code:
---------------
<?php
$js = new JSContext();
$js->registerFunction('var_dump');
$script = <<< END
    try {
        throw new Error('test message');
    } catch (e) {
        var_dump(e);
    }
END;

$js->evaluateScript($script, 'test call');

Expected result:
----------------
object(stdClass)#2 (4) {
  ["message"]=>
  string(12) "test message"
  ["fileName"]=>
  string(9) "test call"
  ["lineNumber"]=>
  int(1)
  ["stack"]=>
  string(38) "Error("test message")@:0
@test call:1
"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-21 17:48 UTC] c dot robin at smartphp dot org
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Jul 04 16:01:27 2020 UTC