duanba4942
duanba4942
2014-11-30 12:59

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 dougai3418 7年前

    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.

    点赞 评论 复制链接分享

相关推荐