com php-src: Merge sapi/phpdbg into PHP-5.6: .travis.yml config.m4 phpdbg_utils.c phpdbg_utils.h tests/run-tests.php travis/ci.sh
| From: | Bob Weinand | Date: | Sun, 15 Jun 2014 13:47:14 +0000 |
| Subject: | com php-src: Merge sapi/phpdbg into PHP-5.6: .travis.yml config.m4 phpdbg_utils.c phpdbg_utils.h tests/run-tests.php travis/ci.sh | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82798@lists.php.net to get a copy of this message | ||
Commit: 79230e5561588be7e63f3ee93c06e7065e5038a9
Author: Bob Weinand <bobwei9@hotmail.com> Sun, 15 Jun 2014 15:47:14 +0200
Parents: 5e6c5e9569abaec5fdea6e9254fe38e340921c50
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=79230e5561588be7e63f3ee93c06e7065e5038a9
Log:
Merge sapi/phpdbg into PHP-5.6
Changed paths:
M .travis.yml
M config.m4
M phpdbg_utils.c
M phpdbg_utils.h
M tests/run-tests.php
M travis/ci.sh
Diff:
diff --git a/.travis.yml b/.travis.yml
index 3534028..d5b492e 100644
--- a/.travis.yml
+++ b/.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/config.m4 b/config.m4
index ecac171..1a6640e 100644
--- a/config.m4
+++ b/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/phpdbg_utils.c b/phpdbg_utils.c
index c9b22a2..98748b2 100644
--- a/phpdbg_utils.c
+++ b/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/phpdbg_utils.h b/phpdbg_utils.h
index 68ae7e4..56bacfc 100644
--- a/phpdbg_utils.h
+++ b/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/tests/run-tests.php b/tests/run-tests.php
index 47a998c..1cc31d8 100644
--- a/tests/run-tests.php
+++ b/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/travis/ci.sh b/travis/ci.sh
index d9f3ac6..206b158 100755
--- a/travis/ci.sh
+++ b/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