phpcs always shows Call stack - phpcs

Simply running
phpcs --version
Give this output
PHP_CodeSniffer\Exceptions\DeepExitException: PHP_CodeSniffer version 3.7.1 (stable) by Squiz (http://www.squiz.net)
in C:\Users\David\AppData\Roaming\Composer\vendor\squizlabs\php_codesniffer\src\Config.php on line 713
Call Stack:
0.2021 410136 1. {main}() C:\Users\David\AppData\Roaming\Composer\vendor\bin\phpcs:0
0.2042 413272 2. include('C:\Users\David\AppData\Roaming\Composer\vendor\squizlabs\php_codesniffer\bin\phpcs') C:\Users\David\AppData\Roaming\Composer\vendor\bin\phpcs:115
0.2111 623752 3. PHP_CodeSniffer\Runner->runPHPCS() C:\Users\David\AppData\Roaming\Composer\vendor\squizlabs\php_codesniffer\bin\phpcs:17
0.2136 908896 4. PHP_CodeSniffer\Config->__construct($cliArgs = ???, $dieOnUnknownArg = ???) C:\Users\David\AppData\Roaming\Composer\vendor\squizlabs\php_codesniffer\src\Runner.php:67
0.2333 947240 5. PHP_CodeSniffer\Config->setCommandLineValues($args = [0 => '--version']) C:\Users\David\AppData\Roaming\Composer\vendor\squizlabs\php_codesniffer\src\Config.php:342
0.2334 947272 6. PHP_CodeSniffer\Config->processLongArgument($arg = 'version', $pos = 0) C:\Users\David\AppData\Roaming\Composer\vendor\squizlabs\php_codesniffer\src\Config.php:441
PHP_CodeSniffer version 3.7.1 (stable) by Squiz (http://www.squiz.net)
I've tried uninstalling and reinstalling and nothing. Tried phpcs.bat just in case but same output.
Anyone knows what's going on?
Update:
It was php.ini I had display_errors = On

Related

Error in PHP 7.4 - imagecolorallocate - milon / barcode

[Solved]
I'm using the repo milon/barcode (v7.0.1) in a Laravel (v7.30.4) application, and yesterday, after updated my server to 7.4.16 (Centos8) , I have got this error:
"Trying to access array offset on value of type bool"
I already checked if the GD PHP extension was enabled (and it is), and I can't find how to solve this.
if (function_exists('imagecreate')) {
// GD library
$imagick = false;
$png = imagecreate($width, $height);
$bgcol = imagecolorallocate($png, 255, 255, 255);
imagecolortransparent($png, $bgcol);
$fgcol = imagecolorallocate($png, $color[0], $color[1], $color[2]);
Function: getBarcodePNG
Line: 186
$fgcol = imagecolorallocate($png, $color[0], $color[1], $color[2]);
I think it is a server/php error, but I'm not good in server things :(
Thanks
For who are facing the same issue:
In PHP 7.4, is mandatory to pass all the parameters to the getBarcodePNG function

Laravel, php artisan passport:install error

I was curious about setting up an API in Laravel using Passport so I followed their documentation here:
https://laravel.com/docs/5.6/passport
Once I run
php artisan passport:install
It gives me this error:
ErrorException : openssl_pkey_new(): private key length is too short; it needs to be at least 384 bits, not 0
at /Users/fantastisk/web/blog-laravel/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php:560
556| $config = array();
557| if (isset($this->configFile)) {
558| $config['config'] = $this->configFile;
559| }
> 560| $rsa = openssl_pkey_new(array('private_key_bits' => $bits) + $config);
561| openssl_pkey_export($rsa, $privatekey, null, $config);
562| $publickey = openssl_pkey_get_details($rsa);
563| $publickey = $publickey['key'];
564|
Exception trace:
1 openssl_pkey_new(["4096", "/Users/fantastisk/web/blog-laravel/vendor/phpseclib/phpseclib/phpseclib/Crypt/../openssl.cnf"])
/Users/fantastisk/web/blog-laravel/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php:560
2 phpseclib\Crypt\RSA::createKey("4096")
/Users/fantastisk/web/blog-laravel/vendor/laravel/passport/src/Console/KeysCommand.php:35
This is what i have in the openssl.cnf file
# minimalist openssl.cnf file for use with phpseclib
HOME = .
RANDFILE = $ENV::HOME/.rnd
distinguished_name = req_distinguished_name
[ v3_ca ]
I'm running on a mac with php 7.1 (i tried building it from source with openssl too), SSL Version => LibreSSL/2.0.20.
I tried following the documentation using homestead too, which gives me the exact same error.
To me it seems like there's a problem with the phpseclib library, but I haven't been able to find anything on google regarding this error.
As a final note, I tried running this command to check if openssl_pkey_new works:
openssl_pkey_new(array("digest_alg" => "sha512","private_key_bits" => 4096,"private_key_type" => OPENSSL_KEYTYPE_RSA,));
That worked with no error.
Any help or point in the right direction will be very much appreciated.
Try passing the length option as you run the install command:
php artisan passport:install --length=256
If that doesn't work then try forcing the key generation:
php artisan passport:key --force
You may need to run composer update prior.

Laravel 4 - Warning: Illegal offset type in isset or empty in \bootstrap\compiled.php

I'm having a hard time installing Laravel 4 on Windows 8 + Xampp.
Here's the setup:
- Xampp 1.8.1
- Composer is installed globally
I install Laravel with the usual "composer create-project laravel/laravel projectname". It installs fine.
But when I navigate to the public folder of the framework, I get dozens of Warning: Illegal offset type in isset or empty in \bootstrap\compiled.php errors.
On lines : 439, 221, 137, 154. The 4 errors are repeated indefinitely until the request times out.
Troubleshooting done so far:
- Tried on 2 seperate machines with the same setup.
- Re-ran Composer update.
- Instead of using create-project, I downloaded the framework and ran Composer install.
- Tried to setup up virtual hosts instead of accessing localhost/projectname/public.
- Searched online for 2 hours. Read every Laravel 4 install tutorial.
Any clues on what I might be doing wrong?
Thanks
-- EDIT --
Here are the lines causing the problem inside of compiled.php
Line 137 section :
$abstract = $this->getAlias($abstract);
if (isset($this->instances[$abstract])) {
return $this->instances[$abstract];
}
Line 154 section :
protected function getConcrete($abstract)
{
if (!isset($this->bindings[$abstract])) {
return $abstract;
} else {
return $this->bindings[$abstract]['concrete'];
}
}
Line 221 section :
protected function getAlias($abstract)
{
return isset($this->aliases[$abstract]) ? $this->aliases[$abstract] : $abstract;
}
Line 439 section :
public function make($abstract, $parameters = array())
{
if (isset($this->deferredServices[$abstract])) {
$this->loadDeferredProvider($abstract);
}
return parent::make($abstract, $parameters);
}
-- NEW FIND --
Using Wampserver works, instead of using Xampp.
Encountered the same error when using Xampp. I fixed it by disabling the eAccelerator extension in php.ini. Try commenting out the following line: zend_extension = "path\to\xampp\php\ext\php_eaccelerator_ts.dll" in your php.ini file.

" URL not found 404 error" after the 3rd page during Magento installation

I have been trying to install Magento 1.6 latest version and sample data magento sample-data- 1.1.2 but all in vain.I cannot get past the 3rd page,where database,username,URL etc information is added.When I click the continue button,I get 404 error “URL not found“ .After google search I found out that some guys reported similar problems that lead to some php files accessing the Mysql server.Those files seemed to have a syntax error of some kind.My problem is of similar nature but leads to a diffrent php file having an 'an access voilation'error.The url points to the report directory inside magento/var.
This is my report file in Public_html/magento/var/report
a:5:{i:0;s:223:"Error in file: "/home/archy/public_html/magento/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.2-0.8.3.php" - SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'AX' for key 'PRIMARY'";i:1;s:1022:"#0 /home/archy/public_html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(645): Mage::exception('Mage_Core', 'Error in file: ...')
I don’t understand how to solve the problem.Has anyone experienced similar problems.
New Addition..
I am really struggling with Magento!! I tried to install magento on my desktop(local server) after a failed attempt on my laptop(above).But I get I "Object not found error 404" after clicking the continue button in the configuration section of my installation.I have double checked my permissions on media, var,app directories.They are all 777.Sample date was installed before starting installation.The only option that I commented out in .htaccess was the the ExpireDefault which was causing "Internal Server Error"before being removed.
Here is the stack trace:
Mage_Core_Exception: Can't retrieve entity config: sales/quote_shipping_rate in /home/sam/public_html/magento/app/Mage.php on line 563
Call Stack:
0.0296 644264 1. {main}() /home/sam/public_html/magento/index.php:0
0.1808 1129872 2. Mage::run() /home/sam/public_html/magento/index.php:80
0.3326 2771544 3. Mage_Core_Model_App->run() /home/sam/public_html/magento/app/Mage.php:640
1.0335 4165088 4. Mage_Core_Model_App->_initModules() /home/sam/public_html/magento/app/code/core/Mage/Core/Model/App.php:338
5.2513 4490984 5. Mage_Core_Model_Resource_Setup::applyAllUpdates() /home/sam/public_html/magento/app/code/core/Mage/Core/Model/App.php:412
7.1161 9860936 6. Mage_Core_Model_Resource_Setup->applyUpdates() /home/sam/public_html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php:235
7.1163 9861520 7. Mage_Core_Model_Resource_Setup->_upgradeResourceDb() /home/sam/public_html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php:320
7.1163 9861600 8. Mage_Core_Model_Resource_Setup->_modifyResourceDb() /home/sam/public_html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php:437
7.1792 9917352 9. include('/home/sam/public_html/magento/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.16-0.9.17.php') /home/sam/public_html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php:624
7.1810 9918112 10. Mage_Sales_Model_Resource_Setup->addAttribute() /home/sam/public_html/magento/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.16-0.9.17.php:32
7.1810 9918112 11. Mage_Sales_Model_Resource_Setup->_flatTableExist() /home/sam/public_html/magento/app/code/core/Mage/Sales/Model/Resource/Setup.php:101
12.4649 9964680 12. Mage_Core_Model_Resource_Setup->getTable() /home/sam/public_html/magento/app/code/core/Mage/Sales/Model/Resource/Setup.php:87
12.4649 9964680 13. Mage_Core_Model_Resource->getTableName() /home/sam/public_html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php:184
12.5666 10576032 14. Mage::throwException() /home/sam/public_html/magento/app/code/core/Mage/Core/Model/Resource.php:272
)
I couldn't find out what could have caused the problem.Help needed.
Thank you.
Check with the below script if your server or local meets the requirement to install magento
function extension_check($extensions) {
$fail = '';
if(version_compare(phpversion(), '5.2.0', '<')) {
$fail .= '<li>PHP 5.2.0 (or greater)</li>';
}
if(!ini_get('safe_mode')) {
if(preg_match('/[0-9].[0-9]+.[0-9]+/', shell_exec('mysql -V'), $version)) {
if(version_compare($version[0], '4.1.20', '<')) {
$fail .= '<li>MySQL 4.1.20 (or greater)</li>';
}
}
}
foreach($extensions as $extension) {
if(!extension_loaded($extension)) {
$fail .= '<li>'.$extension.'</li>';
}
}
if($fail) {
echo '<p>Your server does not meet the requirements for Magento.';
echo 'The following requirements failed:</p>';
echo '<ul>'.$fail.'</ul>';
} else {
echo '<p>Congratulations! Your server meets the requirements for Magento.</p>';
}
}
?>
STEP 2 : CHeck Max Execution time
Step 3: Install the Magento again with the version 1.6.0.0 as there were some problem at the first release or try with latest version 1.6.2.0
Let me know if it works or not

thinking sphinx unknown type 'mysql'; skipping

I'm using ts version 2.0.5, rails 3.0.9 and mysql2 0.2.11
When trying to create my indexes, using rake ts:index, I get the following error:
ERROR: source 'technical_core_0': unknown type 'mysql'; skipping.
My development.sphinx.conf contains:
source technical_core_0
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass =
sql_db = ps_development
sql_sock = /tmp/mysql.sock
sql_query_pre = SET NAMES utf8
sql_query_pre = SET TIME_ZONE = '+0:00'
sql_query = SELECT SQL_NO_CACHE `technicals`.`id` * CAST(1 AS SIGNED) + 0 AS `id` , `orders`.`name` AS `author`, `technicals`.`id` AS `sphinx_internal_id`, 0 AS `sphinx_deleted`, 488243725 AS `class_crc`, IFNULL(`orders`.`name`, '') AS `author_sort`, `technicals`.`order_id` AS `order_id`, UNIX_TIMESTAMP(`technicals`.`created_at`) AS `created_at`, UNIX_TIMESTAMP(`technicals`.`updated_at`) AS `updated_at` FROM `technicals` LEFT OUTER JOIN `orders` ON `orders`.`id` = `technicals`.`order_id` WHERE (`technicals`.`id` >= $start AND `technicals`.`id` <= $end) GROUP BY `technicals`.`id`, , `orders`.`name`, `technicals`.`id`, `orders`.`name`, `technicals`.`order_id`, `technicals`.`created_at`, `technicals`.`updated_at` ORDER BY NULL
sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1) FROM `technicals`
sql_attr_uint = sphinx_internal_id
sql_attr_uint = sphinx_deleted
sql_attr_uint = class_crc
sql_attr_uint = order_id
sql_attr_timestamp = created_at
sql_attr_timestamp = updated_at
sql_attr_str2ordinal = author_sort
sql_query_info = SELECT * FROM `technicals` WHERE `id` = (($id - 0) / 1)
}
Which is a bit odd as my database.yml file contains mysql2 and a root password.
Can you help me get past this stage? I tried also creating a sphinx.yml file with:
development:
adapter: mysql2
But this also fails.
-- UPDATE --
I added this into the development initialisers file:
ThinkingSphinx.database_adapter = :mysql2
Which gives error about only MySQL being supported.
As per the link here, you could simply do the following on homebrew (mac):
brew install sphinx --with-mysql
That worked for me :)
When you are compiling Sphinx you should specify the --with-mysql flag.
$ ./configure --with-mysql
$ make
$ sudo make install
You might need to specify the location of your MySQL library's include files. For example on a fresh installation of OS X:
$ ./configure --with-mysql=/opt/local/include/mysql5
Also when installing on OSX via homebrew try this:
sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
brew install --interactive sphinx
./configure
make
make install
exit
The generated source looks correct - is it possible your version of Sphinx was compiled without MySQL support?

Resources