1 exception(s): Exception #0 (Exception): Deprecated Functionality: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in E:\xampp\htdocs\magento\vendor\magento\framework\View\Element\Template\File\Validator.php on line 141
Exception #0 (Exception): Deprecated Functionality: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in E:\xampp\htdocs\magento\vendor\magento\framework\View\Element\Template\File\Validator.php on line 141
#1 strpos('E:\xampp\htdocs\...', false) called at [vendor\magento\framework\View\Element\Template\File\Validator.php:141]
#2 Magento\Framework\View\Element\Template\File\Validator->isPathInDirectories('E:/xampp/htdocs/...', array('E:/xampp/htdocs/...')) called at [vendor\magento\framework\View\Element\Template\File\Validator.php:117]
#3 Magento\Framework\View\Element\Template\File\Validator->isValid('E:/xampp/htdocs/...') called at [vendor\magento\framework\View\Element\Template.php:268]
#4 Magento\Framework\View\Element\Template->fetchView('E:/xampp/htdocs/...') called at [vendor\magento\framework\View\Element\Template.php:301]
#5 Magento\Framework\View\Element\Template->_toHtml() called at [vendor\magento\framework\View\Element\AbstractBlock.php:1100]
#6 Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}() called at [vendor\magento\framework\View\Element\AbstractBlock.php:1104]
#7 Magento\Framework\View\Element\AbstractBlock->_loadCache() called at [vendor\magento\framework\View\Element\AbstractBlock.php:674]
#8 Magento\Framework\View\Element\AbstractBlock->toHtml() called at [vendor\magento\framework\View\Result\Page.php:249]
#9 Magento\Framework\View\Result\Page->render(&Magento\Framework\App\Response\Http\Interceptor#0000000065a055b9000000007e9c8a07#) called at [vendor\magento\framework\View\Result\Layout.php:171]
#10 Magento\Framework\View\Result\Layout->renderResult(&Magento\Framework\App\Response\Http\Interceptor#0000000065a055b9000000007e9c8a07#) called at [vendor\magento\framework\Interception\Interceptor.php:58]
#11 Magento\Framework\View\Result\Page\Interceptor->___callParent('renderResult', array(&Magento\Framework\App\Response\Http\Interceptor#0000000065a055b9000000007e9c8a07#)) called at [vendor\magento\framework\Interception\Interceptor.php:138]
#12 Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Response\Http\Interceptor#0000000065a055b9000000007e9c8a07#) called at [vendor\magento\framework\Interception\Interceptor.php:153]
#13 Magento\Framework\View\Result\Page\Interceptor->___callPlugins('renderResult', array(&Magento\Framework\App\Response\Http\Interceptor#0000000065a055b9000000007e9c8a07#), array(array('result-messages', 'result-builtin-c...', 'result-varnish-c...'))) called at [generated\code\Magento\Framework\View\Result\Page\Interceptor.php:130]
#14 Magento\Framework\View\Result\Page\Interceptor->renderResult(&Magento\Framework\App\Response\Http\Interceptor#0000000065a055b9000000007e9c8a07#) called at [vendor\magento\framework\App\Http.php:120]
#15 Magento\Framework\App\Http->launch() called at [generated\code\Magento\Framework\App\Http\Interceptor.php:24]
#16 Magento\Framework\App\Http\Interceptor->launch() called at [vendor\magento\framework\App\Bootstrap.php:261]
#17 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#0000000065a055a2000000007e9c8a07#) called at [index.php:39]
-
Please clear your question what want you.Mohit Patel– Mohit Patel2020年07月29日 12:22:10 +00:00Commented Jul 29, 2020 at 12:22
-
Are you using PHP V 7.3? What is your Magento version?Bhaumik Upadhyay– Bhaumik Upadhyay2020年07月29日 12:31:52 +00:00Commented Jul 29, 2020 at 12:31
-
PHP V 7.3 and Magento ver. 2.3.5-p1Prashant Maurya– Prashant Maurya2020年07月29日 13:49:10 +00:00Commented Jul 29, 2020 at 13:49
-
@PrashantMaurya Have you tried the solution? Does it work for you?Bhaumik Upadhyay– Bhaumik Upadhyay2020年07月31日 08:25:32 +00:00Commented Jul 31, 2020 at 8:25
2 Answers 2
If a needle is not a string, it is converted to an integer and applied as the ordinal value of a character. This behavior is deprecated as of PHP 7.3.0, and relying on it is highly discouraged. As mentioned in the official document of PHP.
Also check here: https://www.php.net/manual/en/migration73.deprecated.php
Solution: If possible then switch to PHP 7.2 as seems there's still Magento 2.3.5-p1 has an issue with PHP 7.3.
Hope this helps!
Whenever I get this issue on Windows dev stack I neeed to rewrite in
vendor/magento/framework/View/Element/Template/File/Validator.php
the isPathInDirectories method with the following :
protected function isPathInDirectories($path, $directories)
{
if (!is_array($directories)) {
$directories = (array)$directories;
}
$isWin = 'WIN' === strtoupper(substr(PHP_OS, 0, 3)); /** @var bool $isWin */
$realPath = $this->fileDriver->getRealPath($path); /** @var string $realPath */
foreach ($directories as $directory) {
if (0 === strpos($realPath, !$isWin ? $directory : str_replace('/', DIRECTORY_SEPARATOR, $directory))) {
return true;
}
}
return false;
}