Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1392

Enabling both namespaces and autoloading in generated PHP code won't work.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.7
    • 0.8
    • PHP - Compiler
    • None
    • PHP 5.3.2

    • Patch Available

    Description

      Using --gen php:autoload=1,namespace=1 won't work because the generated types don't have namespaces declared and the autoloader pulls in the individual files.

      I've attached a simple patch from the latest SVN trunk that will do two things inside t_php_generator::generate_php_struct_definition:

      • Append namespaces to the top of the file
      • Use the non-backslash-prefixed namespace declaration for the autoloader key

      I'm a little confused as to why there were even namespaces being written into the autoloader array at all when they were prefixed with a backslash, and __autoload receives class names without a leading backslash.

      Attachments

        1. THRIFT-1392.patch
          1 kB
          Mike Riley

        Issue Links

          Activity

            People

              yelirekim Mike Riley
              yelirekim Mike Riley
              Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: