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

export PDF file - PHP notice Trying to access array offset on value of type null #16467

Closed
Michel-Cavaud opened this issue Nov 8, 2020 · 6 comments
Assignees
Labels
Bug A problem or regression with an existing feature
Milestone

Comments

@Michel-Cavaud
Copy link

Michel-Cavaud commented Nov 8, 2020

Describe the bug

Notice in ./libraries/classes/Plugins/Schema/Pdf/Pdf.php#272
 Trying to access array offset on value of type null

Backtrace

tcpdf.php#3560: PhpMyAdmin\Plugins\Schema\Pdf\Pdf->Header()
tcpdf.php#3227: TCPDF->setHeader()
tcpdf.php#3139: TCPDF->startPage(
string 'L',
string '',
boolean false,
)
PdfRelationSchema.php#493: TCPDF->AddPage(string 'L')
PdfRelationSchema.php#134: PhpMyAdmin\Plugins\Schema\Pdf\PdfRelationSchema->dataDictionaryDoc(array)
SchemaPdf.php#129: PhpMyAdmin\Plugins\Schema\Pdf\PdfRelationSchema->__construct(string 'Dragons2')
Export.php#1223: PhpMyAdmin\Plugins\Schema\SchemaPdf->exportSchema(string 'Dragons2')
schema_export.php#38: PhpMyAdmin\Export->processExportSchema(string 'pdf')

To Reproduce

Steps to reproduce the behavior:

Concepteur - > Export -> PDF

Expected behavior

Error message and no PDF file

Screenshots

Server configuration

  • Operating system: Debian 10
  • Web server: Apache/2.4.38 (Debian)
  • Database version:libmysql - mysqlnd 7.4.11
  • PHP version: 7.4.11
  • phpMyAdmin version: Version : 5.0.4 (à jour)

Client configuration

  • Browser: Chrome
  • Operating system: Windows

Additional context

@williamdes

This comment has been minimized.

@williamdes williamdes added the question Used when we need feedback from the submitter or when the issue is a question about PMA label Nov 8, 2020
@williamdes williamdes added this to Needs triage in Questions via automation Nov 8, 2020
@williamdes williamdes moved this from Needs triage to Needs a second check to be a bug in Questions Nov 8, 2020
@ibennetch
Copy link
Member

ibennetch commented Dec 5, 2020

I am able to reproduce this even using the current master.

After a very quick look, it might be related to page_nr being (empty|unset) around line 309 of libraries/classes/Plugins/Schema/Pdf/Pdf.php.

With a database that has no saved Designer pages, I get the PDF error when trying to create the export and the SQL query generated for $test_query is

SELECT * FROM `phpmyadmin`.`pma__pdf_pages` WHERE db_name = 'despdf' AND page_nr = ''

@ibennetch
Copy link
Member

4.9.5 works correctly, 5.0.0 is broken. Git bisect wasn't very helpful because I had to skip a lot of steps due to unrelated errors (mostly Uncaught TypeError). This is what it left me with, but I don't have a lot of confidence in these findings.

# possible first bad commit: [8a39cfca8b7ea2e346d8bcdbc9fdad268d364590] Fix #14303, Uncaught TypeError: Return value of PhpMyAdmin\Bookmark::getId()
# possible first bad commit: [594cb7b1f286e433899007dc0cbdd53c40d734b7] #13893 issue fix Simulating queries produce unexpected results
# possible first bad commit: [fef5966c3d6137cf3c0b2821a817b032b1da865a] Merge branch 'QA_4_8'
# possible first bad commit: [215cd79202d39c05418267aac850c01b0f148741] Merge branch 'master' into weblate-merge-tmp
# possible first bad commit: [7762bd0bd47788816e7388de85bb2595b199a024] Translated using Weblate (Hebrew)
# possible first bad commit: [3c12c9efb4076a329b932a3168b282624d537755] Merge pull request #14119 from meteorlxy/patch-tmp
# possible first bad commit: [c1a54f77b13689361280166e091bad37d378b004] Merge pull request #14296 from mauriciofauth/strict-types
# possible first bad commit: [dc8c92bfd8433a92bdec5389fa54552ae6039e75] Enable strict mode in test files
# possible first bad commit: [af148ad92bba790ae9180f2b730d89a06c986c8d] Enable strict mode in PHP files
# possible first bad commit: [d243f7ccd67241b2008364a9d2756a7e7335adcf] Enable strict mode in libraries files
# possible first bad commit: [ec529338414ca8501eee7cdc8fb745f8769a5753] Enable strict mode in Utils/HttpRequest class
# possible first bad commit: [0a53065f93e5521509df4a666d8fd19ac8c94410] Enable strict mode in Twig classes
# possible first bad commit: [c426891bf5d128536dc364a197fd71d0052e91e4] Enable strict mode in Server classes
# possible first bad commit: [56ce176752b22938059ca31e399227c3df518134] Enable strict mode in Rte classes
# possible first bad commit: [cf44cc9630398c98551f31c543e38bc2ed12e66e] Enable strict mode in Properties classes
# possible first bad commit: [0998a50e9e70b33c914fa323ce8e1cc3cc5bf06b] Enable strict mode in Plugins classes
# possible first bad commit: [9dbae0a9ed3bc311b691d93099bb7e0b1942219b] Enable strict mode in Navigation classes
# possible first bad commit: [107e0b14e0a0a2c3d84d729727c67721eea66d08] Enable strict mode in Gis classes
# possible first bad commit: [2be3ac83df95ce9a67ee9cd62cf64fd69a136cb1] Enable strict mode in Engines classes
# possible first bad commit: [267aadd4c3a3549743b1d1ad7b8e6ab27a8ba9c0] Enable strict mode in Display classes
# possible first bad commit: [f3fcbdf12f8e4f48ed27c4647792b621e0675359] Enable strict mode in Di classes
# possible first bad commit: [d8c16bce6bf5581bce61f64258eeb1045fa18701] Add ChangeLog entry for #14296
# possible first bad commit: [db708a4da621df43ebe34164b497e40c73ec19bf] Merge branch 'QA_4_8'
# possible first bad commit: [76b423d525be29645b3863441542a1ebe5dc1f82] Merge pull request #14286 from laps15/bugfix
# possible first bad commit: [c8bfcb7fb8f004b2d17ce0bea7065ec0d1dec65f] Merge pull request #14290 from mauriciofauth/strict-types
# possible first bad commit: [aa8ab162a4481b9c8bbaefa313ed06614d7496b0] Enable strict mode in Dbi classes
# possible first bad commit: [764f7a7ddecdeb36d1e07053c2ea830ff42f9b5e] Enable strict mode in Database classes
# possible first bad commit: [5f46a4ba52e7a264f04dee40159689ab0c8779bc] Enable strict mode in Controllers classes
# possible first bad commit: [b6435e9ed2ef4d3396cfd1e96e9e4653714c6a4e] Enable strict mode in Config classes
# possible first bad commit: [6cf8ee083175a0a077b47103a3e32fdd76c669b6] Enable strict mode in some classes

@williamdes williamdes added Bug A problem or regression with an existing feature and removed question Used when we need feedback from the submitter or when the issue is a question about PMA labels Dec 5, 2020
@williamdes williamdes added this to Needs triage in issues via automation Dec 5, 2020
@williamdes williamdes removed this from Needs a second check to be a bug in Questions Dec 5, 2020
@williamdes williamdes added this to the 5.1.0 milestone Dec 6, 2020
williamdes added a commit that referenced this issue Dec 7, 2020
Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes
Copy link
Member

I could not reproduce this issue but I made a fix for it: 8fddd36
I could have the same trace by adding a table from another DB and exporting to PDF.
The actual bug is fixed in #15586 because the current code for the designer does not allow to export to pdf when having things from another DB in the schema, long story..

@ibennetch
Copy link
Member

I just tested master and 8fddd36 fixes every scenario I could test. Thanks for the quick fix!

@williamdes
Copy link
Member

I just tested master and 8fddd36 fixes every scenario I could test. Thanks for the quick fix!

Thank you for testing, I will close this one shortly

@williamdes williamdes self-assigned this Dec 7, 2020
@williamdes williamdes changed the title export PDF file export PDF file - PHP notice Trying to access array offset on value of type null Dec 7, 2020
@williamdes williamdes added this to Done in Designer Dec 7, 2020
@williamdes williamdes moved this from Needs triage to Closed in issues Dec 7, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 8, 2021
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
Projects
issues
  
Closed
Development

No branches or pull requests

3 participants