Skip to content

Commit

Permalink
Merge pull request #43 from skilld-labs/php8
Browse files Browse the repository at this point in the history
Add nightly to travis testing matrix and remove unsupported
  • Loading branch information
longxinH authored Aug 20, 2020
2 parents cf7be41 + 399b384 commit 4646abb
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ notifications:
email: false

php:
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- nightly

env:
global:
Expand Down
5 changes: 5 additions & 0 deletions extension/php_xhprof.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,13 @@ static zend_op_array * (*_zend_compile_file) (zend_file_handle *file_handle, int
ZEND_DLEXPORT zend_op_array* hp_compile_file(zend_file_handle *file_handle, int type);

/* Pointer to the original compile string function (used by eval) */
#if PHP_VERSION_ID < 80000
static zend_op_array * (*_zend_compile_string) (zval *source_string, char *filename);
ZEND_DLEXPORT zend_op_array* hp_compile_string(zval *source_string, char *filename);
#else
static zend_op_array * (*_zend_compile_string) (zval *source_string, const char *filename);
ZEND_DLEXPORT zend_op_array* hp_compile_string(zval *source_string, const char *filename);
#endif

/**
* ****************************
Expand Down
1 change: 1 addition & 0 deletions extension/tests/xhprof_012.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ XHProf: Test Curl Additional Info
Author: longxinhui
--SKIPIF--
<?php if (!extension_loaded("curl")) print 'skip'; ?>
<?php if (PHP_VERSION_ID >= 80000) echo "skip test for php >= 8"; ?>
--INI--
xhprof.collect_additional_info = 1
--FILE--
Expand Down
31 changes: 31 additions & 0 deletions extension/tests/xhprof_012_8.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--TEST--
XHProf: Test Curl Additional Info
Author: longxinhui
--SKIPIF--
<?php if (!extension_loaded("curl")) print 'skip'; ?>
<?php if (PHP_VERSION_ID < 80000) echo "skip test for php < 8"; ?>
--INI--
xhprof.collect_additional_info = 1
--FILE--
<?php

include_once dirname(__FILE__).'/common.php';

xhprof_enable();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.php.net/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_exec($ch);
curl_close($ch);
$output = xhprof_disable();
print_canonical($output);
echo "\n";

?>
--EXPECTF--
main() : ct= 1; wt=*;
main()==>curl_close : ct= 1; wt=*;
main()==>curl_exec : ct= 1; wt=*;
main()==>curl_init : ct= 1; wt=*;
main()==>curl_setopt : ct= 2; wt=*;
main()==>xhprof_disable : ct= 1; wt=*;
6 changes: 6 additions & 0 deletions extension/xhprof.c
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,11 @@ ZEND_DLEXPORT zend_op_array* hp_compile_file(zend_file_handle *file_handle, int
/**
* Proxy for zend_compile_string(). Used to profile PHP eval compilation time.
*/
#if PHP_VERSION_ID < 80000
ZEND_DLEXPORT zend_op_array* hp_compile_string(zval *source_string, char *filename)
#else
ZEND_DLEXPORT zend_op_array* hp_compile_string(zval *source_string, const char *filename)
#endif
{
if (!XHPROF_G(enabled)) {
return _zend_compile_string(source_string, filename);
Expand Down Expand Up @@ -1532,7 +1536,9 @@ zend_string *hp_trace_callback_curl_exec(zend_string *symbol, zend_execute_data
&retval,
params,
NULL,
#if PHP_VERSION_ID < 80000
1,
#endif
1
};

Expand Down

0 comments on commit 4646abb

Please sign in to comment.