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

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.7
    • Fix Version/s: 0.8
    • Component/s: PHP - Compiler
    • Labels:
      None
    • Environment:

      PHP 5.3.2

    • Patch Info:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: