Page 1 of 1

const definition bug?

PostPosted: January 2nd, 2013, 8:50 am
by pospa
Hi,
I have reached my point of desperate...

I am unable to compile this code:

Code: Select all
class cl_xyz implements base_class
{
    /**
     * URI validate pattern
     */
    const URI_VALIDATE_PATTERN = "/^(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*'()\[\];\/?:@&=+$,])*$/";


I am still geting error like:
Syntax error: unexpected token '"'

What should be wrong?

Pospa

Re: const definition bug?

PostPosted: January 2nd, 2013, 4:24 pm
by Jakub Misek
Hi,

You've found old PHP behaviour - the string contains $ sign, so parser expects a variable and string itself cannot be used as a constant then.

We'll fix this in a future release.

Thanks!

Re: const definition bug?

PostPosted: January 2nd, 2013, 4:51 pm
by Jakub Misek
BTW you can use single quoted string for now.

Re: const definition bug?

PostPosted: January 2nd, 2013, 8:12 pm
by Jakub Misek
Hi, the issue has been fixed, so it is available for those who compile Phalanger from sources at GitHub

https://github.com/DEVSENSE/Phalanger/c ... 94ad312ac8