PHP debugging

Using IntelliJ IDEA 10.0.3 I am trying out PHP remote debugging on some working code.

I have the following (Drupal module) function:-

function uc_payment_method_nochex_admin($op, &$arg1) {
  switch ($op) {
    case 'order-view':
      ...

            ...
            return ...         
    case 'settings':
      $form['uc_nochex_hidebilling'] = array(
        '#type' => 'checkbox',
        '#title' => t("Hide billing address on Nochex payment page."),
        '#default_value' => variable_get('uc_nochex_hidebilling', FALSE),
      );
      ...

      ...
      return $form;
  }
}


The above is called from:-

$method_settings = $method['callback']('settings', $null);

When I set a breakpoint on the above line, I can step into the function and the case 'settings' code is executed.

If I set a breakpoint on the return $form in uc_payment_method_nochex_admin execution halts as expected. If I set a breakpoint anywhere else in uc_payment_method_nochex_admin (eg at the first line in case 'settings':) then the breakpoint is ignored.

Any ideas why breakpoints within the function (except on the return statement) are being ignored?

0

Hi Bob,

Which debugger do you use -- Xdebug or Zend Debugger ?

Looking at the code provided I think you are facing this issue (which is actually a Xdebug problem) -- http://youtrack.jetbrains.net/issue/WI-2191?projectKey=WI

0

I'm using xdebug.

0

You are spot on! I changed the first statement in 'case settings:'  to be on a single line and the breakpoint worked!

I am pleased to know why but don't like the idea of having to change my code to get a breakpoint to work.

Perhaps I will try the zend debugger.

Many thanks for your answer.

0

In the statement

      $form['uc_nochex_hidebilling'] = array(
        '#type' => 'checkbox',
        '#title' => t("Hide billing address on Nochex payment page, so customers can't edit it."),
        '#default_value' => variable_get('uc_nochex_hidebilling', FALSE),
      );


It will break on the 2nd line: '#type' => 'checkbox', but not on any of the other lines.

0
Avatar
Permanently deleted user

Bob,

Please vote/watch - http://youtrack.jetbrains.net/issue/WI-4721

Thank you for feedback!

0
Avatar
Permanently deleted user

Bob,

I am pleased to know why but don't like the idea of having to change my code to get a breakpoint to work.

Basically the problem is that debugger engine doesn't provide any validation for line breakpoints but the fact that WI-2191,WI-4721 issues exist mean that we can provide better validation on IDE side.

Thank you for feedback!
0
Avatar
Permanently deleted user

Andriy,

Thank you for your help!:)

0

请先登录再写评论。