diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..7b94613 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,62 @@ +version: '{branch}.{build}' + +install: +- cmd: choco feature enable -n=allowGlobalConfirmation +- cmd: cinst wget +- cmd: mkdir C:\projects\php-timecop\bin + +environment: + PROJECT_NAME: php-timecop + PROJECT_DIR: C:\projects\php-timecop + PHP_SRC_DIR: C:\projects\php-src + TEST_PHP_EXECUTABLE: C:\projects\php-timecop\bin\php.exe + REPORT_EXIT_STATUS: 1 + NO_INTERACTION: 1 + +build_script: +- cmd: >- + "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat" + + git clone https://github.com/php/php-src %PHP_SRC_DIR% + + cd %PHP_SRC_DIR% + + git checkout PHP-7.1 + + wget http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110915.zip + + 7z x -y php-sdk-binary-tools-20110915.zip -oC:\projects\php-sdk + + C:\projects\php-sdk\bin\phpsdk_setvars.bat + + mkdir %PHP_SRC_DIR%\ext\%PROJECT_NAME% + + xcopy %PROJECT_DIR% %PHP_SRC_DIR%\ext\%PROJECT_NAME% /s /e /y + + wget http://windows.php.net/downloads/php-sdk/deps-7.1-vc14-x86.7z + + 7z x -y deps-7.1-vc14-x86.7z -o%PHP_SRC_DIR% + + buildconf.bat + + configure.bat --disable-all --enable-phar --enable-json --enable-hash --enable-ctype --enable-filter --enable-tokenizer --enable-zip --with-iconv --with-openssl --with-dom --with-libxml --enable-cli --enable-zts --enable-timecop=shared --with-config-file-scan-dir=%PROJECT_DIR%\bin\modules.d --with-prefix=%PROJECT_DIR%\bin --with-php-build=deps + + nmake + + nmake install + + copy php.ini-development %PROJECT_DIR%\bin\php.ini + + mkdir %PROJECT_DIR%\bin\modules.d + + echo extension=php_timecop.dll >> %PROJECT_DIR%\bin\modules.d\php.ini + +test_script: +- cmd: >- + cd %PROJECT_DIR% + + dir bin\ext + + %PROJECT_DIR%\bin\php.exe %PHP_SRC_DIR%\run-tests.php --show-diff + + exit /b %errorlevel% diff --git a/php_timecop.h b/php_timecop.h index 4d502db..6606ed0 100644 --- a/php_timecop.h +++ b/php_timecop.h @@ -42,7 +42,12 @@ extern zend_module_entry timecop_module_entry; #include "TSRM.h" #endif +#ifndef PHP_WIN32 #include +#else +#include "win32/time.h" +#endif + #include "Zend/zend_interfaces.h" #include "tc_timeval.h" diff --git a/tests/core_002.phpt b/tests/core_002.phpt index 1fc7869..75acf4b 100644 --- a/tests/core_002.phpt +++ b/tests/core_002.phpt @@ -13,13 +13,13 @@ timecop.func_override=0 format("Y-m-d H:i:s")); var_dump($dt3->format("Y-m-d H:i:s")); diff --git a/tests/core_006.phpt b/tests/core_006.phpt index 6d86240..ec1694a 100644 --- a/tests/core_006.phpt +++ b/tests/core_006.phpt @@ -12,13 +12,13 @@ date.timezone=America/Los_Angeles format("Y-m-d H:i:s")); var_dump($dt3->format("Y-m-d H:i:s")); diff --git a/timecop_php5.c b/timecop_php5.c index d266a5d..52cea0f 100644 --- a/timecop_php5.c +++ b/timecop_php5.c @@ -689,7 +689,7 @@ static int timecop_class_override_clear(TSRMLS_D) { const struct timecop_override_class_entry *p; zend_class_entry **pce_orig, *ce_orig; - zend_function *zf_orig, *zf_ovrd, *zf_save; + zend_function *zf_orig; p = &(timecop_override_class_table[0]); while (p->orig_class != NULL) { diff --git a/timecop_php7.c b/timecop_php7.c index ec7400d..b4d01e7 100644 --- a/timecop_php7.c +++ b/timecop_php7.c @@ -646,7 +646,7 @@ static int timecop_class_override_clear() { const struct timecop_override_class_entry *p; zend_class_entry *ce_orig; - zend_function *zf_orig, *zf_ovrd, *zf_save; + zend_function *zf_orig; p = &(timecop_override_class_table[0]); while (p->orig_class != NULL) { @@ -706,7 +706,7 @@ static int update_request_time(zend_long unixtime) static int restore_request_time() { - zval *server_vars, *request_time, orig_request_time; + zval *server_vars; server_vars = zend_hash_str_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER")-1); if (Z_TYPE(TIMECOP_G(orig_request_time)) != IS_NULL && @@ -777,7 +777,7 @@ static int get_formatted_mock_time(zval *time, zval *timezone_obj, zval *retval_ zval fixed_sec, orig_zonename; zval now_timestamp, str_now; tc_timeval now; - long fixed_usec; + zend_long fixed_usec; if (TIMECOP_G(timecop_mode) == TIMECOP_MODE_REALTIME) { ZVAL_FALSE(retval_time); @@ -871,7 +871,7 @@ static int get_formatted_mock_time(zval *time, zval *timezone_obj, zval *retval_ static long get_mock_fraction(zval *time, zval *timezone_obj TSRMLS_DC) { zval dt1, dt2, usec1, usec2; - long fixed_usec; + zend_long fixed_usec; zval u_str, sleep_usec; call_php_function_with_2_params(ORIG_FUNC_NAME("date_create"), &dt1, time, timezone_obj); @@ -1357,7 +1357,7 @@ static inline void _timecop_date_create(INTERNAL_FUNCTION_PARAMETERS, int immuta static void _timecop_datetime_constructor_ex(INTERNAL_FUNCTION_PARAMETERS, zval *obj, int immutable) { zval orig_time, *orig_timezone = NULL; - zval fixed_time, fixed_timezone, dt, *arg1, *arg2; + zval fixed_time, fixed_timezone, *arg1, *arg2; char *orig_time_str = NULL; size_t orig_time_len = 0; const char *real_func;