# 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);
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;
} /* }}} */
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 */
* @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')) {
$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;
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);
$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;
}
/**
* @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);
}
fclose($handle);
- $this->config = &$config;
- $this->file = &$file;
+ $this->config = $config;
+ $this->file = $file;
}
}
*
*/
public function getResult() {
- $options = sprintf(
- '-i%s -nqb', $this->file);
+ $options = sprintf('-i%s -nqb', $this->file);
if ($this->options) {
$options = sprintf(
* 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));