Bug #75820 [Opn]: Parse error: syntax error, unexpected '?'

From: Date: Mon, 15 Jan 2018 17:55:36 +0000
Subject: Bug #75820 [Opn]: Parse error: syntax error, unexpected '?'
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213554@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75820&edit=1 ID: 75820 User updated by: pyrrahnas at gmail dot com Reported by: pyrrahnas at gmail dot com Summary: Parse error: syntax error, unexpected '?' Status: Open Type: Bug -Package: Variables related +Package: *Programming Data Structures Operating System: Debian Jessie PHP Version: 7.0.27 Block user comment: N Private report: N New Comment: Change package Previous Comments: ------------------------------------------------------------------------ [2018-01-15 17:51:34] spam2 at rhsoft dot net nullable types are a PHP 7.1 feature - why do you assume that works on 7.0.x http://php.net/manual/de/migration71.new-features.php ------------------------------------------------------------------------ [2018-01-15 17:49:12] pyrrahnas at gmail dot com Description: ------------ On Debian Jessie (9) with PHP 7.0.27-0+deb9u1 (cli), it is impossible to use the character '?' in a function declaration. PHP7.0.27 package is the most recent on Debian 9. I have not found a fix :( Test script: --------------- private function addCityField(FormInterface $form, ?Department $department) { $form->add('city', EntityType::class, [ 'class' => 'AppBundle\Entity\City', 'placeholder' => $department ? 'Select your city' : 'Select your department', 'choices' => $department ? $department->getCities() : [] ]); } Expected result: ---------------- Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) Line with problem : "private function addCityField(FormInterface $form, ?Department $department) {" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75820&edit=1

« previous php.bugs (#213554) next »