dongzhiyong8577 2014-07-08 10:24
浏览 72

PHPStorm,断点配置:“记录评估表达式,并在选项字段中输入有效表达式”的示例。

I'm going to configure PHPStorm options about debugging in PHP with xDebug, reading this page from the manual: http://www.jetbrains.com/phpstorm/webhelp/configuring-breakpoints.html

In step 2, there is: "To evaluate an expression in the context of a breakpoint and display its value in the debugging console, check the option Log evaluated expression, and enter a valid expression in the option field.".

Now, which should be a "valid expression"?

For example, my breakpoint points (Is "points" the correct technical verb/term?) to the line 341 of a Joomla! cms library file (See it: https://github.com/joomla/joomla-cms/blob/3.2.x/libraries/joomla/input/input.php#L341).

It's a method to unserialize serialized strings and it breaks my unit test. So i'd like to know which value the string has when passed to the method.

The line 341, the ones where the test breaks, use the list() PHP construct to assign to 3 different properties the unserialized values of the passed $input.

But the unserialize($input) function doesn't work and i'd like to know why, so i set the breakpoint.

      /**
       * Method to unserialize the input.
       *
       * @param   string  $input  The serialized input.
       *
       * @return  JInput  The input object.
   335 *
   336 * @since   12.1
   337 */
   338 public function unserialize($input)
   339 {
   340     // Unserialize the options, data, and inputs.
() 341      list($this->options, $this->data, $this->inputs) = unserialize($input);
   342
   343      // Load the filter.
   344      if (isset($this->options['filter']))

    ...

Now, as i'd like to know the value of $input, as it's the string that unserialize() cannot process, i think i have to use the option "Log evaluated expression" in PHPStorm so it will log in the console the value of $input, but, again, what should have i to write in the PHPStorm's field?

  • 写回答

1条回答 默认 最新

  • dpsyssiv90846 2015-07-07 17:22
    关注

    According to the issue tracker this is still happening or was never reproduced. The ticket is still open.

    However if you want to see the value without suspending code execution you should be able to use that option. Currently you may also need to have the Suspend option also checked.

    A valid expression would in your case simply $input. You can be more complex such as "$this->id is being validated.". Notice you don't include echo or anything in the expression, it's an expression.

    In my experience the console is simply not being updated. You can briefly see the output flicker when changing focus from PHPStorm.

    评论

报告相同问题?

悬赏问题

  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序