Hello @johnny,
your right, the string consist “\n”, but from the database point of view the content is 255 symbols long (0x00-0xFF), see screenshot here:
[Bildschirmfoto]
And Codeigniter’s Active Record agreed with it too and show no warning or error.
With
$crud->setRule('redaktion', 'lengthMa…
Hello @johnny,
System data:
PHP8.1, GC 3.0.9, CI 4.3.7
Table field varchar(255), table charset utf8mb3
GC DB Adapter configured with
'driver' => 'mysqli', // (with Pdo_Mysql exactly the same behaviour)
...
'charset' => 'utf8',
Field contain the text (copied 1:1…
Sorry, but it was off topic (I misread it).
If it was helpful for anybody, I restore it here now
How it works in my project:
install CI4 via composer
install GCE 3 via composer (see manual)
configure app/Config/GroceryCrudEnterprise.php
configure db connection in CI4
Then put
in app/Libraries…
Hi,
normally to solve such problems is enough don’t forget to copy
/vendor/grocery-crud/enterprise/public/vendor/grocery-crud
folder to
/public/vendor/grocery-crud
in CodeIgniter progect tree.
You don’t need anything of GC-files in app/Libraries if you use composer with CI 4.3.6.
Have you ins…
Thank you @johnny, it works now as expected!
The Problem is in the different behavior of the json_encode()-function in PHP7.4 and PHP8.1.
If I change in EditFormState::render() (line 108) the
$render->output = json_encode($output);
to
$render->output = json_encode($output, JSON_NUMERIC_CHECK);
then the output seems equal in any PHP versio…
Hello @johnny,
I think I have found the cause of error.
It’s a JSON Response to front-end from $crud->render()
with PHP 7.4:
...,"suppliers":["74"],"groups":["5"],...
string indexes, names found and shown
with PHP 8.1:
...,"suppliers":[74],"groups":[5],...
integer indexes, names are not foun…
Two Videos, the Bug can be reproduced any time:
PHP7.4 - all OK as expected, started with
./spark serve
CodeIgniter v4.3.4 Command Line Tool - Server Time: 2023-06-29 14:15:59 UTC+02:00
CodeIgniter development server started on http://localhost:8080
[Thu Jun 29 14:15:59 2023] PHP 7.4.33 Developme…
Hello @johnny ,
It works pretty with PHP 7.4, but don’t works with PHP 8.1:
the two fields
$crud->setRelationNtoN(
'suppliers',
'product_suppliers',
'suppliers',
'product_id',
'supplier_id',
'{n_1} {lf_nr}-{connection_id}'
…
Thank you @johnny,
it works now, no errors even if fieldType() not defined.
Hello @johnny,
heh… my DB-client (DBeaver) show me a wrong value in the field (NULL). Really it is a ‘0000-00-00’ !
Have seen it direct accessed with terminal mysql client.
Now I understand what “RangeError: Invalid time value” mean…
Hello @johnny,
thank you for workaround tip. I will exclusive define the type of the DB problem fields in the future…
Best regards
Hello @johnny,
if i comment this fields in $crud->editFields() out, the form work as expected.
The DB is MySQL, field type is “date”.
And I think you’re right, it’s data related: if the fields are NULL, it causes the error.
Best regards
Hello @johnny,
this error message no longer appears, but… bigger problem is there:
no edit form will be shown. This Form has two date fields with value “30.5.2023, 15:32:50” (as presented in View Form / German notation).
The console error message:
RangeError: Invalid time value
L index.js:37…
With settings:
‘default_language’ => ‘German’,
‘assets_folder’ => ‘/vendor/grocery-crud/’,
‘environment’ => ‘development’,
‘theme’ => ‘bootstrap-v5’,
Following error in JS-console:
Uncaught (in promise) Error: Cannot find module './de-DE/index.js'
r groupOptions: {} namespace object:366
…
Hello,
I try to use callbackReadField for view form, but
if underlying DB-field (“data”) is null
nothing happens: it is no data in “data”-field displayed and it’s no log-entry for it too:
$crud->setRead();
$crud->callbackReadField('data', function ($value, $row) {
log_message('debug'…