diff --git a/ChangeLog b/ChangeLog index a83ce90402..cae32fa389 100644 --- a/ChangeLog +++ b/ChangeLog @@ -63,6 +63,7 @@ phpMyAdmin - ChangeLog - issue #12073 Hide edit and delete buttons when the results are not related to a table - issue #12083 Fixed parsing of field definition - issue #12081 Fixed rendering of table stats +- issue #11705 Fixed problems with PHP on Windows on table structure 4.5.5.1 (2016-02-29) - issue #11971 CREATE UNIQUE INDEX index type is not recognized by parser. diff --git a/libraries/Index.php b/libraries/Index.php index 79e70a74eb..7e206736ab 100644 --- a/libraries/Index.php +++ b/libraries/Index.php @@ -698,7 +698,11 @@ class Index $r .= '' . __('Unique') . ''; $r .= '' . __('Packed') . ''; $r .= '' . __('Column') . ''; - $r .= '' . __('Cardinality') . ''; + /** + * The htmlentities is there to workaround PHP bug on Windows + * see https://github.com/phpmyadmin/phpmyadmin/issues/11705 + */ + $r .= '' . htmlentities(__('Cardinality')) . ''; $r .= '' . __('Collation') . ''; $r .= '' . __('Null') . ''; $r .= '' . __('Comment') . ''; diff --git a/libraries/Response.php b/libraries/Response.php index db17a9db37..a7b6fe68f4 100644 --- a/libraries/Response.php +++ b/libraries/Response.php @@ -364,7 +364,40 @@ class Response // response correctly. PMA_headerJSON(); - echo json_encode($this->_JSON); + $result = json_encode($this->_JSON); + if ($result === false) { + switch (json_last_error()) { + case JSON_ERROR_NONE: + $error = 'No errors'; + break; + case JSON_ERROR_DEPTH: + $error = 'Maximum stack depth exceeded'; + break; + case JSON_ERROR_STATE_MISMATCH: + $error = 'Underflow or the modes mismatch'; + break; + case JSON_ERROR_CTRL_CHAR: + $error = 'Unexpected control character found'; + break; + case JSON_ERROR_SYNTAX: + $error = 'Syntax error, malformed JSON'; + break; + case JSON_ERROR_UTF8: + $error = 'Malformed UTF-8 characters, possibly incorrectly encoded'; + break; + default: + $error = 'Unknown error'; + break; + } + echo json_encode( + array( + 'success' => false, + 'error' => 'JSON encoding failed: ' . $error, + ) + ); + } else { + echo $result; + } } /**