Класс 'Zend \ Stdlib \ StringUtils' не найден с использованием phpWord и cakephp3 - PullRequest
0 голосов
/ 21 ноября 2018

Я использую cakephp3 с приложением PhpWord, где я просто читаю шаблон и заполняю значения из БД.У меня есть каталог phpoffice в / vendor.Этот точно такой же код работает в Linux, кроме слешей директорий !!!В win10 это не работает, так как я получаю

 Class 'Zend\Stdlib\StringUtils' not found //this file exists in vendor/zendframework/zend-stdlib
 error is from line  $phpWord->setValue("studentname",$studentname);

Я понятия не имею, почему этот код не работает в win10, но работает на сервере Linux

//in controller
use PHPWord;

...

 $template_filename = $assessmentname;
                $template_destname = "$assessmentname-" . $lesson->id . "-" . $student->id;

                $source = getcwd()."\\doc\\templates\\{$template_filename}.docx";
                $template_destfile = $base_dir."{$template_destname}.docx";

                $phpWord = new \PhpOffice\PhpWord\TemplateProcessor($source);
                $phpWord->setValue("studentname",$studentname);  //error is on this line    

                 debug( $source);
                  debug( $phpWord); 

// вывод с отладками доказывает, что phpobject поднят

     \src\Controller\TutorsController.php (line 4176)

    'C:\wamp64\www\crm\webroot\doc\templates\Secondary Maths and English Assessment.docx'

    \src\Controller\TutorsController.php (line 4177)

    object(PhpOffice\PhpWord\TemplateProcessor) {
        [protected] zipClass => object(PhpOffice\PhpWord\Shared\ZipArchive) {
            numFiles => (int) 18
            filename => 'C:\Windows\Temp\Php767D.tmp'
            [private] tempDir => null
            [private] zip => object(ZipArchive) {
                status => (int) 9
                statusSys => (int) 0
                numFiles => (int) 18
                filename => 'C:\Windows\Temp\Php767D.tmp'
                comment => ''
            }
            [private] usePclzip => false
        }
        [protected] tempDocumentFilename => 'C:\Windows\Temp\Php767D.tmp'
        [protected] tempDocumentMainPart => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>




...
I cant embed images but here is the stack trace
Error in: ROOT\vendor\phpoffice\PhpWord\src\PhpWord\TemplateProcessor.php, line 195
( ! ) Xdebug: user triggered in C:\wamp64\www\crm\src\Template\Error\error500.ctp on line 33
Call Stack
#   Time    Memory  Function    Location
1   0.8621  11983648    Cake\Error\BaseErrorHandler->wrapAndHandleException( )  ...\BaseErrorHandler.php:0
2   0.8647  11990088    Cake\Error\BaseErrorHandler->handleException( ) ...\BaseErrorHandler.php:163
3   0.8647  11990088    Cake\Error\ErrorHandler->_displayException( )   ...\BaseErrorHandler.php:179
4   0.8719  12087752    Cake\Error\ExceptionRenderer->render( ) ...\ErrorHandler.php:144
5   0.8762  12293032    Cake\Error\ExceptionRenderer->_outputMessage( ) ...\ExceptionRenderer.php:192
6   0.8928  12541352    Cake\Error\ExceptionRenderer->_outputMessage( ) ...\ExceptionRenderer.php:327
7   0.8928  12541352    Cake\Controller\Controller->render( )   ...\ExceptionRenderer.php:320
8   0.8953  12544904    Cake\View\View->render( )   ...\Controller.php:611
9   0.8976  12545840    Cake\View\View->_render( )  ...\View.php:587
10  0.8980  12546672    Cake\View\View->_evaluate( )    ...\View.php:952
11  0.8994  12577000    include( 'C:\wamp64\www\crm\src\Template\Error\error500.ctp' )  ...\View.php:992
12  0.9033  12594912    xdebug_print_function_stack ( ) ...\error500.ctp:33
...