Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.0.0-dev] Strict mode php errors #14304

Closed
williamdes opened this Issue May 17, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@williamdes
Copy link
Member

williamdes commented May 17, 2018

Steps to reproduce

  1. Install PMA dev at c8bfcb7
  2. Go to "Create Database"

Expected behaviour

Show create database

Actual behaviour

Error 500

More

Introduced by @mauriciofauth in 5f46a4b

http://php.net/manual/en/function.array-search.php

Returns the key for needle if it is found in the array, FALSE otherwise.

$key = array_search(
$current["SCHEMA_NAME"],
$replication_info[$type]['Ignore_DB']
);
if (strlen($key) > 0) {
$out = Util::getIcon(
's_cancel',
__('Not replicated')
);
} else {

Logs

2018/05/17 23:32:33 [error] 2654#2654: *481 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught TypeError: strlen() expects parameter 1 to be string, boolean given in /mnt/Dev/phpmyadmintest/libraries/classes/Controllers/Server/ServerDatabasesController.php:422
Stack trace:
#0 /mnt/Dev/phpmyadmintest/libraries/classes/Controllers/Server/ServerDatabasesController.php(422): strlen(false)
#1 /mnt/Dev/phpmyadmintest/libraries/classes/Controllers/Server/ServerDatabasesController.php(389): PhpMyAdmin\Controllers\Server\ServerDatabasesController->_buildHtmlForDb(Array, Array, Array, Array, ' db-row')
#2 /mnt/Dev/phpmyadmintest/libraries/classes/Controllers/Server/ServerDatabasesController.php(300): PhpMyAdmin\Controllers\Server\ServerDatabasesController->_getHtmlForTableBody(Array, Array)
#3 /mnt/Dev/phpmyadmintest/libraries/classes/Controllers/Server/ServerDatabasesController.php(107): PhpMyAdmin\Controllers\Server\ServerDatabasesController->_getHtmlForDatabases(Array)
#4 /mnt/Dev/phpmyadmintest/server_databases.php(30): PhpMyAdmin\Controllers\Server\ServerDatabases" while reading response header from upstream, client: 127.0.0.1, server: localhost.localdomain, request: "GET /phpmyadmintest/server_databases.php?server=1&ajax_request=true&ajax_page_request=true&_nocache=1526592753773588097&token=E-%3E%3D%22MIGO-Pa1Q7O HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "localhost.localdomain"

@mauriciofauth mauriciofauth self-assigned this May 19, 2018

@mauriciofauth mauriciofauth added the bug label May 19, 2018

@mauriciofauth mauriciofauth added this to the 5.0.0 milestone May 19, 2018

@williamdes

This comment has been minimized.

Copy link
Member Author

williamdes commented May 19, 2018

@mauriciofauth Another occurrence in libraries/classes/Linter.php#160 with mb_strlen

$lines, $error[3] + mb_strlen($error[2])

Reproduce

Go to SQL and start typing CREATE DATABASE

Logs

Stack trace:
#0 /mnt/Dev/phpmyadmintest/libraries/classes/Linter.php(160): mb_strlen(NULL)
#1 /mnt/Dev/phpmyadmintest/lint.php(53): PhpMyAdmin\Linter::lint('CREATE DATABASE')
#2 {main}
  thrown in /mnt/Dev/phpmyadmintest/libraries/classes/Linter.php on line 160
NOTICE: PHP message: PHP Fatal error:  Uncaught TypeError: mb_strlen() expects parameter 1 to be string, null given in /mnt/Dev/phpmyadmintest/libraries/classes/Linter.php:160

@williamdes williamdes changed the title [5.0.0-dev] Create database / strlen(false) [5.0.0-dev] Strict mode php errors May 19, 2018

@williamdes

This comment has been minimized.

Copy link
Member Author

williamdes commented May 19, 2018

Reproduce

Try to export a database

Logs

NOTICE: PHP message: PHP Fatal error:  Uncaught TypeError: Argument 4 passed to PhpMyAdmin\Export::getFilenameAndMimetype() must be of the type string, boolean given, called in /mnt/Dev/phpmyadmintest/export.php on line 355 and defined in /mnt/Dev/phpmyadmintest/libraries/classes/Export.php:274
Stack trace:
#0 /mnt/Dev/phpmyadmintest/export.php(355): PhpMyAdmin\Export->getFilenameAndMimetype('database', 'on', Object(PhpMyAdmin\Plugins\Export\ExportSql), false, '@DATABASE@')
#1 {main}
  thrown in /mnt/Dev/phpmyadmintest/libraries/classes/Export.php on line 274

Code

$compression = false;

phpmyadmin/export.php

Lines 353 to 356 in 594cb7b

list($filename, $mime_type) = $export->getFilenameAndMimetype(
$export_type, $remember_template, $export_plugin, $compression,
$filename_template
);

/**
* Return the filename and MIME type for export file
*
* @param string $export_type type of export
* @param string $remember_template whether to remember template
* @param ExportPlugin $export_plugin the export plugin
* @param string $compression compression asked
* @param string $filename_template the filename template
*
* @return string[] the filename template and mime type
*/
public function getFilenameAndMimetype(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.