AWS S3 PHP getObject standard example causing fatal error - php

I have some code that looks exactly like this:
$result = $client->getObject(array(
'Bucket' => $bucket,
'Key' => 'data.txt',
'SaveAs' => '/tmp/data.txt'
));
its one of the examples listed here: http://docs.aws.amazon.com/aws-sdk-php-2/latest/class-Aws.S3.S3Client.html#_getObject
unfortunately I get this fatal error:
PHP Warning: Missing argument 2 for AmazonS3::get_object() in /var/www/CronJobs/aws-sdk- for-php/services/s3.class.php on line 1489
PHP Notice: Undefined variable: filename in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php on line 1495
PHP Warning: preg_match() expects parameter 2 to be string, array given in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php on line 1042
PHP Warning: preg_match() expects parameter 2 to be string, array given in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php on line 1043
PHP Notice: Array to string conversion in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php on line 548
PHP Fatal error: Uncaught exception 'S3_Exception' with message 'S3 does not support "Array" as a valid bucket name. Review "Bucket Restrictions and Limitations" in the S3 Developer Guide for more information.' in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php:548
Stack trace:
0 /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php(1530): AmazonS3->authenticate(Array, Array)
1 [internal function]: AmazonS3->get_object(Array)
2 /var/www/CronJobs/aws-sdk-for-php/sdk.class.php(436): call_user_func_array(Array, Array)
3 /var/www/CronJobs/leefomatic/index.php(70): CFRuntime->__call('getObject', Array)
4 /var/www/CronJobs/leefomatic/index.php(70): AmazonS3->getObject(Array)
5 {main}
thrown in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php on line 548
in my script I am currently listObject, copy_object and delete_option just fine. Any thoughts as to why a fatal error comes up on a getObject?
Thanks.

It looks like you are using the SDK 2.x documentation with SDK 1.x code. The filenames (e.g., s3.class.php, sdk.class.php) output in the error block you have shown definitely indicate that you are using SDK 1.x code. You either need to install the newer and better supported SDK 2.x (here are some instructions), or use the SDK 1.x docs.

Related

why have I an error in the visual constructor?

I have an error notice in the visual constructor of my web page (jupiter)
That error says:
Warning: Illegal string offset 'pro_widgets' in /home/customer/www/gedysa.com/public_html/wp-content/plugins/elementor/includes/api.php on line 164
Warning: Illegal string offset 'pro_widgets' in /home/customer/www/gedysa.com/public_html/wp-content/plugins/elementor/includes/api.php on line 167
I have gone where apparently the problem is, in the php archive of jupiter plugin and it look like this:
164 $data['pro_widgets'] = [];
165 }
166
167 return $data['pro_widgets'];
but I dont know what to do.
Could somebody help me??

How to solve the error: call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method

This project worked for sometime and i haven't done any changes to it. One day, i was just curious and decided to check on it but now it doesn't work anymore.
Notice: Undefined index: type in
/Applications/XAMPP/xamppfiles/htdocs/icilending/web/actions.php on
line 5
Warning: call_user_func() expects parameter 1 to be a valid callback,
second array member is not a valid method in
/Applications/XAMPP/xamppfiles/htdocs/icilending/web/actions.php on
line 5
Code:
require_once("../src/inc/init.php");
call_user_func([new Controller, $_POST['type']]);

PHP Mongo Library overflow detected

i've a problem with the MongoDB PHP library. I'am trying to find something in a collection but get this error.
Fatal error:
Uncaught MongoDB\Driver\Exception\InvalidArgumentException: Integer overflow detected on your platform: 1484960424767 in C:\xampp\htdocs\gameid\vendor\mongodb\mongodb\src\Operation\Find.php:222
Stack trace:
#0 C:\xampp\htdocs\gameid\vendor\mongodb\mongodb\src\Operation\Find.php(222): MongoDB\Driver\Cursor->setTypeMap(Array)
#1 C:\xampp\htdocs\gameid\vendor\mongodb\mongodb\src\Operation\FindOne.php(105): MongoDB\Operation\Find->execute(Object(MongoDB\Driver\Server))
#2 C:\xampp\htdocs\gameid\vendor\mongodb\mongodb\src\Collection.php(559): MongoDB\Operation\FindOne->execute(Object(MongoDB\Driver\Server))
#3 C:\xampp\htdocs\gameid\index.php(7): MongoDB\Collection->findOne(Array)
#4 {main} Next MongoDB\Driver\Exception\InvalidArgumentException: Integer overflow detected on your platform: 1484960529934 in C:\xampp\htdocs\gameid\vendor\mongodb\mongodb\src\Operation\Find.php:222
Stack trace:
#0 C:\xampp\htdocs\gameid\vendor\mongodb\mongodb\src\Operation\Find.php(222): MongoDB\Driver\Cursor->setTypeMap(Array)
#1 C:\ in C:\xampp\htdocs\gameid\vendor\mongodb\mongodb\src\Operation\Find.php on line 222
Here is my source code:
$con = new MongoDB\Client('mongodb://user:pwd#ip:port/ripes');
$con = $con->ripes->games;
$result = $con->findOne(['gameID' => 'KUDl-xvjWkPJkjTRf-']);
What is wrong? If no entry exists with the id, PHP does not report any errors.
I just encountered the same Integer overflow PHP exception. Take a look at your error message again, it is telling you exactly what caused the exception:
Integer overflow detected on your platform: 1484960424767
I was able to use Robo3T (RoboMongo) to view the document in question and see the field with the value that caused the exception (1484960424767 in your case). In the MongoDB document, the field was defined as type NumberLong(), and the value exceeds PHP's capability to parse long integers on the version you're using... most likely 32-bit PHP. Try using 64-bit PHP, if possible.
In my case, the document field was supposed to be a string, so I had to modify the document-creation script to force the value to be a string type.
$doc = array(
"field" => (string)$long_number_value
);

Magento "Notice: Undefined variable: response"

I'm running Magento 1.6.2.0.
I noticed in system.log every time an order is placed these 3 lines:
2012-12-19T15:37:00+00:00 ERR (3): Recoverable Error: Argument 1 passed to Mage_Core_Controller_Varien_Action::__construct() must be an instance of Zend_Controller_Request_Abstract, array given, called in /chroot/home/saucench/saucencheese.com/html/app/code/core/Mage/Core/Model/Config.php on line 1351 and defined in /chroot/home/saucench/saucencheese.com/html/app/code/core/Mage/Core/Controller/Varien/Action.php on line 138
2012-12-19T15:37:00+00:00 ERR (3): Recoverable Error: Argument 2 passed to Mage_Core_Controller_Varien_Action::__construct() must be an instance of Zend_Controller_Response_Abstract, none given, called in /chroot/home/saucench/saucencheese.com/html/app/code/core/Mage/Core/Model/Config.php on line 1351 and defined in /chroot/home/saucench/saucencheese.com/html/app/code/core/Mage/Core/Controller/Varien/Action.php on line 138
2012-12-19T15:37:00+00:00 ERR (3): Notice: Undefined variable: response in /chroot/home/saucench/saucencheese.com/html/app/code/core/Mage/Core/Controller/Varien/Action.php on line 141
So apparently the variable "response" isn't defined. Would anyone be able to help me locate the source that's causing this error? It can't be in the Config.php or Action.php since I've never modified those.
Thank you.
It's on this file
/chroot/home/saucench/saucencheese.com/.../Core/Controller/Varien/Action.php
on line 141
See what is happening there and make sure the $variables are defined.

Debugging socket_select() PHP

So I'm writing a chat with a php socket server.
CODE:
http://pastebin.com/v5XKkfyy
If i try to debug by
print_r($read);
just before line 75 i get this output
Array
(
[2] => Resource id #6
[0] => Resource id #4
)
PHP Warning: socket_select(): 6 is not a valid Socket resource in /var/www/chat/server.php on line 75
Warning: socket_select(): 6 is not a valid Socket resource in /var/www/chat/server.php on line 75
PHP Warning: socket_select(): 6 is not a valid Socket resource in /var/www/chat/server.php on line 75
Warning: socket_select(): 6 is not a valid Socket resource in /var/www/chat/server.php on line 75
Array
(
[0] => Resource id #4
)
This is happening just as i call line 424.
Someone on freenode #php said i mite be passing an integer instead of a socket resource. I find that hard to belive.
Hope one of you can help me.
We found the answer on freenode.
To fix this i had to comment out line 427:
socket_close($client[$i]['sock']);
Thanks everybody!

Categories