Skip to content

Commit d8331a6

Browse files
null doesn't actually work until PHP 5.4.12
See php/php-src#133
1 parent d72d9c4 commit d8331a6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/cli/table/Ascii.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,17 @@ public function row( array $row ) {
129129
$value = str_replace( PHP_EOL, ' ', $value );
130130

131131
$col_width = $this->_widths[ $col ];
132-
$val_width = Colors::length( $value );
133-
if ( Colors::length( $value ) > $col_width ) {
132+
$original_val_width = Colors::length( $value );
133+
if ( $original_val_width > $col_width ) {
134134
$row[ $col ] = mb_substr( $value, 0, $col_width, mb_detect_encoding( $value ) );
135-
$value = mb_substr( $value, $col_width, null, mb_detect_encoding( $value ) );
135+
$value = mb_substr( $value, $col_width, $original_val_width, mb_detect_encoding( $value ) );
136136
$i = 0;
137137
do {
138138
$extra_value = mb_substr( $value, 0, $col_width, mb_detect_encoding( $value ) );
139-
if ( mb_strlen( $extra_value, mb_detect_encoding( $extra_value ) ) ) {
139+
$val_width = mb_strlen( $extra_value, mb_detect_encoding( $extra_value ) );
140+
if ( $val_width ) {
140141
$extra_rows[ $col ][] = $extra_value;
141-
$value = mb_substr( $value, $col_width, null, mb_detect_encoding( $value ) );
142+
$value = mb_substr( $value, $col_width, $original_val_width, mb_detect_encoding( $value ) );
142143
$i++;
143144
if ( $i > $extra_row_count ) {
144145
$extra_row_count = $i;

0 commit comments

Comments
 (0)