http://pms.cmet.ustc.edu.cn/applicant/project/edit/4599

Exceptions

Expected argument of type "string", "null" given at property path "name".

Exceptions 2

Symfony\Component\PropertyAccess\Exception\ InvalidArgumentException

  1.             $pos += \strlen($delim);
  2.             $j strpos($message','$pos);
  3.             $type substr($message$jstrpos($message' given'$j) - $j 2);
  4.             $message substr($message$pos$j $pos);
  5.             throw new InvalidArgumentException(sprintf('Expected argument of type "%s", "%s" given at property path "%s".'$message'NULL' === $type 'null' $type$propertyPath), 0$previous);
  6.         }
  7.         if (preg_match('/^\S+::\S+\(\): Argument #\d+ \(\$\S+\) must be of type (\S+), (\S+) given/'$message$matches)) {
  8.             [, $expectedType$actualType] = $matches;
in vendor/symfony/property-access/PropertyAccessor.php :: throwInvalidArgumentException (line 179)
  1.             try {
  2.                 $this->writeProperty($zval$propertyPath$value);
  3.                 return;
  4.             } catch (\TypeError $e) {
  5.                 self::throwInvalidArgumentException($e->getMessage(), $e->getTrace(), 0$propertyPath$e);
  6.                 // It wasn't thrown in this class so rethrow it
  7.                 throw $e;
  8.             }
  9.         }
  1.         }
  2.         // If the data is identical to the value in $data, we are
  3.         // dealing with a reference
  4.         if (!\is_object($data) || !$form->getConfig()->getByReference() || $propertyValue !== $this->getPropertyValue($data$propertyPath)) {
  5.             $this->propertyAccessor->setValue($data$propertyPath$propertyValue);
  6.         }
  7.     }
  8.     /**
  9.      * {@inheritdoc}
  1.      */
  2.     public function setValue(&$data$valueFormInterface $form): void
  3.     {
  4.         foreach ($this->accessors as $accessor) {
  5.             if ($accessor->isWritable($data$form)) {
  6.                 $accessor->setValue($data$value$form);
  7.                 return;
  8.             }
  9.         }
  1.             $config $form->getConfig();
  2.             // Write-back is disabled if the form is not synchronized (transformation failed),
  3.             // if the form was not submitted and if the form is disabled (modification not allowed)
  4.             if ($config->getMapped() && $form->isSubmitted() && $form->isSynchronized() && !$form->isDisabled() && $this->dataAccessor->isWritable($data$form)) {
  5.                 $this->dataAccessor->setValue($data$form->getData(), $form);
  6.             }
  7.         }
  8.     }
  9. }
in vendor/symfony/form/Form.php -> mapFormsToData (line 642)
  1.                     // Use InheritDataAwareIterator to process children of
  2.                     // descendants that inherit this form's data.
  3.                     // These descendants will not be submitted normally (see the check
  4.                     // for $this->config->getInheritData() above)
  5.                     $this->config->getDataMapper()->mapFormsToData(
  6.                         new \RecursiveIteratorIterator(new InheritDataAwareIterator($this->children)),
  7.                         $viewData
  8.                     );
  9.                 }
  10.                 // Normalize data to unified representation
  1.         // Don't auto-submit the form unless at least one field is present.
  2.         if ('' === $name && \count(array_intersect_key($data$form->all())) <= 0) {
  3.             return;
  4.         }
  5.         $form->submit($data'PATCH' !== $method);
  6.     }
  7.     /**
  8.      * {@inheritdoc}
  9.      */
in vendor/symfony/form/Form.php -> handleRequest (line 503)
  1.     /**
  2.      * {@inheritdoc}
  3.      */
  4.     public function handleRequest($request null)
  5.     {
  6.         $this->config->getRequestHandler()->handleRequest($this$request);
  7.         return $this;
  8.     }
  9.     /**
Form->handleRequest() in src/Controller/Applicant/ProjectController.php (line 119)
  1.     protected function doEdit(Project $projectRequest $requestEntityManagerInterface $emBatch $batch): Response
  2.     {
  3.         $title $project->getId() ? '编辑' '提交材料';
  4.         $form $this->createForm(ProjectType::class, $project);
  5.         $form->handleRequest($request);
  6.         if ($form->isSubmitted() && $form->isValid()) {
  7.             $em->persist($project);
  8.             $em->flush();
  9.             $this->addFlash('notice''操作成功');
ProjectController->doEdit() in src/Controller/Applicant/ProjectController.php (line 64)
  1.      * @Route("edit/{id}", name="edit", requirements={"id"="\d+"})
  2.      */
  3.     public function edit(Request $requestEntityManagerInterface $emProject $project): Response
  4.     {
  5.         $this->denyAccessUnlessGranted(ProjectVoter::APPLICANT_EDIT$project);
  6.         return $this->doEdit($project$request$em$project->getBatch());
  7.     }
  8.     /**
  9.      *
  10.      * @Route("delete/{id}", name="delete", requirements={"id"="\d+"})
  1.         $this->dispatcher->dispatch($eventKernelEvents::CONTROLLER_ARGUMENTS);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response $controller(...$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new ViewEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch($eventKernelEvents::VIEW);
  1.     {
  2.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  3.         $this->requestStack->push($request);
  4.         try {
  5.             return $this->handleRaw($request$type);
  6.         } catch (\Exception $e) {
  7.             if ($e instanceof RequestExceptionInterface) {
  8.                 $e = new BadRequestHttpException($e->getMessage(), $e);
  9.             }
  10.             if (false === $catch) {
  1.         $this->boot();
  2.         ++$this->requestStackSize;
  3.         $this->resetServices true;
  4.         try {
  5.             return $this->getHttpKernel()->handle($request$type$catch);
  6.         } finally {
  7.             --$this->requestStackSize;
  8.         }
  9.     }
  1.         $this->request $request;
  2.     }
  3.     public function run(): int
  4.     {
  5.         $response $this->kernel->handle($this->request);
  6.         $response->send();
  7.         if ($this->kernel instanceof TerminableInterface) {
  8.             $this->kernel->terminate($this->request$response);
  9.         }
in vendor/autoload_runtime.php -> run (line 35)
  1. $app $app(...$args);
  2. exit(
  3.     $runtime
  4.         ->getRunner($app)
  5.         ->run()
  6. );
require_once('/home/projects/pms/vendor/autoload_runtime.php') in public/index.php (line 5)
  1. <?php
  2. use App\Kernel;
  3. require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
  4. return function (array $context) {
  5.     return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
  6. };

TypeError

Argument 1 passed to App\Entity\Project::setName() must be of the type string, null given, called in /home/projects/pms/vendor/symfony/property-access/PropertyAccessor.php on line 591

  1.     public function getName(): string
  2.     {
  3.         return $this->name;
  4.     }
  5.     public function setName(string $name): void
  6.     {
  7.         $this->name $name;
  8.     }
  9.     public function __toString(): string
  1.         if (PropertyWriteInfo::TYPE_NONE !== $mutator->getType()) {
  2.             $type $mutator->getType();
  3.             if (PropertyWriteInfo::TYPE_METHOD === $type) {
  4.                 $object->{$mutator->getName()}($value);
  5.             } elseif (PropertyWriteInfo::TYPE_PROPERTY === $type) {
  6.                 $object->{$mutator->getName()} = $value;
  7.             } elseif (PropertyWriteInfo::TYPE_ADDER_AND_REMOVER === $type) {
  8.                 $this->writeCollection($zval$property$value$mutator->getAdderInfo(), $mutator->getRemoverInfo());
  9.             }
  1.             $zval = [
  2.                 self::VALUE => $objectOrArray,
  3.             ];
  4.             try {
  5.                 $this->writeProperty($zval$propertyPath$value);
  6.                 return;
  7.             } catch (\TypeError $e) {
  8.                 self::throwInvalidArgumentException($e->getMessage(), $e->getTrace(), 0$propertyPath$e);
  9.                 // It wasn't thrown in this class so rethrow it
  1.         }
  2.         // If the data is identical to the value in $data, we are
  3.         // dealing with a reference
  4.         if (!\is_object($data) || !$form->getConfig()->getByReference() || $propertyValue !== $this->getPropertyValue($data$propertyPath)) {
  5.             $this->propertyAccessor->setValue($data$propertyPath$propertyValue);
  6.         }
  7.     }
  8.     /**
  9.      * {@inheritdoc}
  1.      */
  2.     public function setValue(&$data$valueFormInterface $form): void
  3.     {
  4.         foreach ($this->accessors as $accessor) {
  5.             if ($accessor->isWritable($data$form)) {
  6.                 $accessor->setValue($data$value$form);
  7.                 return;
  8.             }
  9.         }
  1.             $config $form->getConfig();
  2.             // Write-back is disabled if the form is not synchronized (transformation failed),
  3.             // if the form was not submitted and if the form is disabled (modification not allowed)
  4.             if ($config->getMapped() && $form->isSubmitted() && $form->isSynchronized() && !$form->isDisabled() && $this->dataAccessor->isWritable($data$form)) {
  5.                 $this->dataAccessor->setValue($data$form->getData(), $form);
  6.             }
  7.         }
  8.     }
  9. }
in vendor/symfony/form/Form.php -> mapFormsToData (line 642)
  1.                     // Use InheritDataAwareIterator to process children of
  2.                     // descendants that inherit this form's data.
  3.                     // These descendants will not be submitted normally (see the check
  4.                     // for $this->config->getInheritData() above)
  5.                     $this->config->getDataMapper()->mapFormsToData(
  6.                         new \RecursiveIteratorIterator(new InheritDataAwareIterator($this->children)),
  7.                         $viewData
  8.                     );
  9.                 }
  10.                 // Normalize data to unified representation
  1.         // Don't auto-submit the form unless at least one field is present.
  2.         if ('' === $name && \count(array_intersect_key($data$form->all())) <= 0) {
  3.             return;
  4.         }
  5.         $form->submit($data'PATCH' !== $method);
  6.     }
  7.     /**
  8.      * {@inheritdoc}
  9.      */
in vendor/symfony/form/Form.php -> handleRequest (line 503)
  1.     /**
  2.      * {@inheritdoc}
  3.      */
  4.     public function handleRequest($request null)
  5.     {
  6.         $this->config->getRequestHandler()->handleRequest($this$request);
  7.         return $this;
  8.     }
  9.     /**
Form->handleRequest() in src/Controller/Applicant/ProjectController.php (line 119)
  1.     protected function doEdit(Project $projectRequest $requestEntityManagerInterface $emBatch $batch): Response
  2.     {
  3.         $title $project->getId() ? '编辑' '提交材料';
  4.         $form $this->createForm(ProjectType::class, $project);
  5.         $form->handleRequest($request);
  6.         if ($form->isSubmitted() && $form->isValid()) {
  7.             $em->persist($project);
  8.             $em->flush();
  9.             $this->addFlash('notice''操作成功');
ProjectController->doEdit() in src/Controller/Applicant/ProjectController.php (line 64)
  1.      * @Route("edit/{id}", name="edit", requirements={"id"="\d+"})
  2.      */
  3.     public function edit(Request $requestEntityManagerInterface $emProject $project): Response
  4.     {
  5.         $this->denyAccessUnlessGranted(ProjectVoter::APPLICANT_EDIT$project);
  6.         return $this->doEdit($project$request$em$project->getBatch());
  7.     }
  8.     /**
  9.      *
  10.      * @Route("delete/{id}", name="delete", requirements={"id"="\d+"})
  1.         $this->dispatcher->dispatch($eventKernelEvents::CONTROLLER_ARGUMENTS);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response $controller(...$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new ViewEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch($eventKernelEvents::VIEW);
  1.     {
  2.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  3.         $this->requestStack->push($request);
  4.         try {
  5.             return $this->handleRaw($request$type);
  6.         } catch (\Exception $e) {
  7.             if ($e instanceof RequestExceptionInterface) {
  8.                 $e = new BadRequestHttpException($e->getMessage(), $e);
  9.             }
  10.             if (false === $catch) {
  1.         $this->boot();
  2.         ++$this->requestStackSize;
  3.         $this->resetServices true;
  4.         try {
  5.             return $this->getHttpKernel()->handle($request$type$catch);
  6.         } finally {
  7.             --$this->requestStackSize;
  8.         }
  9.     }
  1.         $this->request $request;
  2.     }
  3.     public function run(): int
  4.     {
  5.         $response $this->kernel->handle($this->request);
  6.         $response->send();
  7.         if ($this->kernel instanceof TerminableInterface) {
  8.             $this->kernel->terminate($this->request$response);
  9.         }
in vendor/autoload_runtime.php -> run (line 35)
  1. $app $app(...$args);
  2. exit(
  3.     $runtime
  4.         ->getRunner($app)
  5.         ->run()
  6. );
require_once('/home/projects/pms/vendor/autoload_runtime.php') in public/index.php (line 5)
  1. <?php
  2. use App\Kernel;
  3. require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
  4. return function (array $context) {
  5.     return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
  6. };

Stack Traces 2

[2/2] InvalidArgumentException
Symfony\Component\PropertyAccess\Exception\InvalidArgumentException:
Expected argument of type "string", "null" given at property path "name".

  at vendor/symfony/property-access/PropertyAccessor.php:268
  at Symfony\Component\PropertyAccess\PropertyAccessor::throwInvalidArgumentException()
     (vendor/symfony/property-access/PropertyAccessor.php:179)
  at Symfony\Component\PropertyAccess\PropertyAccessor->setValue()
     (vendor/symfony/form/Extension/Core/DataAccessor/PropertyPathAccessor.php:69)
  at Symfony\Component\Form\Extension\Core\DataAccessor\PropertyPathAccessor->setValue()
     (vendor/symfony/form/Extension/Core/DataAccessor/ChainAccessor.php:54)
  at Symfony\Component\Form\Extension\Core\DataAccessor\ChainAccessor->setValue()
     (vendor/symfony/form/Extension/Core/DataMapper/DataMapper.php:87)
  at Symfony\Component\Form\Extension\Core\DataMapper\DataMapper->mapFormsToData()
     (vendor/symfony/form/Form.php:642)
  at Symfony\Component\Form\Form->submit()
     (vendor/symfony/form/Extension/HttpFoundation/HttpFoundationRequestHandler.php:110)
  at Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler->handleRequest()
     (vendor/symfony/form/Form.php:503)
  at Symfony\Component\Form\Form->handleRequest()
     (src/Controller/Applicant/ProjectController.php:119)
  at App\Controller\Applicant\ProjectController->doEdit()
     (src/Controller/Applicant/ProjectController.php:64)
  at App\Controller\Applicant\ProjectController->edit()
     (vendor/symfony/http-kernel/HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35)
  at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
     (vendor/autoload_runtime.php:35)
  at require_once('/home/projects/pms/vendor/autoload_runtime.php')
     (public/index.php:5)                
[1/2] TypeError
TypeError:
Argument 1 passed to App\Entity\Project::setName() must be of the type string, null given, called in /home/projects/pms/vendor/symfony/property-access/PropertyAccessor.php on line 591

  at src/Entity/Traits/NameMethodTrait.php:16
  at App\Entity\Project->setName()
     (vendor/symfony/property-access/PropertyAccessor.php:591)
  at Symfony\Component\PropertyAccess\PropertyAccessor->writeProperty()
     (vendor/symfony/property-access/PropertyAccessor.php:175)
  at Symfony\Component\PropertyAccess\PropertyAccessor->setValue()
     (vendor/symfony/form/Extension/Core/DataAccessor/PropertyPathAccessor.php:69)
  at Symfony\Component\Form\Extension\Core\DataAccessor\PropertyPathAccessor->setValue()
     (vendor/symfony/form/Extension/Core/DataAccessor/ChainAccessor.php:54)
  at Symfony\Component\Form\Extension\Core\DataAccessor\ChainAccessor->setValue()
     (vendor/symfony/form/Extension/Core/DataMapper/DataMapper.php:87)
  at Symfony\Component\Form\Extension\Core\DataMapper\DataMapper->mapFormsToData()
     (vendor/symfony/form/Form.php:642)
  at Symfony\Component\Form\Form->submit()
     (vendor/symfony/form/Extension/HttpFoundation/HttpFoundationRequestHandler.php:110)
  at Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler->handleRequest()
     (vendor/symfony/form/Form.php:503)
  at Symfony\Component\Form\Form->handleRequest()
     (src/Controller/Applicant/ProjectController.php:119)
  at App\Controller\Applicant\ProjectController->doEdit()
     (src/Controller/Applicant/ProjectController.php:64)
  at App\Controller\Applicant\ProjectController->edit()
     (vendor/symfony/http-kernel/HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35)
  at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
     (vendor/autoload_runtime.php:35)
  at require_once('/home/projects/pms/vendor/autoload_runtime.php')
     (public/index.php:5)