Laravel Missing argument 4 for Dingo\Blueprint\Blueprint::generate() - laravel

[ErrorException]
Missing argument 4 for Dingo\Blueprint\Blueprint::generate(), called in /Applications/XAMPP/xamppfiles/htdocs/api/vendor/dingo/api/src/Console/Command/Docs.php
on line 95 and defined
Exception trace:
() at /Applications/XAMPP/xamppfiles/htdocs/api/vendor/dingo/blueprint/src/Blueprint.php:83
Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at /Applications/XAMPP/xamppfiles/htdocs/api/vendor/dingo/blueprint/src/Blueprint.php:83
Dingo\Blueprint\Blueprint->generate() at /Applications/XAMPP/xamppfiles/htdocs/api/vendor/dingo/api/src/Console/Command/Docs.php:95
Dingo\Api\Console\Command\Docs->handle() at n/a:n/a
call_user_func_array() at /Applications/XAMPP/xamppfiles/htdocs/api/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
Illuminate\Container\Container->call() at /Applications/XAMPP/xamppfiles/htdocs/api/vendor/laravel/framework/src/Illuminate/Console/Command.php:150
Illuminate\Console\Command->execute() at /Applications/XAMPP/xamppfiles/htdocs/api/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at /Applications/XAMPP/xamppfiles/htdocs/api/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
Illuminate\Console\Command->run() at /Applications/XAMPP/xamppfiles/htdocs/api/vendor/symfony/console/Application.php:841
Symfony\Component\Console\Application->doRunCommand() at /Applications/XAMPP/xamppfiles/htdocs/api/vendor/symfony/console/Application.php:189
Symfony\Component\Console\Application->doRun() at /Applications/XAMPP/xamppfiles/htdocs/api/vendor/symfony/console/Application.php:120
Symfony\Component\Console\Application->run() at /Applications/XAMPP/xamppfiles/htdocs/api/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107
Illuminate\Foundation\Console\Kernel->handle() at /Applications/XAMPP/xamppfiles/htdocs/api/artisan:36

This has been resolved in the master branch of Dingo API, try pulling this into your development.
IncludePath wasn't included as the 4th parameter in Dingo\Blueprint\Blueprint::generate() function call. Here is the link to the updated file on the master branch.

Kevin's solution does not work for me. ( with laravel 5.1 )
after replacement of Docs.php, I got errors with Blueprint class.
So:
In place of Kevin's solution. I found a simple one which works in one second.
:)
modify file:
vendor/dingo/api/src/Console/Command/Docs.php
$contents = $this->blueprint->generate($this->getControllers(), $this->argument('name'), $this->argument('version'));
with the following code:
$contents = $this->blueprint->generate($this->getControllers(), $this->argument('name'), $this->argument('version'),'');
by just adding a ,'' at the end of the function call, the place of the fourth argument.

Related

FPDF Including an image in fancytable

I'm trying to insert an image in a FPDF fancytable.
I tried to put inside the fancytable function the following :
$this->Cell($w[1],6,$pdf->Image('lettre.jpg',0,0,20,0),'LRB',0,'C',$fill);
but I have (of course) the following error message :
PHP Notice: Undefined variable: pdf in /MyScript.php on line 143
Notice: Undefined variable: pdf in /MyScript.php on line 143
PHP Fatal error: Uncaught Error: Call to a member function Image() on
null in /MyScript.php:143
Stack trace:
0 /MyScript.php(172): PDF->FancyTable(Array, Array)
1 {main} thrown in /MyScript.php on line 143
I understand that I call the pdf function inside the fancytable function (part of the pdf function), so do I have a solution ?
Thanks !
Damn, the answer was in the question : just replaced $pdf by $this and it fixed my problem..
I let the question here just in case somebody have the same error one day ^^

Magento 2 invalid template exception just after installation

I have installed the Magento 2.0 platform on my localhost today. After completing all the setup and installation, when I tried to open the admin panel, it was showing a brown blank screen. When I switched to the developer mode, it is showing an invalid template error for require_js.phtml. The complete error is :
1 exception(s):
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'C:/xampp/htdocs/magento_demo/vendor/magento/module-backend/view/adminhtml/templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js'
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'C:/xampp/htdocs/magento_demo/vendor/magento/module-backend/view/adminhtml/templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js'
#0 C:\xampp\htdocs\magento_demo\vendor\magento\framework\View\Element\Template.php(301): Magento\Framework\View\Element\Template->fetchView('C:/xampp/htdocs...')
#1 C:\xampp\htdocs\magento_demo\vendor\magento\framework\View\Element\AbstractBlock.php(668): Magento\Framework\View\Element\Template->_toHtml()
#2 C:\xampp\htdocs\magento_demo\vendor\magento\framework\View\Result\Page.php(249): Magento\Framework\View\Element\AbstractBlock->toHtml()
#3 C:\xampp\htdocs\magento_demo\vendor\magento\framework\View\Result\Layout.php(171): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor))
#4 C:\xampp\htdocs\magento_demo\generated\code\Magento\Backend\Model\View\Result\Page\Interceptor.php(193): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#5 C:\xampp\htdocs\magento_demo\vendor\magento\framework\App\Http.php(139): Magento\Backend\Model\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#6 C:\xampp\htdocs\magento_demo\generated\code\Magento\Framework\App\Http\Interceptor.php(24): Magento\Framework\App\Http->launch()
#7 C:\xampp\htdocs\magento_demo\vendor\magento\framework\App\Bootstrap.php(258): Magento\Framework\App\Http\Interceptor->launch()
#8 C:\xampp\htdocs\magento_demo\index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#9 {main}
I have never used Magento before and have no idea what the issue is or how to solve it. Can anyone tell me what to do to solve the issue?
You can execute composer update from project root it will update all missing dependencies.
Other then this it you can flush Magento cache and re deploy static content, follow these steps:
1) php bin/magento cache:flush or (sudo rm -rf <magento-root>/var/generated/* <magento-root>/pub/static/*)
2) php bin/magento setup:static-content:deploy
Now clean you browser cache and reload the page.
Yes, This is the problem with windows. Windows uses "" as separator, the array "directories" contains entries with "/" as separator, so the check will always fail. So you need to fix this by replacing the separator in core file:
Magento\Framework\View\Element\Template\File\Validator
function isPathInDirectories replace below code in isPathInDirectories function
$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
How to fix Invalid template file error in Magento2 after version upgrade?
In case of windows, just replace this function isPathInDirectories in vendor/magento/framework/view/element/template/file/validator.php
protected function isPathInDirectories($path, $directories)
{
$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
if (!is_array($directories)) {
$directories = (array)$directories;
}
foreach ($directories as $directory) {
if (0 === strpos($realPath, $directory)) {
return true;
}
}
return false;
}

php, postgresql and phppgadmin: errors after changes made to files

I was getting deprecated constructor error when I tried installing postgres with xampp. Though I was able to resolve those issues but I am unable to solve the one below. Kindly help to solve this.
Fatal error: Uncaught Error: Call to undefined method ADORecordSet_postgres7::ADORecordSet_postgres64() in C:\xampp\phppgadmin\libraries\adodb\drivers\adodb-postgres7.inc.php:220 Stack trace:
#0 C:\xampp\phppgadmin\libraries\adodb\adodb.inc.php(1055): ADORecordSet_postgres7->__construct(Resource id #19, 2)
#1 C:\xampp\phppgadmin\libraries\adodb\adodb.inc.php(1015): ADOConnection->_Execute('select version(...', false)
#2 C:\xampp\phppgadmin\libraries\adodb\adodb.inc.php(1427): ADOConnection->Execute('select version(...', false)
#3 C:\xampp\phppgadmin\libraries\adodb\drivers\adodb-postgres64.inc.php(129): ADOConnection->GetOne('select version(...')
#4 C:\xampp\phppgadmin\libraries\adodb\drivers\adodb-postgres64.inc.php(697): ADODB_postgres64->ServerInfo()
#5 C:\xampp\phppgadmin\libraries\adodb\adodb.inc.php(525): ADODB_postgres64->_connect('host='localhost...', ''postgres'', ''password'', ''template1'')
#6 C:\xampp\phppgadmin\classes\database\Connection.php(42): ADOConnection->Connect('localhost:5432:...', 'postgres', ' in C:\xampp\phppgadmin\libraries\adodb\drivers\adodb-postgres7.inc.php on line 220
You should also change the constructor in adodb-postgres7.inc.php by replacing
function ADODB_postgres7()
with
function __construct()

Call to undefined function Illuminate\Support\random_bytes()

I receive this error message:
FatalErrorException in Str.php line 243: Call to undefined function Illuminate\Support\random_bytes()
public static function randomBytes($length = 16) {
return random_bytes($length);
}
line 243: return random_bytes($length);
I do not understand what's wrong since a working version Laravel offline that extract online.
It does not work online though. I wonder why?
random_bytes is a PHP 7 function.
I'm assuming that your offline/development stack has PHP 7 installed but not online/production.
Confirm your hosting for PHP 7 installed.

Error using PHP_Depend and PHP_PMD

I have a problem using php Depend and PMD. When I use:
pdepend --summary-xml=/home/<mydirectory>/.sonar/pdepend.xml --suffix=php,php3,php4,php5,phtml,inc /home/<mydirectory>
this is the result:
Parsing...
.................................................. 1260
........................PHP Catchable fatal error: Argument 1 passed to PHP_Depend_Parser_UnexpectedTokenException::__construct() must be an instance of PHP_Depend_Token, integer given, called in /usr/share/php/PHP/Depend/Parser.php on line 5444 and defined in /usr/share/php/PHP/Depend/Parser/UnexpectedTokenException.php on line 70
PHP Stack trace:
PHP 1. {main}() /usr/bin/pdepend:0
PHP 2. PHP_Depend_TextUI_Command::main() /usr/bin/pdepend:78
PHP 3. PHP_Depend_TextUI_Command->run() /usr/share/php/PHP/Depend/TextUI/Command.php:679
PHP 4. PHP_Depend_TextUI_Runner->run() /usr/share/php/PHP/Depend/TextUI/Command.php:206
PHP 5. PHP_Depend->analyze() /usr/share/php/PHP/Depend/TextUI/Runner.php:331
PHP 6. PHP_Depend->performParseProcess() /usr/share/php/PHP/Depend.php:306
PHP 7. PHP_Depend_Parser->parse() /usr/share/php/PHP/Depend.php:560
PHP 8. PHP_Depend_Parser->parseOptionalStatement() /usr/share/php/PHP/Depend/Parser.php:370
PHP 9. PHP_Depend_Parser->parseIfStatement() /usr/share/php/PHP/Depend/Parser.php:5474
PHP 10. PHP_Depend_Parser->parseStatementBody() /usr/share/php/PHP/Depend/Parser.php:3195
PHP 11. PHP_Depend_Parser->parseStatement() /usr/share/php/PHP/Depend/Parser.php:2320
PHP 12. PHP_Depend_Parser_UnexpectedTokenException->__construct() /usr/share/php/PHP/Depend/Parser.php:5444
The same happens with:
phpmd /home/<mydirectory> xml /home/<mydirectory>/Sonar_Way_php.xml
PHP Catchable fatal error: Argument 1 passed to PHP_Depend_Parser_UnexpectedTokenException::__construct() must be an instance of PHP_Depend_Token, integer given, called in /usr/share/php/PHP/Depend/Parser.php on line 5444 and defined in /usr/share/php/PHP/Depend/Parser/UnexpectedTokenException.php on line 70
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpmd:0
PHP 2. PHP_PMD_TextUI_Command::main() /usr/bin/phpmd:48
PHP 3. PHP_PMD_TextUI_Command->run() /usr/share/php/PHP/PMD/TextUI/Command.php:151
PHP 4. PHP_PMD->processFiles() /usr/share/php/PHP/PMD/TextUI/Command.php:129
PHP 5. PHP_PMD_Parser->parse() /usr/share/php/PHP/PMD.php:203
PHP 6. PHP_Depend->analyze() /usr/share/php/PHP/PMD/Parser.php:128
PHP 7. PHP_Depend->performParseProcess() /usr/share/php/PHP/Depend.php:306
PHP 8. PHP_Depend_Parser->parse() /usr/share/php/PHP/Depend.php:560
PHP 9. PHP_Depend_Parser->parseOptionalStatement() /usr/share/php/PHP/Depend/Parser.php:370
PHP 10. PHP_Depend_Parser->parseIfStatement() /usr/share/php/PHP/Depend/Parser.php:5474
PHP 11. PHP_Depend_Parser->parseStatementBody() /usr/share/php/PHP/Depend/Parser.php:3195
PHP 12. PHP_Depend_Parser->parseStatement() /usr/share/php/PHP/Depend/Parser.php:2320
PHP 13. PHP_Depend_Parser_UnexpectedTokenException->__construct() /usr/share/php/PHP/Depend/Parser.php:5444
¿Any sugestion? Thanks.
It's a bug of pdepend and pmd. In /usr/share/php/PHP/Depend/parser.php I changed:
private function parseStatement()
{
if (null === ($stmt = $this->parseOptionalStatement())) {
throw new PHP_Depend_Parser_UnexpectedTokenException(
$this->tokenizer->next(),
$this->sourceFile->getFileName()
);
}
return $stmt;
}
for this:
private function parseStatement()
{
if (null === ($stmt = $this->parseOptionalStatement())) {
throw new PHP_Depend_Parser_UnexpectedTokenException(
new PHP_Depend_Token,
$this->sourceFile->getFileName()
);
}
return $stmt;
}
I obtain only warnings and the process continue:
PHP Warning: Missing argument 1 for PHP_Depend_Token::__construct(), called in /usr/share/php/PHP/Depend/Parser.php on line 5442 and defined in /usr/share/php/PHP/Depend/Token.php on line 121
We can wait next upgrade ;)

Resources