Pagination error when upgrade from cakephp 1.3 to 2.0 - php

I am upgrading cakephp 1.3 to 2.0
I am getting below error in error log
Error: [MissingTableException] Table aros_acos for model Permission was not found in datasource default.
Exception Attributes: array (
'table' => 'aros_acos',
'class' => 'Permission',
'ds' => 'default',
)
Request URL: /users/show?%2Fusers%2Fshow=
Stack Trace:
#0 /lib/Cake/Model/Model.php(3498): Model->setSource('aros_acos')
#1 /lib/Cake/Model/Datasource/DboSource.php(1063): Model->getDataSource()
#2 /lib/Cake/Model/Model.php(2902): DboSource->read(Object(User), Array)
#3 /lib/Cake/Model/Model.php(2874): Model->_readDataSource('count', Array)
#4 /app/Controller/Component/PaginationComponent.php(212): Model->find('count', 'status!='DL'')
#5 /app/Controller/UsersController.php(108): PaginationComponent->init('status!='DL'')
#6 [internal function]: UsersController->show()
#7 /lib/Cake/Controller/Controller.php(490): ReflectionMethod->invokeArgs(Object(UsersController), Array)
#8 /lib/Cake/Routing/Dispatcher.php(185): Controller->invokeAction(Object(CakeRequest))
#9 /lib/Cake/Routing/Dispatcher.php(160): Dispatcher->_invoke(Object(UsersController), Object(CakeRequest), Object(CakeResponse))
#10 /app/webroot/index.php(108): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
UsersController.php error section
$criteria = "status!='1'";
$this->Pagination->direction = 'ASC';
$this->Pagination->sortBy = 'username';
//********
$this->Pagination->setPageLimit($page_limit);
list($order, $limit, $page) = $this->Pagination->init($criteria); // Added
PaginationComponent.php
$count = $this->controller->{$this->modelClass}->find('count', $criteria);
Please let me know what is going wrong.
Thanks,

Have you even tried to read and understand the error message? Debugging starts by reading (and understanding) error messages if you get some.
[MissingTableException] Table aros_acos for model Permission was not found in datasource default.
That means that the table aros_acos doesn't exist in your database.

Related

Warning: File_Get_Contents in php 8.1 wordpress

I recently changed the php version from 7.4 to 8.1
But after the change, I get an error when posting content in WordPress
You need to know that despite this error, the article will be sent, but this error has bothered me
I activated the WordPress debugger, the error was referring to the active plugin in WordPress
This line:
$pictureFile = file_get_contents($imageFilePath);
WP_DEBUG :
Fatal error: Uncaught ValueError: Path cannot be empty in /home/admin/domains/xxx.org/public_html/wp-content/plugins/mp3publisher7/mp3-post-publisher.php:113
Stack trace:
#0 /home/admin/domains/xxx.org/public_html/wp-content/plugins/mp3publisher7/mp3-post-publisher.php(113): file_get_contents()
#1 /home/admin/domains/xxx.org/public_html/wp-includes/class-wp-hook.php(310): save_mp3_post_publisher()
#2 /home/admin/domains/xxx.org/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#3 /home/admin/domains/xxx.org/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#4 /home/admin/domains/xxx.org/public_html/wp-includes/post.php(4717): do_action()
#5 /home/admin/domains/xxx.org/public_html/wp-includes/revision.php(337): wp_insert_post()
#6 /home/admin/domains/xxx.org/public_html/wp-includes/revision.php(191): _wp_put_post_revision()
#7 /home/admin/domains/xxx.org/public_html/wp-includes/class-wp-hook.php(310): wp_save_post_revision()
#8 /home/admin/domains/xxx.org/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#9 /home/admin/domains/xxx.org/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#10 /home/admin/domains/xxx.org/public_html/wp-includes/post.php(4686): do_action()
#11 /home/admin/domains/xxx.org/public_html/wp-includes/post.php(4819): wp_insert_post()
#12 /home/admin/domains/xxx.org/public_html/wp-admin/includes/post.php(426): wp_update_post()
#13 /home/admin/domains/xxx.org/public_htm/wp-admin/post.php(227): edit_post()
#14 {main} thrown in /home/admin/domains/xxx.org/public_html/wp-content/plugins/mp3publisher7/mp3-post-publisher.php on line 113
More complete code of this plugin :
$mp3FilePath = get_attached_file($_POST["mp3_file_id"]);
$thumb_id = get_post_thumbnail_id($postId);
$imageFilePath = get_attached_file($thumb_id);
$pictureFile = file_get_contents($imageFilePath);
$info = array(
"artist"=>$_POST["mp3_artist"],
"album"=>$_POST["mp3_album"],
"comment"=>$_POST["mp3_comment"],
"title"=>$_POST["mp3_caption"],
"cover_data" => array(
array (
'data'=> $pictureFile,
'picturetypeid'=> 3,
'mime'=> 'image/jpeg',
'description' => 'My Picture'
)
)
When I disable this plugin, there is no problem in posting
After deleting the following line, the problem will be solved, but some parts of the plugin will not work anymore:
// $pictureFile = file_get_contents($imageFilePath);
If anyone can please help. I can't think of anything anymore
tnx..........................
The error is not occurring with file_get_contents(), but your variable $imageFilePath is returning a null value.
Try console log echo("<script>console.log('The value of imageFilePath is : " . $imageFilePath . "');</script>");

Getting an error while connecting to the BigTable using Google's PHP client library

I've created a BigTable instance in my GC account and when I'm trying to connect to it using Google's library (this is a sample code from Google's docs):
require 'vendor/autoload.php';
use Google\Cloud\Bigtable\BigtableClient;
/** Uncomment and populate these variables in your code */
$project_id = 'my_project_id';
$instance_id = 'table_instance';
$table_id = 'table_name';
// Connect to an existing table with an existing instance.
$dataClient = new BigtableClient([
'projectId' => $project_id,
]);
$table = $dataClient->table($instance_id, $table_id);
$key = 'r1';
// Read a row from my-table using a row key
$row = $table->readRow($key);
$column_family_id = 'cf1';
$column_id = 'c1';
// Get the Value from the Row, using the column_family_id and column_id
$value = $row[$column_family_id][$column_id][0]['value'];
printf("Row key: %s\nData: %s\n", $key, $value);
I'm getting an error:
Fatal error: Uncaught BadMethodCallException: Streaming calls are not supported while using the REST transport. in /srv/vendor/google/gax/src/Transport/HttpUnaryTransportTrait.php:119 Stack trace: #0 /srv/vendor/google/gax/src/Transport/HttpUnaryTransportTrait.php(63): Google\ApiCore\Transport\RestTransport->throwUnsupportedException() #1 /srv/vendor/google/gax/src/GapicClientTrait.php(479): Google\ApiCore\Transport\RestTransport->startServerStreamingCall(Object(Google\ApiCore\Call), Array) #2 /srv/vendor/google/gax/src/Middleware/CredentialsWrapperMiddleware.php(61): Google\Cloud\Bigtable\V2\Gapic\BigtableGapicClient->Google\ApiCore\{closure}(Object(Google\ApiCore\Call), Array) #3 /srv/vendor/google/gax/src/Middleware/FixedHeaderMiddleware.php(67): Google\ApiCore\Middleware\CredentialsWrapperMiddleware->__invoke(Object(Google\ApiCore\Call), Array) #4 /srv/vendor/google/gax/src/Middleware/RetryMiddleware.php(85): Google\ApiCore\Middleware\FixedHeaderMiddleware->__invoke(Object(Google\ApiCore\Call), Array) #5 /srv/vendor/google/gax/src/Middleware/OptionsFilterMiddleware.php(64): Google\ApiCore\Middleware\RetryMiddleware->__invoke(Object(Google\ApiCore\Call), Array) #6 /srv/vendor/google/gax/src/GapicClientTrait.php(462): Google\ApiCore\Middleware\OptionsFilterMiddleware->__invoke(Object(Google\ApiCore\Call), Array) #7 /srv/vendor/google/cloud-bigtable/src/V2/Gapic/BigtableGapicClient.php(357): Google\Cloud\Bigtable\V2\Gapic\BigtableGapicClient->startCall('ReadRows', 'Google\\Cloud\\Bi...', Array, Object(Google\Cloud\Bigtable\V2\ReadRowsRequest), 3) #8 [internal function]: Google\Cloud\Bigtable\V2\Gapic\BigtableGapicClient->readRows('projects/project...', Array) #9 /srv/vendor/google/cloud-core/src/ExponentialBackoff.php(80): call_user_func_array(Array, Array) #10 /srv/vendor/google/cloud-bigtable/src/ResumableStream.php(96): Google\Cloud\Core\ExponentialBackoff->execute(Array, Array) #11 /srv/vendor/google/cloud-bigtable/src/ChunkFormatter.php(168): Google\Cloud\Bigtable\ResumableStream->readAll() #12 [internal function]: Google\Cloud\Bigtable\ChunkFormatter->readAll() #13 /srv/vendor/google/cloud-bigtable/src/Table.php(331): Generator->current() #14 /srv/index.php(24): Google\Cloud\Bigtable\Table->readRow('r1') #15 {main} thrown in /srv/vendor/google/gax/src/Transport/HttpUnaryTransportTrait.php on line 119
Any help?
OK, I figured it out.
For those who facing the same problem:
create/add a line into your php.ini file:
extension=grpc.so
php.ini should be in the same directory with app.yaml

Yii2.0 user-management Module Migrations Error

I am trying to install user-management module in Yii2.
I am getting an error while running the migrations command for this module.
Here is the fresh Stack trace from my terminal:
$ sudo php yii migrate --migrationPath=vendor/webvimark/module-user-management/migrations
Yii Migration Tool (based on Yii v2.0.3)
Total 10 new migrations to be applied:
m140608_173539_create_user_table
m140611_133903_init_rbac
m140808_073114_create_auth_item_group_table
m140809_072112_insert_superadmin_to_user
m140809_073114_insert_common_permisison_to_auth_item
m141023_141535_create_user_visit_log
m141116_115804_add_bind_to_ip_and_registration_ip_to_user
m141121_194858_split_browser_and_os_column
m141201_220516_add_email_and_email_confirmed_to_user
m141207_001649_create_basic_user_permissions
Apply the above migrations? (yes|no) [no]:yes
*** applying m140608_173539_create_user_table
Exception: Trying to get property of non-object (/var/www/html/***/vendor/webvimark/module-user-management/migrations/m140608_173539_create_user_table.php:16)
#0 /var/www/html/***/vendor/webvimark/module-user-management/migrations/m140608_173539_create_user_table.php(16): yii\base\ErrorHandler->handleError(8, 'Trying to get p...', '/var/www/html/m...', 16, Array)
#1 /var/www/html/***/vendor/yiisoft/yii2/db/Migration.php(81): m140608_173539_create_user_table->safeUp()
#2 /var/www/html/***/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(492): yii\db\Migration->up()
#3 /var/www/html/***/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(129): yii\console\controllers\BaseMigrateController->migrateUp('m140608_173539_...')
#4 [internal function]: yii\console\controllers\BaseMigrateController->actionUp(0)
#5 /var/www/html/***/vendor/yiisoft/yii2/base/InlineAction.php(55): call_user_func_array(Array, Array)
#6 /var/www/html/***/vendor/yiisoft/yii2/base/Controller.php(151): yii\base\InlineAction->runWithParams(Array)
#7 /var/www/html/***/vendor/yiisoft/yii2/console/Controller.php(91): yii\base\Controller->runAction('', Array)
#8 /var/www/html/***/vendor/yiisoft/yii2/base/Module.php(455): yii\console\Controller->runAction('', Array)
#9 /var/www/html/***/vendor/yiisoft/yii2/console/Application.php(161): yii\base\Module->runAction('migrate', Array)
#10 /var/www/html/***/vendor/yiisoft/yii2/console/Application.php(137): yii\console\Application->runAction('migrate', Array)
#11 /var/www/html/***/vendor/yiisoft/yii2/base/Application.php(375): yii\console\Application->handleRequest(Object(yii\console\Request))
#12 /var/www/html/***/yii(23): yii\base\Application->run()
#13 {main}
*** failed to apply m140608_173539_create_user_table (time: 0.004s)
Migration failed. The rest of the migrations are canceled.
I am not sure, what am I doing wrong here.
Make sure you included module in your application config:
'modules' => [
'user-management' => [
'class' => 'webvimark\modules\UserManagement\UserManagementModule',
// Here you can set your handler to change layout for any controller or action
// Tip: you can use this event in any module
'on beforeAction' => function (\yii\base\ActionEvent $event) {
if ($event->action->uniqueId == 'user-management/auth/login') {
$event->action->controller->layout = 'loginLayout.php';
};
},
],
],
It's covered in extension readme.
It's falling when accessing non-existing module in this line:
$this->createTable(Yii::$app->getModule('user-management')->user_table, array(

Give an error before refreshing in ZF

Hi i am new in Zend Framework. i am working with existing project.
Here,
$url = $this->view->url(array('controller' => $user->status), 'default', true);
$url = $this->_getParam('url', $url);
$this->_redirect($url);
it is redirected to another page but there i get following error:
Exception information:
Message: Mysqli statement execute error : No data supplied for parameters in prepared statement
Stack trace:
#0 C:\web\Apache2\php\Zend\1.11.3\library\Zend\Db\Statement.php(300): Zend_Db_Statement_Mysqli->_execute(Array)
#1 C:\web\Apache2\php\Zend\1.11.3\library\Zend\Db\Adapter\Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 C:\web\Apache2\php\Zend\1.11.3\library\Zend\Db\Table\Abstract.php(1526): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Table_Select))
#3 C:\web\Apache2\php\Zend\1.11.3\library\Zend\Db\Table\Abstract.php(1388): Zend_Db_Table_Abstract->_fetch(Object(Zend_Db_Table_Select))
#4 C:\web\Apache2\htdocs\application\modules\default\controllers\generalController.php(24): Zend_Db_Table_Abstract->fetchRow(Object(Zend_Db_Table_Select))
#5 C:\web\Apache2\php\Zend\1.11.3\library\Zend\Controller\Action.php(513): generalController->indexAction()
#6 C:\web\Apache2\php\Zend\1.11.3\library\Zend\Controller\Dispatcher\Standard.php(295): Zend_Controller_Action->dispatch('indexAction')
#7 C:\web\Apache2\php\Zend\1.11.3\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#8 C:\web\Apache2\php\Zend\1.11.3\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#9 C:\web\Apache2\php\Zend\1.11.3\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#10 C:\web\Apache2\htdocs\public\index.php(59): Zend_Application->run()
#11 {main}
but if i refresh page everything get OK, i dont get error
i can not understand what is the problem
can anyone help me please?

phalcon php switches update to insert

For some reason phalcon is replacing my order to an insert instead of an update (I can see that in the logs)
$phql = "UPDATE Vouchers SET user_name = :userName:, used = true WHERE voucher_code = :voucherCode:";
$status = $app->modelsManager->executeQuery($phql, array(
'userName' => $voucherReq->userName,
'voucherCode' => $voucherCode
));
I'm probably missing something overriding an update to an insert... well that's a lot. This is a special model that doesn't follow the common ID pattern (if it helps).
In the logs I can see:
[Mon Oct 13 23:49:49.698965 2014] [:error] [pid 379] [client 82.113.121.157:60949] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "voucher_voucher_code_idx"' in /var/www/api/index.php:41\nStack trace:\n
#0 [internal function]: PDOStatement->execute()\n
#1 [internal function]: Phalcon\\Db\\Adapter\\Pdo->executePrepared(Object(PDOStatement), Array, Array)\n
#2 [internal function]: Phalcon\\Db\\Adapter\\Pdo->execute('INSERT INTO "vo...', Array, Array)\n
#3 [internal function]: Phalcon\\Db\\Adapter->insert('vouchers', Array, Array, Array)\n
#4 [internal function]: Phalcon\\Mvc\\Model->_doLowInsert(Object(Phalcon\\Mvc\\Model\\MetaData\\Memory), Object(Phalcon\\Db\\Adapter\\Pdo\\Postgresql), 'vouchers', false)\n
#5 [internal function]: Phalcon\\Mvc\\Model->save()\n
#6 [internal function]: Phalcon\\Mvc\\Model->update(Array)\n
#7 [internal function]: Phalcon\\Mvc\\Model\\Query->_executeUpdate(Array, Array, NULL)\n
#8 [internal function]: Phalcon\\Mvc\\Model\\Query->execute(Array, NULL)\n
#9 /var/www/api/index.php(41): Phalcon\\Mvc\\Model\\Manager->executeQue in /var/www/api/index.php on line 41
Any thoughts?
I've suffered from similar behavior.
Seems that Phalcon needs the update where clause to be on the primary key in order to update that specific row. I've added id as a primary key and all went OK.
In your case set voucher_code as primary key for that table.
Hope this helps

Categories