Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-18094

Use print_r rather than var_dump when outputting queries to debug log

    Details

    • Type: Patch
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.2
    • Fix Version/s: 4.7.3
    • Component/s: None
    • Labels:
      None
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      I observed my query log is full of stuff like this

      $Query = <pre class='xdebug-var-dump' dir='ltr'><small>string</small> <font color='#cc0000'>'SELECT * FROM civicrm_component '</font> <i>(length=45)</i>

      when I have 'CIVICRM_DEBUG_LOG_QUERY' defined.

      The reason is the debug_var function has this little section

      ``
      if ($print)

      { $out = print_r($variable, TRUE); $out = "\$$variable_name = $out"; }

      else

      { // use var_dump ob_start(); var_dump($variable); $dump = ob_get_contents(); ob_end_clean(); $out = "\n\$$variable_name = $dump"; }

      ``

      I can't see an advantage of the var_dump sequence over $print so am submitting a patch to pass in $print as TRUE

        Attachments

          Activity

            People

            • Assignee:
              eileen Eileen McNaughton
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: