Uncaught TypeError: Cannot read properties of undefined (reading '0')

Hello folks~
PHPMaker 2022 v12.2can you please help me, i’ve got error when i upload image, which is from F12 console error :

    ew.js:7630 Uncaught TypeError: Cannot read properties of undefined (reading '0')
    at HTMLInputElement.<anonymous> (ew.js:7630:23)
    at HTMLInputElement.dispatch (jquery-3.6.0.min.js:2:43064)
...

and error from Log File :

log.DEBUG: Slim Application Error Type: ErrorException Code: 0 Message: basename(): 
Passing null to parameter #2 ($suffix) of type string is deprecated File: C:\xampp\htdocs\xxx\src\UploadHandler.php Line: 1473 
Trace: #0 [internal function]: PHPMaker2022\xxx\{closure}(8192, 'basename(): Pas...', 'C:\\xampp\\htdocs...', 1473) 
#1 C:\xampp\htdocs\xxx\src\UploadHandler.php(1473): basename('Xindex.php', NULL) 
#2 C:\xampp\htdocs\xxx\src\UploadHandler.php(47): UploadHandler->basename('/xxx/api/ind...')

I’ve tried :

  • Clear all Server Events, Client Script
  • set default advanced settings
  • set default general settings
  • delete master/detail
  • set default locale
  • set default table settings
  • try to set edit tag and view tag with official tutorial
  • try with blob or varchar type
  • create new table
  • update composer
  • No custom view or custom report or custom files
  • no linked table
  • no used custom edit tag (all default)
  • set off audittrial
    still not make change with the error, but when i try with new file phpmaker and set the same database, the error has gone.
    When i try to open my save file, and try it together, my save file still get same error ~_~ but the new file not.
    what did i’ve done before? can someone help me to fixed my problem

thanks

Which version of PHPMaker are you using? If you try to use PHP 8.1 with PHPMaker <= 2021, it won’t work. Also see https://www.hkvforums.com/viewtopic.php?t=53611.

PHP Version 8.1.6
PHPMaker v2022 12.2

kyuzu wrote:

When i try to open my save file, and try it together, my save file still get same error ~_~ but the new file not.

You may compare between your new fresh project file and your converted project file by opening both .pmp files by using WinMerge application. Assume the database that accesed by both project are the same.

i’ll try it, thanks for your reply
but, now when i disabled debug feature in advanced settings… the error has gone -_-" so weird~

It has nothing to do with debug feature, you were using an older version of UploadHandler.php in your project folder (C:\xampp\htdocs\xxx\src\UploadHandler.php).