Skip to content

Commit

Permalink
- Fixed abstract method detection.
Browse files Browse the repository at this point in the history
SVN Rev: 2658
  • Loading branch information
derickr committed Feb 13, 2008
1 parent 66e5b42 commit e7785f9
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/coverage4.inc
@@ -0,0 +1,25 @@
<?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 );
}
?>
44 changes: 44 additions & 0 deletions tests/coverage4.phpt
@@ -0,0 +1,44 @@
--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)
}
}
4 changes: 4 additions & 0 deletions xdebug_code_coverage.c
Expand Up @@ -240,7 +240,11 @@ static void prefill_from_oparray(char *fn, zend_op_array *opa TSRMLS_DC)
#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;
}
Expand Down

0 comments on commit e7785f9

Please sign in to comment.