duanba4942 2014-11-30 12:59
浏览 67
已采纳

Symfony - sonata formBuilder在基于Cygwin的环境中崩溃

I run project on symfony (2.5.7) with sonata (2.3). If I run it under Ubuntu with apache2 and php there is no problem with correct working of forms and all the other parts of symfony. But I want to have the code on Windows with, ability to run bash scripts that doing the job to deploy project correctly. That's why I set up Cygwin with cygserver and apache and php. I managed to run my project on apache for cygwin but every time I open the edit form I get error like that:

The name "s547b06c97e7c79.42607283" contains illegal characters. Names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").
500 Internal Server Error - InvalidArgumentException

And those are 2 last lines from stack trace:

2. at FormConfigBuilder ::validateName ('s547b0ee70b0ac5.07768096') 
in /cygdrive/c/xampp/htdocs/wzp/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigBuilder.php at line 193 
3. at FormConfigBuilder ->__construct ('s547b0ee70b0ac5.07768096', 'Backend\PoiBundle\Entity\Obiektydziedzictwa', object(EventDispatcher), array('block_name' => null, 'disabled' => false, 'label' => null, 'attr' => array(), 'translation_domain' => null, 'auto_initialize' => true, 'empty_data' => object(Closure), 'trim' => true, 'required' => true, 'read_only' => false, 'max_length' => null, 'pattern' => null, 'property_path' => null, 'mapped' => true, 'by_reference' => true, 'error_bubbling' => true, 'label_attr' => array(), 'virtual' => null, 'inherit_data' => false, 'compound' => true, 'method' => 'POST', 'action' => '', 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', 'validation_groups' => null, 'error_mapping' => array(), 'constraints' => array(), 'cascade_validation' => false, 'invalid_message' => 'This value is not valid.', 'invalid_message_parameters' => array(), 'extra_fields_message' => 'This form should not contain extra fields.', 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_token_manager' => object(CsrfProviderAdapter), 'csrf_token_id' => null, 'csrf_provider' => object(CsrfTokenManagerAdapter), 'intention' => null, 'sonata_admin' => null, 'sonata_field_description' => null, 'label_render' => true, 'sonata_help' => null, 'horizontal_label_class' => '', 'horizontal_label_offset_class' => '', 'horizontal_input_wrapper_class' => '', 'data_class' => 'Backend\PoiBundle\Entity\Obiektydziedzictwa'))
in /cygdrive/c/xampp/htdocs/wzp/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php at line 51

As I said before, there is no problem with running such function at my application on ubuntu. The cygwin is hosted on Windows 7 64-bit

I didn't configured php.ini despite increasing memory_limit and setting date.timezone.

Theese are my php modules:

bz2.ini          ctype.ini
curl.ini         gd.ini           gmp.ini          gv.ini
iconv.ini        intl.ini         json.ini         mysql.ini
mysqli.ini       pdo_dblib.ini    pdo_mysql.ini    pdo_pgsql.ini
pdo_sqlite.ini   pgsql.ini        phpmodules       pspell.ini
readline.ini     simplexml.ini    sqlite3.ini      tidy.ini
xsl.ini          zlib.ini   

If I run the same project from xampp on windows there is also no such problem as described above.

Does anyone run symfony project under apache + php on cygwin? Any help appreciated.

EDIT If I run cygwin 32-bit (on the same Windows 7 64-bit) I don't get this error. But another problem occurred. Somehow sonata generates paths like:

C:\path\to\the\file\to\be\loaded/file.orm.xml

instead of

/cygdrive/c/path/to/the/file/to/be/loaded/file.orm.xml

Which is the reason why I get an error: There is no such file.

  • 写回答

1条回答 默认 最新

  • dougai3418 2014-12-05 01:04
    关注

    I found out that the problem is PHP for cygwin that is running under Windows 7. PHP generates errors with Filesystem functions. According to PHP documentation some function such as symlink should work as a core functionality in PHP 5.3 for Windows but that depends on Windows version.

    Under Windows 8/8.1 this works like a charm.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么