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

Uncaught TypeError: Argument 1 passed to PhpMyAdmin\Export::outputHandler() must be of the type string or null, boolean given, ExportJson.php on line 273 #14922

Closed
williamdes opened this issue Jan 31, 2019 · 2 comments
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete help wanted
Milestone

Comments

@williamdes
Copy link
Member

williamdes commented Jan 31, 2019

<br />
<font size='1'><table class='xdebug-error xe-uncaught-exception' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Fatal error: Uncaught TypeError: Argument 1 passed to PhpMyAdmin\Export::outputHandler() must be of the type string or null, boolean given, called in /mnt/Dev/phpmyadmintest/libraries/classes/Plugins/Export/ExportJson.php on line 273 and defined in /mnt/Dev/phpmyadmintest/libraries/classes/Export.php on line <i>78</i></th></tr>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> TypeError: Argument 1 passed to PhpMyAdmin\Export::outputHandler() must be of the type string or null, boolean given, called in /mnt/Dev/phpmyadmintest/libraries/classes/Plugins/Export/ExportJson.php on line 273 in /mnt/Dev/phpmyadmintest/libraries/classes/Export.php on line <i>78</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0000</td><td bgcolor='#eeeeec' align='right'>447808</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='/mnt/Dev/phpmyadmintest/export.php' bgcolor='#eeeeec'>.../export.php<b>:</b>0</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.1279</td><td bgcolor='#eeeeec' align='right'>1994048</td><td bgcolor='#eeeeec'>PhpMyAdmin\Export->exportTable(  )</td><td title='/mnt/Dev/phpmyadmintest/export.php' bgcolor='#eeeeec'>.../export.php<b>:</b>575</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>0.1291</td><td bgcolor='#eeeeec' align='right'>1999824</td><td bgcolor='#eeeeec'>PhpMyAdmin\Plugins\Export\ExportJson->exportData(  )</td><td title='/mnt/Dev/phpmyadmintest/libraries/classes/Export.php' bgcolor='#eeeeec'>.../Export.php<b>:</b>990</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>4</td><td bgcolor='#eeeeec' align='center'>0.1295</td><td bgcolor='#eeeeec' align='right'>2021656</td><td bgcolor='#eeeeec'>PhpMyAdmin\Export->outputHandler(  )</td><td title='/mnt/Dev/phpmyadmintest/libraries/classes/Plugins/Export/ExportJson.php' bgcolor='#eeeeec'>.../ExportJson.php<b>:</b>273</td></tr>
</table></font>
</div><div id="selflink" class="print_ignore"><a href="export.php?db=xxx&table=address_mission&server=12&target=&single_table=TRUE" title="Ouvrir une nouvelle fenêtre phpMyAdmin" target="_blank" rel="noopener noreferrer"><img src="themes/dot.gif" title="Ouvrir une nouvelle fenêtre phpMyAdmin" alt="Ouvrir une nouvelle fenêtre phpMyAdmin" class="icon ic_window-new"></a></div><div class="clearfloat" id="pma_errors"></div><script data-cfasync="false" type="text/javascript">// <![CDATA[
var debugSQLInfo = 'null';
AJAX.scriptHandler;
$(function() {});
// ]]></script></body></html>
@williamdes williamdes added Bug A problem or regression with an existing feature help wanted labels Jan 31, 2019
@sijie123
Copy link
Contributor

sijie123 commented Feb 3, 2019

Hello! I'm new around here, so do let me know if I missed anything.

I took a look at the exact line pointed out in the error:

if (! $this->export->outputHandler($this->encode($data))) {
    return false;
}

encode($data) calls json_encode, which will return false on failure.
Indeed, this could cause a crash with a TypeError exception if the encode($data) fails and returns false

I would be very happy to submit a fix for this. Please let me know if that's okay - and I'll work on it. Additionally, since this bug seems exist across all of the versions, should I patch this against master or one of the releases?

Finally, I could help write some unit tests to ensure that this is protected against regression, although it would be good if I could get some information from @williamdes on how to reproduce the error.

@williamdes
Copy link
Member Author

@sijie123 You can submit a PR against QA_4_8 and we will add your patch on master

If you want to write Unit tests, open a PR against master.
Thank you for wanting to help us!

I will send you more information in order to reproduce the issue

@williamdes williamdes added the has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete label Feb 5, 2019
williamdes added a commit that referenced this issue Mar 1, 2019
[ci skip]

Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes williamdes self-assigned this Mar 1, 2019
@williamdes williamdes added this to the 4.8.6 milestone Mar 1, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete help wanted
Projects
None yet
Development

No branches or pull requests

2 participants