phpseclib error bigInterger not found on line x - php

hi this my error when i want implement RSA algorithm in PHP how to fix this problem everything seems okay and i not changing anything
Fatal error: Class 'phpseclib\Math\BigInteger' not found in
phpseclib/Crypt/RSA.php on line 509 this is line 509 in __construct
method of RSA class $this->zero = new BigInteger(0);
how to fix this problem

My guess: you're trying to use either the 2.0 version (or the master branch in github) of phpseclib and aren't using an autoloader (eg. Composer), as is required by those versions.
If you don't want to use an autoloader then you'll need to use the 1.0 branch.

use below code as header
Phpseclib\Math\BigInteger
istead of
phpseclib\Math\BigInteger
name start with Capital later in update versions. It resolved my issue

Related

PHP: params must be mixed

It seems the whole world community has never encountered this php error before, judging from google results:
I am trying to set up the Typo3 CMS and I get this error
Type of TYPO3\CMS\Core\IO\CsvStreamFilter::$params must be mixed (as in class php_user_filter) in C:\xampp\htdocs\typo3test\example-project-directory\public\typo3\sysext\core\Classes\IO\CsvStreamFilter.php on line 26
Line 26 in that file looks as follows:
class CsvStreamFilter extends \php_user_filter
I am rather new to PHP, how do I fix this error?
What I have tried so far:
changingdeclare(strict_types=1) in that file to declare(strict_types=0) but it just gets overwritten again
Help!
The instructions in the typo3 guide are slightly outdated.
So in composer create-project typo3/cms-base-distribution:^11 example-project-directory just replace 11 with 11.5.1 or whatever is the lastest version.

google-api-php-client's autoloader deprecated

As a test, I ran one line of code in PHP to implement the PHP Client Library.
indexTest.php
<?php
require_once realpath(dirname(__FILE__).'/google-api-php-client/autoload.php');
return;
I get this error:
Deprecated: google-api-php-client's autoloader was moved to src/Google/autoload.php in 1.1.3. This redirect will be removed in 1.2. Please adjust your code to use the new location. in C:\Users\NoName\Documents\academic-being-90217\google-api-php-client\autoload.php on line 25
What do I need to do to fix this?
Quick Fix:
require_once realpath(dirname(__FILE__).'/google-api-php-client/src/Google/autoload.php');
Google need to update their documentation on the API. (I spent quite a while getting myself in a fuddle recently, trying to get it working using their documentation).
What is you final aim on using the API? Is it just for Login? If you need any help with it, I'll be more than happy to talk you through anything that isn't working as it should be

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.

AWS SDK stopped working after composer update

After I run composer update on AWS PHP SDK I started to get this error:
Fatal error: Interface 'Guzzle\Common\HasDispatcherInterface' not found in <path>
There is HasDispatcherInterface.php file in <path>, but I still get the error. Is this a bug? If it is, is there any workaround?
So it turned out this is about a 12 year old bug of PHP. https://bugs.php.net/bug.php?id=18556
When you use setlocale('tr_TR'), PHP can not find any class or method has an 'I' letter in its name. Even if its a standart library. Great.

PHPUnit error - Class could not be found

I just installed PHPUnit 3.5 on my system, upgrading it from 3.4, and I'm having some trouble with the new version. When I try to run a test, I always get the same output. Here's what I get when I try to run on the command line the StackTest example from the PHPUnit manual, example 4.1:
> phpunit StackTest
X-Powered-By: PHP/5.2.17
Content-type: text/html
PHPUnit 3.5.13 by Sebastian Bergmann.
Class StackTest could not be found in StackTest.php.
Worse yet, when I try to run it from a web browser, I get the following output:
Fatal error: Class 'PHPUnit_Framework_TestCase' not found in /path/to/tests/StackTest.php on line 2
Does anyone know how to set this up? Thanks.
I had the problem you described on Windows.
The problem was in the file pear\PHPUnit\Runner\StandardTestSuiteLoader.php on line 131 an it was caused by different drive letter case in file name in the condition
if ($class->getFileName() == realpath($suiteClassFile)) {
My simple fix is to change this line to be case insensitive
if (strtolower($class->getFileName()) == strtolower(realpath($suiteClassFile))) {
phpunit MyTestClass
In my case
MyTestClass.php should be in the project home directory
it should starts with long php open tag (<?php, not <?)
it should contain class MyTestClass extends PHPUnit_Framework_TestCase {
I know this is most likely not the best way, just point for a beginner to start with.
Try
pear upgrade pear
(if it asks you to channel upgrade do so)
and then
pear install --force --alldeps phpunit/phpunit
and try again.
The 3.5 upgrade combined with a buggy pear installer (1.9.1 has a kinda annoying bug so make sure you are really on 1.9.2) can be a pain sometimes.
I think your PHPUnit Class named StackTest, and the class you want to test is also named StackTest. This will cause a path conflict in PHPUnit.
Make these 2 names different and you will get this resolved.
In my case, this problem was caused by including PHPUnit in the source file via require_once:
require_once 'phar://phpunit.phar';
Removing that line made my test case runnable.
This error can also be caused when you forget to have your test class extend the PHPUnit TestCase class, like
class MyTestClass extends \PHPUnit\Framework\TestCase { ...
I was able to fix the problem. It was a result of how I was loading the class. I used my arguments in the argument array like so and it worked. But there were a lot of other problems with the classpath etc that I had to fix first. To see a working solution look here (http://www.siteconsortium.com/h/p1.php?id=php002).
$command = new PHPUnit_TextUI_Command();
$command->run(array('test', 'testCase', 'c:\workspace\project\testCase.php'), true);
Starting from PHPUnit 9, it is required that the filename match the class name in the test.
#4105: Deprecate multiple test case classes in single file and test case class name differing from filename
So test-plugin.php with a class name PluginTest will fail with this error. To fix it, you'd need to rename the file to PluginTest.php.
Bad error message IMO.
It sounds like PHPUnit isn't on your include path. To easily test this, try this:
$ phpunit --include-path /path/to/PHPUnit StackTest

Categories