php-crud-admin
php-crud-admin copied to clipboard
PHP V8.2 - Deprecated Message Creation of dynamic property
Just for information if running for php 8.3:
Server: Xampp PHP 8.2.8 Testing with SQlight Database
I get deprecated message for: http://myUrl/db-testDbLight/admin.php/
Deprecated: Creation of dynamic property Tqdev\PhpCrudAdmin\Column\DefinitionService::$properties is deprecated in ...myPathTo\db-testDbLight\admin.php on line 13088
And by this occasion: thx for your engagement. A really good Job!
Thank you for your kind words. Can you post the lines that the error occurs in? I need to see the lines around db-testDbLight\admin.php line 13088 to see where in the original document this code is called. If you could provide the callstack then that would be even better.
The error occurs in class DefinitionService at the beginning in the constructor. Here is the excerpt. The line is marked by comment:
class DefinitionService {
private $api;
private $database;
public function __construct(CrudApi $api)
{
$this->api = $api;
$this->database = $this->optimizeDatabase($this->api->readDatabase(array()));
$this->properties = array(); // <#################### That's line 13088
}
...
}
The warning appears direct just after calling the file. As I was short in the time yesterday I did some more testing's today:
Concerning the warning from yesterday: System: xampp, PHP 8.2.8 Additional to the deprecated warning I miss the 'Add table' button on the starting page.
Testing today:
System: Plesk live server, PHP 8.2.6 (= former version) and same effects on: System: xampp, PHP 8.1.6 System: xampp, PHP 7.4.30
No deprecate warning
Button is shown but the script behind does not work: Creating a table gives message: Created newTable: Array (Note: 'Array' was not the used table name) Table has not been created
Thrown php error: 'Warning: Array to string conversion in pathTo_testing\php-REST-API\admin.php on line 13939'
The error concerns to the return value of function 'renderVarNode'. Here is the code, line is marked:
private function renderVarNode(/*object*/$node, array $data): string
{
$parts = $this->explode('|', $node->expression);
$path = array_shift($parts);
try {
$value = $this->resolvePath($path, $data);
$value = $this->applyFunctions($value, $parts, $data);
} catch (\Throwable $e) {
return $this->escape('{{' . $node->expression . '!!' . $e->getMessage() . '}}');
}
if ($value instanceof TemplateString) {
return $value;
}
return $this->escape((string) $value); // <########### That's line 13939
}
All tests in Firefox + Chrome (most actual versions) All tests with (not only) activated pdo drivers 'mysql, odbc, pgsql, sqlite' and 'sqlite3'
Indeed I am wondering about that result and suppose a mistake on my part: Could it be that sqlite is not supported from the crud_admin? Indeed your description is just:
A database admin interface for MySQL, PostgreSQL or SQL Server
However ... the deprecated message could be interesting at all.
At the moment there is no time for more testing's and especially the crud_admin is not so much of current interest to me as I use another admin for working with sqlite. So I would suggest, that if there is no other who could confirm that results, you maybe should ignore this report and maybe set this on monitoring.
Once more: the crud_api enviroment is a very good job at all :-)