[xdebug-dev] xdebug xdebug/xdebug_code_coverage.c xdebug/tests/coverage4.inc xdebug/tests/coverage4.phpt - Fixed abstract method detection.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Wed, 13 Feb 2008 14:37:47 +0100

Date: Wed Feb 13 14:37:47 CET 2008
User: Derick Rethans
Directory: xdebug

Log Message:
[0.50]
- Fixed abstract method detection.

Modified files:
           xdebug/xdebug_code_coverage.c (version: 1.40)
Added files:
           xdebug/tests/coverage4.inc (new version: 1.1)
           xdebug/tests/coverage4.phpt (new version: 1.1)

[FILE: /xdebug/xdebug_code_coverage.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- xdebug/xdebug_code_coverage.c:1.39 Fri Nov 30 21:19:51 2007 GMT
+++ xdebug/xdebug_code_coverage.c Wed Feb 13 12:37:47 2008 GMT
@@ -240,7 +240,11 @@
 #ifdef ZEND_ENGINE_2
         /* Check for abstract methods and simply return from this function in those
          * cases. */
+#if PHP_VERSION_ID >= 50300
+ if (opa->size >= 3 && opa->opcodes[opa->size - 3].opcode == ZEND_RAISE_ABSTRACT_ERROR)
+#else
         if (opa->size >= 4 && opa->opcodes[opa->size - 4].opcode == ZEND_RAISE_ABSTRACT_ERROR)
+#endif
         {
                 return;
         }

[FILE: /xdebug/tests/coverage4.inc]

<?php
interface ezcFeedParser
{
    /**
     * Returns true if the parser can parse the provided XML document object,
     * false otherwise.
     *
     * @param DOMDocument $xml The XML document object to check for parseability
     * @return bool
     */
    public static function canParse( DOMDocument $xml );
                                                                                
    /**
     * Parses the provided XML document object and returns an ezcFeed object
     * from it.
     *
     * @throws ezcFeedParseErrorException
     * If an error was encountered during parsing.
     *
     * @param DOMDocument $xml The XML document object to parse
     * @return ezcFeed
     */
    public function parse( DOMDocument $xml );
}
?>

[FILE: /xdebug/tests/coverage4.phpt]

--TEST--
Test with Code Coverage with abstract methods (ZE2)
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.0.0-dev", '<')) echo "skip Zend Engine 2 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
xdebug.trace_options=0
xdebug.trace_output_dir=/tmp
xdebug.collect_params=1
xdebug.collect_return=0
xdebug.auto_profile=0
xdebug.profiler_enable=0
xdebug.dump_globals=0
xdebug.show_mem_delta=0
xdebug.trace_format=0
xdebug.extended_info=1
--FILE--
<?php
    xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);

        include 'coverage4.inc';

    xdebug_stop_code_coverage(false);
    var_dump(xdebug_get_code_coverage());
?>
--EXPECTF--
array(2) {
  ["%scoverage4.inc"]=>
  array(2) {
    [2]=>
    int(1)
    [26]=>
    int(1)
  }
  ["%scoverage4.php"]=>
  array(2) {
    [4]=>
    int(1)
    [6]=>
    int(1)
  }
}
Received on Wed Feb 13 2008 - 14:37:55 GMT

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST