Skip to content

CI4: Attributes Controller suggestAttribute function returns server 500 error #3862

Closed

Description

@objecttothis

In views/items/form while typing an attribute text value the search suggestions function returns an error.
Request Headers
GET /opensourcepos/public/attributes/suggestAttribute/14?term=jhkjhkjh HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0
Accept: application/json, text/javascript, /; q=0.01
Accept-Language: en-US,az;q=0.7,ru;q=0.3
Accept-Encoding: gzip, deflate, br
Referer: http://localhost/opensourcepos/public/items
X-Requested-With: XMLHttpRequest
DNT: 1
Connection: keep-alive
Cookie: ospos_session=REDACTED
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin

Response Headers
HTTP/1.1 500 Internal Server Error
Date: Thu, 09 Nov 2023 12:34:52 GMT
Server: Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.1.10
X-Frame-Options: SAMEORIGIN
X-Powered-By: PHP/8.1.10
Cache-Control: no-store, max-age=0, no-cache
Content-Security-Policy: default-src 'self' www.google.com; connect-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' www.google.com www.gstatic.com; style-src 'self' 'unsafe-inline' fonts.googleapis.com; font-src 'self' fonts.googleapis.com fonts.gstatic.com; img-src 'self' data:; object-src 'none'; form-action 'self'
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Frame-Options: DENY
Connection: close
Transfer-Encoding: chunked
Content-Type: application/json; charset=UTF-8

Activity

  1. added this to the 3.4.0 milestone on Nov 9, 2023
  2. odiea commented on Nov 9, 2023

    @odiea
    Collaborator

    On the current version I am on this is what shows up. There are no attributes to select. And I have created 2 attributes.
    2023-11-09 05_43_31-Open Source Point of Sale _ Powered by OSPOS 3 4 0-dev

  3. objecttothis commented on Nov 9, 2023

    @objecttothis
    MemberAuthor

    I think you might be downloading ci4-upgrade. That branch is defunct. We are working from ci4-branch which has that issue fixed.

  4. odiea commented on Nov 9, 2023

    @odiea
    Collaborator

    Here is a screen shot from the latest and greatest.
    2023-11-09 13_14_46-Open Source Point of Sale _ Powered by OSPOS 3 4 0-dev

  5. odiea commented on Nov 9, 2023

    @odiea
    Collaborator

    and the error associated with it.

    CRITICAL - 2023-11-09 20:13:19 --> Unable to connect to the database.
    Main connection [MySQLi]: Trying to access array offset on value of type bool
    in SYSTEMPATH\Database\BaseConnection.php on line 428.
     1 SYSTEMPATH\Session\Handlers\DatabaseHandler.php(98): CodeIgniter\Database\BaseConnection->initialize()
     2 [internal function]: CodeIgniter\Session\Handlers\DatabaseHandler->open('sessions', 'ospos_session')
     3 SYSTEMPATH\Session\Session.php(919): session_start()
     4 SYSTEMPATH\Session\Session.php(241): CodeIgniter\Session\Session->startSession()
     5 SYSTEMPATH\Config\Services.php(693): CodeIgniter\Session\Session->start()
     6 SYSTEMPATH\Config\BaseService.php(258): CodeIgniter\Config\Services::session(Object(Config\Session), false)
     7 SYSTEMPATH\Config\BaseService.php(199): CodeIgniter\Config\BaseService::__callStatic('session', [...])
     8 SYSTEMPATH\Config\Services.php(664): CodeIgniter\Config\BaseService::getSharedInstance('session', null)
     9 SYSTEMPATH\Config\BaseService.php(258): CodeIgniter\Config\Services::session()
    10 SYSTEMPATH\Common.php(996): CodeIgniter\Config\BaseService::__callStatic('session', [])
    11 APPPATH\Models\Employee.php(33): session()
    12 SYSTEMPATH\Config\Factories.php(221): App\Models\Employee->__construct(null)
    13 SYSTEMPATH\Config\Factories.php(171): CodeIgniter\Config\Factories::createInstance('models', 'App\\Models\\Employee', [...])
    14 SYSTEMPATH\Common.php(827): CodeIgniter\Config\Factories::__callStatic('models', [...])
    15 APPPATH\Controllers\Secure_Controller.php(32): model('App\\Models\\Employee')
    16 APPPATH\Controllers\Items.php(44): App\Controllers\Secure_Controller->__construct('items')
    17 SYSTEMPATH\CodeIgniter.php(914): App\Controllers\Items->__construct()
    18 SYSTEMPATH\CodeIgniter.php(493): CodeIgniter\CodeIgniter->createController()
    19 SYSTEMPATH\CodeIgniter.php(361): CodeIgniter\CodeIgniter->handleRequest(null, Object(Config\Cache), false)
    20 FCPATH\index.php(79): CodeIgniter\CodeIgniter->run()
    
  6. jekkos commented on Nov 9, 2023

    @jekkos
    Member

    Could it be related to the fact that the query returns false if no results are found? I thought we noticed this behavior before.
    https://stackoverflow.com/questions/59674903/trying-to-access-array-offset-on-value-of-type-bool-in-php-7-4

  7. odiea commented on Nov 11, 2023

    @odiea
    Collaborator

    Here is the result of clicking on the input form to select a Date.
    2023-11-11 14_40_10-Odies Test _ Powered by OSPOS 3 4 0-dev

  8. jekkos commented on Nov 11, 2023

    @jekkos
    Member

    Maybe we should log issues like this a bit better as a lot of bug reports are spread around in unreleated issues now, which makes it hard to get an overview on what still needs to be fixed. In other words could you post this screen cap in a new issue and assign some labels so we do not lose track? Thanks!

  9. added
    CodeIgniter4
    on Dec 12, 2023
  10. jekkos commented on Apr 30, 2024

    @jekkos
    Member

    Seems resolved in latest dev version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CodeIgniter4bugitem attributes

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions