summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sapi/phpdbg/.travis.yml11
-rw-r--r--sapi/phpdbg/config.m41
-rw-r--r--sapi/phpdbg/phpdbg_utils.c9
-rw-r--r--sapi/phpdbg/phpdbg_utils.h20
-rw-r--r--sapi/phpdbg/tests/run-tests.php22
-rwxr-xr-xsapi/phpdbg/travis/ci.sh5
6 files changed, 52 insertions, 16 deletions
diff --git a/sapi/phpdbg/.travis.yml b/sapi/phpdbg/.travis.yml
index 353402858e..d5b492e7cf 100644
--- a/sapi/phpdbg/.travis.yml
+++ b/sapi/phpdbg/.travis.yml
@@ -1,3 +1,12 @@
language: c
-script: ./travis/ci.sh
+env:
+- PHP="PHP-5.4"
+- PHP="PHP-5.5"
+- PHP="PHP-5.6"
+- PHP="master"
+
+before_script: ./travis/ci.sh
+
+script:
+- ./php-src/sapi/cli/php php-src/sapi/phpdbg/tests/run-tests.php -diff2stdout --phpdbg php-src/sapi/phpdbg/phpdbg
diff --git a/sapi/phpdbg/config.m4 b/sapi/phpdbg/config.m4
index ecac171506..1a6640eaca 100644
--- a/sapi/phpdbg/config.m4
+++ b/sapi/phpdbg/config.m4
@@ -9,6 +9,7 @@ PHP_ARG_ENABLE(phpdbg-debug, for phpdbg debug build,
[ --enable-phpdbg-debug Build phpdbg in debug mode], no, no)
if test "$PHP_PHPDBG" != "no"; then
+ AC_HEADER_TIOCGWINSZ
AC_DEFINE(HAVE_PHPDBG, 1, [ ])
if test "$PHP_PHPDBG_DEBUG" != "no"; then
diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c
index c9b22a2039..98748b202a 100644
--- a/sapi/phpdbg/phpdbg_utils.c
+++ b/sapi/phpdbg/phpdbg_utils.c
@@ -32,6 +32,9 @@
# include "win32/time.h"
#elif defined(HAVE_SYS_IOCTL_H)
# include "sys/ioctl.h"
+# ifndef GWINSZ_IN_SYS_IOCTL
+# include <termios.h>
+# endif
#endif
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
@@ -437,12 +440,12 @@ PHPDBG_API int phpdbg_get_terminal_width(TSRMLS_D) /* {{{ */
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
columns = csbi.srWindow.Right - csbi.srWindow.Left + 1;
-#elif defined(HAVE_SYS_IOCTL_H)
+#elif defined(HAVE_SYS_IOCTL_H) && defined (TIOCGWINSZ)
struct winsize w;
- columns = ioctl(fileno(stdout), TIOCGWINSZ, &w) == 0 ? w.ws_col : 100;
+ columns = ioctl(fileno(stdout), TIOCGWINSZ, &w) == 0 ? w.ws_col : 80;
#else
- columns = 100;
+ columns = 80;
#endif
return columns;
} /* }}} */
diff --git a/sapi/phpdbg/phpdbg_utils.h b/sapi/phpdbg/phpdbg_utils.h
index 68ae7e44a3..56bacfc459 100644
--- a/sapi/phpdbg/phpdbg_utils.h
+++ b/sapi/phpdbg/phpdbg_utils.h
@@ -124,4 +124,24 @@ PHPDBG_API int phpdbg_get_terminal_width(TSRMLS_D); /* }}} */
int phpdbg_rebuild_symtable(TSRMLS_D);
+#if PHP_VERSION_ID < 50500
+/* copy from zend_hash.c PHP 5.5 for 5.4 compatibility */
+static void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos) {
+ Bucket *p;
+
+ p = pos ? (*pos) : ht->pInternalPointer;
+
+ if (!p) {
+ Z_TYPE_P(key) = IS_NULL;
+ } else if (p->nKeyLength) {
+ Z_TYPE_P(key) = IS_STRING;
+ Z_STRVAL_P(key) = IS_INTERNED(p->arKey) ? (char*)p->arKey : estrndup(p->arKey, p->nKeyLength - 1);
+ Z_STRLEN_P(key) = p->nKeyLength - 1;
+ } else {
+ Z_TYPE_P(key) = IS_LONG;
+ Z_LVAL_P(key) = p->h;
+ }
+}
+#endif
+
#endif /* PHPDBG_UTILS_H */
diff --git a/sapi/phpdbg/tests/run-tests.php b/sapi/phpdbg/tests/run-tests.php
index 47a998ccae..1cc31d815e 100644
--- a/sapi/phpdbg/tests/run-tests.php
+++ b/sapi/phpdbg/tests/run-tests.php
@@ -135,8 +135,8 @@ namespace phpdbg\testing {
* @param array basic configuration
* @param array command line
*/
- public function __construct(TestsConfiguration &$config) {
- $this->config = &$config;
+ public function __construct(TestsConfiguration $config) {
+ $this->config = $config;
if ($this->config->hasFlag('help') ||
$this->config->hasFlag('h')) {
@@ -153,7 +153,7 @@ namespace phpdbg\testing {
$paths = array();
$where = ($in != null) ? array($in) : $this->config['path'];
- foreach ($where as &$path) {
+ foreach ($where as $path) {
if ($path) {
if (is_dir($path)) {
$paths[] = $path;
@@ -243,6 +243,7 @@ namespace phpdbg\testing {
printf("\t--options\toptions to pass to phpdbg%s", PHP_EOL);
printf("\t--phpdbg\tpath to phpdbg binary%s", PHP_EOL);
printf('[flags]:%s', PHP_EOL);
+ printf("\t-diff2stdout\t\twrite diff to stdout instead of files%s", PHP_EOL);
printf("\t-nodiff\t\tdo not write diffs on failure%s", PHP_EOL);
printf("\t-nolog\t\tdo not write logs on failure%s", PHP_EOL);
printf('[examples]:%s', PHP_EOL);
@@ -266,9 +267,11 @@ namespace phpdbg\testing {
$test = sprintf('%s/%s', $path, $file);
if (preg_match('~\.test$~', $test)) {
- yield new Test($this->config, $test);
+ $tests[] = new Test($this->config, $test);
}
}
+
+ return $tests;
}
/**
@@ -354,7 +357,7 @@ namespace phpdbg\testing {
* @param array configuration
* @param string file
*/
- public function __construct(TestsConfiguration &$config, &$file) {
+ public function __construct(TestsConfiguration $config, $file) {
if (($handle = fopen($file, 'r'))) {
while (($line = fgets($handle))) {
$trim = trim($line);
@@ -417,8 +420,8 @@ namespace phpdbg\testing {
}
fclose($handle);
- $this->config = &$config;
- $this->file = &$file;
+ $this->config = $config;
+ $this->file = $file;
}
}
@@ -427,8 +430,7 @@ namespace phpdbg\testing {
*
*/
public function getResult() {
- $options = sprintf(
- '-i%s -nqb', $this->file);
+ $options = sprintf('-i%s -nqb', $this->file);
if ($this->options) {
$options = sprintf(
@@ -526,7 +528,7 @@ namespace phpdbg\testing {
* Write log to disk if configuration allows it
*
*/
- protected function writeLog(&$result = null) {
+ protected function writeLog($result = null) {
$log = sprintf(
'%s/%s.log',
dirname($this->file), basename($this->file));
diff --git a/sapi/phpdbg/travis/ci.sh b/sapi/phpdbg/travis/ci.sh
index d9f3ac6a02..206b158b9b 100755
--- a/sapi/phpdbg/travis/ci.sh
+++ b/sapi/phpdbg/travis/ci.sh
@@ -1,10 +1,11 @@
#!/usr/bin/env sh
git clone https://github.com/php/php-src
-cd php-src/sapi
+cd php-src
+git checkout $PHP
+cd sapi
rm -rf phpdbg
git clone https://github.com/krakjoe/phpdbg.git
cd ../
./buildconf --force
./configure --disable-all --enable-phpdbg --enable-maintainer-zts
make
-make test-phpdbg