cakephp upgrade 2.xx to 3.x - cakephp

Deprecated: PHP configuration files like "app.php" should not set $config. Instead return an array. - C:\composer\upgrade\vendor\cakephp\cakephp\src\Core\Configure.php, line: 343
You can disable deprecation warnings by setting Error.errorLevel to E_ALL & ~E_USER_DEPRECATED in your config/app.php. in C:\composer\upgrade\vendor\cakephp\cakephp\src\Core\functions.php on line 311
Exception: If config is null, key must be an array. in [C:\composer\upgrade\vendor\cakephp\cakephp\src\Core\StaticConfigTrait.php, line 79]
I just follow the tools. How to remove the error?

Very simply, as the error message indicates, you need to return an array instead of setting $config. Change
$config = [
to
return [

Related

cakePHP:Tried running this code in cakePHP

C:\xampp\htdocs\my_app\bin>cake bake migration_snapshot Initial
PHP Warning: Module 'intl' already loaded in Unknown on line 0
Exception: Database driver Cake\Database\Driver\Mysql cannot be used due to a missing PHP extension or unmet dependency
In [C:\xampp\htdocs\my_app\vendor\cakephp\cakephp\src\Database\Connection.php, line 202]
2021-02-09 08:52:48 Error: [Cake\Database\Exception\MissingExtensionException] Database driver Cake\Database\Driver\Mysql cannot be used due to a missing PHP extension or unmet dependency in C:\xampp\htdocs\my_app\vendor\cakephp\cakephp\src\Database\Connection.php on line 202
Exception Attributes: array (
'driver' => 'Cake\\Database\\Driver\\Mysql',
)
Stack Trace:
- C:\xampp\htdocs\my_app\vendor\cakephp\cakephp\src\Database\Connection.php:142
- C:\xampp\htdocs\my_app\vendor\cakephp\cakephp\src\Datasource\ConnectionRegistry.php:90
- C:\xampp\htdocs\my_app\vendor\cakephp\cakephp\src\Core\ObjectRegistry.php:110
- C:\xampp\htdocs\my_app\vendor\cakephp\cakephp\src\Datasource\ConnectionManager.php:212
- C:\xampp\htdocs\my_app\vendor\cakephp\migrations\src\Command\BakeMigrationSnapshotCommand.php:122
- C:\xampp\htdocs\my_app\vendor\cakephp\migrations\src\Command\BakeMigrationSnapshotCommand.php:55
- C:\xampp\htdocs\my_app\vendor\cakephp\migrations\src\Command\BakeSimpleMigrationCommand.php:91
- C:\xampp\htdocs\my_app\vendor\cakephp\cakephp\src\Console\BaseCommand.php:179
- C:\xampp\htdocs\my_app\vendor\cakephp\cakephp\src\Console\CommandRunner.php:336
- C:\xampp\htdocs\my_app\vendor\cakephp\cakephp\src\Console\CommandRunner.php:172
- C:\xampp\htdocs\my_app\bin\cake.php:12
Please check if you have two different versions of php on your machine.
cake bake should read the php extensions from xamp's php version i.e C:\xampp\php.

drupal 7 include site wide contact form in a node

I want add the Site Wide user form a node.
I used Drupal 7.
The site wide form Id-s: contact_site_form ( I get it from from.inc )
With alter I altered the form content.
in the node code:
php code:
print drupal_render(drupal_get_form('contact_site_form'));
Error message:
Notice: Undefined index: contact_site_form drupal_retrieve_form() függvényben (D:\wamp\www\online_recruitment\includes\form.inc 766 sor).
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'contact_site_form' was given drupal_retrieve_form() függvényben (D:\wamp\www\online_recruitment\includes\form.inc 802 sor).
I found the answer:
http://drupal.org/node/237559#comment-780448 -> D6 way but worked in D7 as wel
php: require_once drupal_get_path('module', 'contact') .'/contact.pages.inc';
it worked like a charm.

How to use projection with GAE?

I have the following code:
employees = Employee.all()
employees.projection('first_name')
employees.filter('passport_id =', passport_id)
employees.order('-added')
results = employees.fetch(5)
Second line is not allowed:
AttributeError: 'Query' object has no attribute 'projection'
Another approach also returns the error:
employees = db.Query(Employee, projection=('first_name'))
TypeError: __init__() got an unexpected keyword argument 'projection'
But if I read the doc correctly, it should be supported.
Which version of AppEngine SDK are you running? projection queries were added in version 1.6.5

mpdf no output and php errors in mpdf.php

I'm trying to generate a pdp file in a cakephp application. Therefore, I use the mpdf library as a vendor. But when I try to make a even very simple output it doesn't work. Then when I use the debug property, it shows php errors in the mpdf.php file.
Here is my source code:
<?php
$mpdf=new mPDF();
$mpdf->WriteHTML('hello');
$mpdf->debug = true;
$mpdf->Output();
exit;
?>
And these are the errors shown in the browser:
Notice (8): Undefined index: BODY [APP\vendors\MPDF54\mpdf.php, line 14242]
Notice (8): Undefined index: BODY>>ID>> [APP\vendors\MPDF54\mpdf.php, line 14288]
Notice (8): Undefined offset: -1 [APP\vendors\MPDF54\mpdf.php, line 14421]
Thank you for your help!
This is not a CakePHP problem but related to the library you're using.
Read about how to use the WriteHTML() method.
http://mpdf1.com/manual/index.php?tid=121
And try passing 2 as the 2nd argument.
$mpdf->WriteHTML('hello', 2);
If this still does not work read the documentation, check the examples there.
This is caused by buggy mpdf code. It depends on error (level "notice") reporting to be switched off (it switches it off itself). But if you handle errors some nonstandard way, it is problem..
I solved it by ignoring errors from mpdf.php file in my custom error handler.
I was using my custom error reporting via set_error_handler();

CakePHP "Warning: Cache not configured properly"

I am using CakePHP and getting the following error
Warning: Cache not configured properly. Please check Cache::config(); in APP/config/core.php in D:\PHP-SERVER\cheesecake\cake\libs\configure.php on line 663
Notice: Undefined variable: Route in D:\PHP-SERVER\cheesecake\app\config\routes.php on line 38
Fatal error: Call to a member function connect() on a non-object in D:\PHP-SERVER\cheesecake\app\config\routes.php on line 38
Any problem in the settings?
Which CakePHP version are you using?
The fatal error looks like a typo. Open the file D:\PHP-SERVER\cheesecake\app\config\routes.php and check what there is written on line 38. It looks like there is a letter missing.
It should be something along the lines of
Router::connect(...[whatever your route settings are]...);
and I guess in your file it says (note the missing r in Router)
Route::connect(...);
Did you do what the other error message said? Check the Cache::config call in app/config/core.php. You seem to have not properly set your cache configuration.
The default call looks like
Cache::config('default', array('engine' => 'File'));
If you changed that post the code-piece to figure out if something is wrong..

Resources