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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Tue May 13 10:01:27 2025 UTC