App engine update breaks CloudStorage in dev php env - php

After todays update (release: "1.9.18".) of GoogleAppEngineLauncher, CloudStorageTool now throws an exception it didn't before.
This is the exception thrown:
google\appengine\runtime\RPCFailedError: Remote implementation for app_identity_service.GetAccessToken failed.
The trace looks like this:
google_appengine/php/sdk/google/appengine/api/app_identity/AppIdentityService.php#182
google_appengine/php/sdk/google/appengine/ext/cloud_storage_streams/CloudStorageClient.php#329
google_appengine/php/sdk/google/appengine/ext/cloud_storage_streams/CloudStorageUrlStatClient.php#132
google_appengine/php/sdk/google/appengine/ext/cloud_storage_streams/CloudStorageUrlStatClient.php#63
google_appengine/php/sdk/google/appengine/ext/cloud_storage_streams/CloudStorageStreamWrapper.php#358
Reproducing code:
$filename = 'test.txt';
$bucket_name = google\appengine\api\cloud_storage\CloudStorageTools::getDefaultGoogleStorageBucketName();
file_exists( 'gs://'.$bucket_name.'/'.$filename );
I'm running the GoogleAppEngineLauncher, PHP runtime. On mac OSX 10.10.2 and testing locally.
Has anybody else experienced this? Does anyone have a workround?

As said in the comment Using GCS in GAE Local devserver there is an issue with 1.9.18. They advise to downgrade to 1.9.17 with this link

Update: As of March 5th, 2105 this was fixed in the public release of 1.9.18, which may be a simpler way to get the fix.

Related

Symfony 4 : Default value for parameters with a class type can only be

I am currently working on an application in symfony 4. I encounter a problem for deploy in prod. when I get to the navigator I get this error :
Fatal error: Default value for parameters with a class type can only be NULL in /var/www/html/project/vendor/symfony/config/ResourceCheckerConfigCache.php on line 40.
public function __construct(string $file, iterable $resourceCheckers = array())
{
$this->file = $file;
$this->resourceCheckers = $resourceCheckers;
}
I specify that the site works perfectly with the dev server (php bin /console server:start)
The problem must come from the environment. in the .env file, when I set APP_ENV=dev , in the browser there is only a blank page with a status 500 (no message in the logs)
I can not find any documentation on the internet and I am starting to lack ideas. If someone has a solution I am interested.
Thank you.
Solution by OP.
The problem was that the PHP version was PHP 7.0 and not 7.1. Though in my shell the php -v command was fine with 7.1, I noticed the wrong version used by phpinfo ();

PHPDox File not found

I was trying to run phpdox on windows server 2012 - but I am getting the error:
PHP Version: 7.0.5 (WINNT)
PHPDox Version: 0.8.1.1
Exception: TheSeer\phpDox\Generator\TokenFileException (Code: 1)
Location: phar://D:/htdocs/AscPro/bin/phpdox-0.8.1.1.phar/phpdox/generator/pro
ject/TokenFile.php (Line 19)
File 'file:/D:/htdocs/AscPro/build/phpdox/tokens/AppBundle/AppBundle.php.xml'
not found
I've checked the location, the file is not missing.
I'm running into this problem during continuous integration process with jenkins. It is very strange, because the same phpdox version did work for me on ubuntu. Maybe this is related to the fact, that all programs lay on "C:", including Jenkins - but the jenkins workspace lays on "D:"?
I think that the problem lies within incorrect using WINDOWS path. Please see this question:
Help with windows path - PHP
As a quick test, try to change file_exists check to harcoded argument:
file:///C:\htdocs\AscPro\build\phpdox\tokens\AppBundle\AppBundle.php.xml
Im afraid it`s a bug of phpdox.
Phpdox convert all paths to unix style before check to exists.
You can see this code here.
Maybe you can hack function exists
replace:
return file_exists($this->getPathname());
to:
return file_exists(parent::getPathname());

Get Stream HttpSignatures\Context Not Found

I'm just a typical non professional PHP guy writing small apps for my website.
I am trying to install GetStream.io but because I don't know how to use composer (actually i tried, but i'm really not a terminal kind of person).
Anyway I couldn't create a autoloader as instructed by GetStream GitHub so I ended up creating my own autoloader.php using some codes pieced together from Stackoverflow.
My code
<?
function __autoload_namespaced_module($class) {
$path = str_replace('\\', '/', $class);
if (file_exists($file = ( $path . '.php'))) {
require_once($file);
}
}
spl_autoload_register();
spl_autoload_register('__autoload_namespaced_module');
?>
So yay i learnt something new today on autoload!!!
Until......
Fatal error: Class 'HttpSignatures\Context' not found in /GetStream/Stream/Signer.php on line 36
So now I know HttpSignatures\Context should be a php file in the home folder right, or something right but i check Git hub there's no such file....
Anyone encounter same problem and can install this SDK without composer?
Using composer to generate autoload files, or looking for dependencies can be a very difficult task for someone like me who are just using PHP to do simple apps.
I went through the steps in to use composer in MAC OS and it was complicated, very complicated and no idea what i was supposed to do following steps didn't help.
At last, I went online and find online PHP editors, and ended up with PHPStorm which gave me good syntax highlighter etc, and COMPOSER!
Now I finally know what composer is for and how it works.
TLDR: People who are having problem with composer, and have no idea what composer is, can try download PHPStorm for the 30days trial and just use it to generate the needed files.

Drupal Module installation error- File Transfer failed, reason: /mysite.com/sites/all/modules is outside of the /mysite.com

I have installed Drupal on Windows 2012 R2 (IIS 8.5) on my DEV and TEST servers. They are clean / out-of-the-box installations. My DEV environment is working fine, but I can’t install modules on my TEST environment. I’ve gone over the installations trying to figure out what is different, but I’ve been beating my head against the wall and they seem identical. Clearly they are not.
Problem
When installing a module, I get this error:
Installation failed! See the log below for more information.
module_filter
•Error installing / updating
•File Transfer failed, reason: /mysite.com/sites/all/modules is outside of the /mysite.com
(Note this is from the Authorize.php)
The permission on my public download folder seems fine – the module uploads and extracts just fine.
My public file system path is set to “sites/default/files” and my temporary directory is set to “sites/default/files/tmp”.
I can't figure out why it thinks the modules folder is outside of my root site!
I’m stumped. Any help would be appreciated!!!
Thanks
Tom Hundley
Solution
As it turns out, this is a bug in Drupal running on IIS. The checkPath method of filetransfer.inc. is case-sensitive, so depending on how you setup the site in IIS, it might work or it might not work! This explained why things work on my DEV environment but not TEST.
Edit the checkPath method in includes/filetransfer/filetransfer.inc and add this code:
$full_path = strtolower($full_path);
$full_jail = strtolower($full_jail);
just before the path comparison:
if ($full_jail !== $full_path) { ... }
FIXED!
References
A HUGE thanks goes out to "sevenares" for posting the solution to this problem here:
https://www.drupal.org/node/1071870#comment-8507091
I hope this helps someone.
Happy coding,
Tom Hundley

Fatal error: Class 'PHPExcel_Shared_String' not found

I have used PHPExcel for my codeigniter app and it is working perfectly in localhost, but when I host this to server, I am getting following error :
Fatal error: Class 'PHPExcel_Shared_String' not found in \xx\xx\xx
third_party\PHPExcel\Autoloader.php on line 36
There was a change introduced to the autoloader in the latest version of PHPExcel that appears to have broken backward compatibility with versions of PHP < 5.3.0
If you edit the Classes/PHPExcel/Autoloader.php file and change line 58, which should read
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'), true, true);
to
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'));
I've already made a change to the develop branch on github to test for the PHP version and execute the appropriate line
While this was not deliberate, please note that we really are trying to get users to upgrade to at least version 5.3.0 of PHP, because we can't address any of the memory/performance issues that users working with large spreadsheets complain about until we can use some of the new features available in more recent versions of PHP. Version 5.2 of PHP is no longer supported, and even version 5.3 is end-of-life and will be unsupported before the end of this year
struggled with this issue for a long time under Linux and PHP 5.4x. In the end, in addition to the fix above, I resorted to changing the code on line 73 of the Autoloader file which sets the $pClassFilePath variable from relative (using PHPEXCEL_ROOT) to absolute following the machines file tree. This might only be a hack, but it saved my sanity after several days of trying. Hope this helps someone. Cheers
I had this issue too and i solved it by changing permissions on "Shared" directory to 655.
I Hope it helps
If your server is on Linux, it can be permission problem... Just add all permissions for PHPExcel Folder in you Vendor (on server side) and all subfolders for it. I have same problem and i have solved it by this way...
What worked for me was changing PHPExcel/Autoloader.php line 81 from
if ((file_exists($pClassFilePath) === FALSE) || (is_readable($pClassFilePath) === FALSE)) {
to
if ((stream_resolve_include_path($pClassFilePath) === FALSE)) {
I prefer this approach because it didn't require me to modify file permissions and it should work in PHP 5.3.2 and later.

Categories