I have a project with Laravel 4.
I use an helper in config/database.php
I get this error:
PHP Fatal error: Uncaught exception 'ReflectionException' with message 'Class log does not exist' in /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php:741
Stack trace:
#0 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(741): ReflectionClass->__construct('log')
#1 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build('log', Array)
#2 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('log', Array)
#3 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(842): Illuminate\Foundation\Application->make('Psr\\Log\\LoggerI...')
#4 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(805): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter))
#5 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(776): Illuminate\Container\C in /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 741
I checked and the class name thats passed to make on /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(842)
is Psr\Log\LoggerInterface.
I assume the log class gets called before it is loaded and thats why it breaks.
If I remove the use of the helper in config/database.php all works, even if I simulate errors.
Is there a way to resolve it?
I need the Helper there.
Related
When I run my PHP Yii framework file, It results in the following error.
PHP Compile Error 'yii\base\ErrorException' with message 'Cannot redeclare GuzzleHttp\Psr7\str() (previously declared in /Applications/XAMPP/xamppfiles/htdocs/PLATO/framework/vendor/guzzlehttp/psr7/src/functions.php:19)' in /Applications/XAMPP/xamppfiles/htdocs/PLATO/protected/extensions/aws/GuzzleHttp/Psr7/functions.php:18 Stack trace: #0 [internal function]: yii\base\ErrorHandler->handleFatalError() #1 {main}
How to fix this issue?
I've been stuck trying to figure out why I get this every time I try to run php artisan key:generate (or any other php artisan command).
PHP Fatal error: Uncaught ReflectionException: Class log does not exist in C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php:734
Stack trace:
#0 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(734): ReflectionClass->__construct('log')
#1 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(629): Illuminate\Container\Container->build('log', Array)
#2 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(697): Illuminate\Container\Container->make('log', Array)
#3 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(849): Illuminate\Foundation\Application->make('log')
#4 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(804): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter))
#5 C:\Users\Sam\P in C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 734
Fatal error: Uncaught ReflectionException: Class log does not exist in C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php:734
Stack trace:
#0 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(734): ReflectionClass->__construct('log')
#1 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(629): Illuminate\Container\Container->build('log', Array)
#2 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(697): Illuminate\Container\Container->make('log', Array)
#3 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(849): Illuminate\Foundation\Application->make('log')
#4 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(804): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter))
#5 C:\Users\Sam\P in C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 734
Some suggested putting this at the top of vendor\laravel\framework\src\Illuminate\Container\Container.php because it would reveal the underlying error:
namespace {
use Monolog\Logger as Monolog;
class log extends Illuminate\Log\Writer {
function __construct()
{
$this->monolog = new Monolog("local");
}
}
}
But instead I started getting:
PHP Fatal error: Uncaught ReflectionException: Class env does not exist in C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\
framework\src\Illuminate\Container\Container.php:744
with a similar stacktrace to the initial error. I've been researching online what could be causing it. Someone suggested running 'phpunit', so I did and I got the error:
Dotenv\Exception\InvalidFileException: Dotenv values containing spaces must be surrounded by quotes.
I thought this was interesting because people had suggested that .env values containing spaces could have caused the initial problem, but I have thoroughly and repeatedly checked my .env file for spaces and there are none where there shouldn't be. I even tried wrapping literally every single .env value in quotes. On top of all this my IDE (Phpstorm) tells me that there are no errors in any of the files in my config folder.
What could be causing this issue?
STEP 1
Make sure you have installed all packages properly composer install.
STEP 2
Run composer dump-autoload to generate class references again.
I am creating 2 sub-domains like gateway.domain.com and hp.domain.com
I have installed 2 separate projects name gateway and HP in my local machine,
I upload gateway to gateway.domain.com
It’s working fine.
I upload hp to hp.domain.com
But I got a issue like
Fatal error: Uncaught exception 'ReflectionException' with message 'Class RFID4U_HP\Http\Kernel does not exist' in /var/www/clients/client1/web1/web/subdomains/Gateway/vendor/laravel/framework/src/Illuminate/Container/Container.php:738 Stack trace: #0 /var/www/clients/client1/web1/web/subdomains/Gateway/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): ReflectionClass->__construct('RFID4U_HP\Http...') #1 /var/www/clients/client1/web1/web/subdomains/Gateway/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\Container\Container->build('RFID4U_HP\Http...', Array) #2 /var/www/clients/client1/web1/web/subdomains/Gateway/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(697): Illuminate\Container\Container->make('RFID4U_HP\Http...', Array) #3 /var/www/clients/client1/web1/web/subdomains/Gateway/vendor/laravel/framework/src/Illuminate/Container/Container.php(230): Illuminate\Foundation\Application->make('RFID4U_HP\Http...', Array) #4 /var/www/clients/client1/ in /var/www/clients/client1/web1/web/subdomains/Gateway/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 738
Also hp will going to read gateway fw path, I am not able to understand why this happen. In my lcl it’s working fine.
Some time it will reverse functioning hp working gateway will find the path in hp folder.
Fatal error: Uncaught exception 'ReflectionException' with message 'Class RFID4U_GW\Http\Kernel does not exist' in
/var/www/clients/client1/web1/web/subdomains/hp/vendor/laravel/framework/src/Illuminate/Container/Container.php:738 Stack trace: #0
/var/www/clients/client1/web1/web/subdomains/hp/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): ReflectionClass->__construct('RFID4U_GW\Http...') #1
/var/www/clients/client1/web1/web/subdomains/hp/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\Container\Container->build('RFID4U_GW\Http...', Array) #2
/var/www/clients/client1/web1/web/subdomains/hp/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(697): Illuminate\Container\Container->make('RFID4U_GW\Http...', Array) #3
/var/www/clients/client1/web1/web/subdomains/hp/vendor/laravel/framework/src/Illuminate/Container/Container.php(230): Illuminate\Foundation\Application->make('RFID4U_GW\Http...', Array) #4
/var/www/clients/client1/web1/web/subdomains/hp/ve in /var/www/clients/client1/web1/web/subdomains/hp/vendor/laravel/framework/src/Illuminate/Container/Container.php on line
I want to play around with changing PHPUnit's source, but first I'd like to be able to run its tests to make sure I don't break anything.
I used git to get version 4.7.7 out into a directory. In that directory, I then ran composer install.
Then I cd into tests and run:
phpunit --bootstrap ./bootstrap.php ./
(The version of PHPUnit I'm using to run the tests is also 4.7.7.)
but I get this:
PHP Fatal error: Uncaught exception 'Exception' with message 'PHPUnit suppresses exceptions thrown outside of test case function' in C:\Users\jodes\Documents\NetBeansProjects\PHPUnit\phpunit\tests\Regression\GitHub\873\Issue873Test.php:7
Stack trace:
#0 phar://C:/phpbin/phpunit.phar/phpunit/Util/Fileloader.php(52): include_once()
#1 phar://C:/phpbin/phpunit.phar/phpunit/Util/Fileloader.php(36): PHPUnit_Util_Fileloader::load('C:\Users\jody\D...')
#2 phar://C:/phpbin/phpunit.phar/phpunit/Framework/TestSuite.php(334): PHPUnit_Util_Fileloader::checkAndLoad('C:\Users\jody\D...')
#3 phar://C:/phpbin/phpunit.phar/phpunit/Framework/TestSuite.php(406): PHPUnit_Framework_TestSuite->addTestFile('C:\Users\jody\D...')
#4 phar://C:/phpbin/phpunit.phar/phpunit/Runner/BaseTestRunner.php(57): PHPUnit_Framework_TestSuite->addTestFiles(Array)
#5 phar://C:/phpbin/phpunit.phar/phpunit/TextUI/Command.php(121): PHPUnit_Runner_BaseTestRunner->getTest('.\tests\', '', Array)
#6 phar://C:/phpbin/phpunit.phar/phpunit/TextUI/Command.php(99): PHPUnit_TextU in C:\Users\jody\Documents\NetBeansProjects\PHPUnit\phpunit\tests\Regression\GitHub\873\Issue873Test.php on line 7
Fatal error: Uncaught exception 'Exception' with message 'PHPUnit suppresses exceptions thrown outside of test case function' in C:\Users\jodes\Documents\NetBeansProjects\PHPUnit\phpunit\tests\Regression\GitHub\873\Issue873Test.php:7
Stack trace:
#0 phar://C:/phpbin/phpunit.phar/phpunit/Util/Fileloader.php(52): include_once()
#1 phar://C:/phpbin/phpunit.phar/phpunit/Util/Fileloader.php(36): PHPUnit_Util_Fileloader::load('C:\Users\jody\D...')
#2 phar://C:/phpbin/phpunit.phar/phpunit/Framework/TestSuite.php(334): PHPUnit_Util_Fileloader::checkAndLoad('C:\Users\jody\D...')
#3 phar://C:/phpbin/phpunit.phar/phpunit/Framework/TestSuite.php(406): PHPUnit_Framework_TestSuite->addTestFile('C:\Users\jody\D...')
#4 phar://C:/phpbin/phpunit.phar/phpunit/Runner/BaseTestRunner.php(57): PHPUnit_Framework_TestSuite->addTestFiles(Array)
#5 phar://C:/phpbin/phpunit.phar/phpunit/TextUI/Command.php(121): PHPUnit_Runner_BaseTestRunner->getTest('.\tests\', '', Array)
#6 phar://C:/phpbin/phpunit.phar/phpunit/TextUI/Command.php(99): PHPUnit_TextU in C:\Users\jody\Documents\NetBeansProjects\PHPUnit\phpunit\tests\Regression\GitHub\873\Issue873Test.php on line 7
What am I doing wrong? Thanks
If your class "Success" have a namespace, you better use your autoloader with phpunit's --bootstrap parameter
if this situation is related with autoloading, you maybe want to read http://jes.st/2011/phpunit-bootstrap-and-autoloading-classes/ (an old one, but a clear one)
I am using a extension of import/export products in OpenCart but there is an error when i used it on window.
Fatal error: Uncaught exception 'Exception' with message 'Could not
open C:\Windows\Temp\php479C.tmp for reading! File does not exist.' in
C:\Inetpub\vhosts\webwhisperer.com.au\watermark\system\PHPExcel\Classes\PHPExcel\Reader\Excel2007.php:168
Stack trace: #0
C:\Inetpub\vhosts\webwhisperer.com.au\watermark\system\PHPExcel\Classes\PHPExcel\IOFactory.php(269):
PHPExcel_Reader_Excel2007->canRead('C:\Windows\Temp...') #1
C:\Inetpub\vhosts\webwhisperer.com.au\watermark\system\PHPExcel\Classes\PHPExcel\IOFactory.php(207):
PHPExcel_IOFactory::createReaderForFile('C:\Windows\Temp...') #2
C:\Inetpub\vhosts\webwhisperer.com.au\watermark\admin\model\catalog\productimportexport.php(1208):
PHPExcel_IOFactory::identify('C:\Windows\Temp...') #3
C:\Inetpub\vhosts\webwhisperer.com.au\watermark\admin\controller\catalog\productimportexport.php(352):
ModelCatalogProductImportExport->upload('C:\Windows\Temp...', '1') #4
[internal function]: ControllerCatalogProductImportExport->bulk() #5
C:\Inetpub\vhosts\webwhisperer.com.au\watermark\vqmod\ in
C:\Inetpub\vhosts\webwhisperer.com.au\watermark\system\PHPExcel\Classes\PHPExcel\Reader\Excel2007.php
on line 168 Fatal Error: Uncaught exception 'Exception' with message
'Could not open C:\Windows\Temp\php479C.tmp for reading! File does not
exist.' in
C:\Inetpub\vhosts\webwhisperer.com.au\watermark\system\PHPExcel\Classes\PHPExcel\Reader\Excel2007.php:168
Stack trace: #0
C:\Inetpub\vhosts\webwhisperer.com.au\watermark\system\PHPExcel\Classes\PHPExcel\IOFactory.php(269):
PHPExcel_Reader_Excel2007->canRead('C:\Windows\Temp...') #1
C:\Inetpub\vhosts\webwhisperer.com.au\watermark\system\PHPExcel\Classes\PHPExcel\IOFactory.php(207):
PHPExcel_IOFactory::createReaderForFile('C:\Windows\Temp...') #2
C:\Inetpub\vhosts\webwhisperer.com.au\watermark\admin\model\catalog\productimportexport.php(1208):
PHPExcel_IOFactory::identify('C:\Windows\Temp...') #3
C:\Inetpub\vhosts\webwhisperer.com.au\watermark\admin\controller\catalog\productimportexport.php(352):
ModelCatalogProductImportExport->upload('C:\Windows\Temp...', '1') #4
[internal function]: ControllerCatalogProductImportExport->bulk() #5
C:\Inetpub\vhosts\webwhisperer.com.au\watermark\vqmod\ in
C:\Inetpub\vhosts\webwhisperer.com.au\watermark\system\PHPExcel\Classes\PHPExcel\Reader\Excel2007.php
on line 168
Does anyone know what's the Problem here ..thanks in advance
The top of the stack trace tells you the answer:
Could not open C:\Windows\Temp\php479C.tmp for reading! File does not exist.
The PHPExcel class is unable to open that file as it does not exist. Looking at the stack trace, this is being uploaded by the 'upload' method of the ModelCatalogProductImportExport object. I would ensure that this function is correctly importing the file, and saving it to the correct directory before running the PHPExcel class functions over the file.