]> granicus.if.org Git - php/commitdiff
Merge sapi/phpdbg into PHP-5.6
authorBob Weinand <bobwei9@hotmail.com>
Sun, 15 Jun 2014 13:47:14 +0000 (15:47 +0200)
committerBob Weinand <bobwei9@hotmail.com>
Sun, 15 Jun 2014 13:47:14 +0000 (15:47 +0200)
.travis.yml
config.m4
phpdbg_utils.c
phpdbg_utils.h
tests/run-tests.php
travis/ci.sh

index 353402858e05fda4855f167380427e9688a13823..d5b492e7cfaa090e9fc78b17755ec07ff970d9cb 100644 (file)
@@ -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
index ecac17150673dd126eeba0d24947331adfb29236..1a6640eaca280d1aa91660f5355b310ef3f5e32d 100644 (file)
--- 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
index c9b22a20397172b152ce74d834e3fb74fceaedac..98748b202a12dcbb8e8f8e086aa5e3aec2a878a2 100644 (file)
@@ -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;
 } /* }}} */
index 68ae7e44a39257b60cec87839b0137a232a98d53..56bacfc45961c5491498f085e011b41bbf882fef 100644 (file)
@@ -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 */
index 47a998ccae84d0b9176a9bc9512cbcedc936638d..1cc31d815e5b33972b45123f9eb3fa775d91780d 100644 (file)
@@ -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));
index d9f3ac6a02b0694bf7ec5f0a5bbfc0f1d186c17d..206b158b9b639f2f885f07c3ebdd0d680434c450 100755 (executable)
@@ -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