Professional Web Applications Themes

#25323 [Opn]: class constants odd behavior - PHP Development

ID: 25323 User updated by: cunha17 at uol dot com dot br Reported By: cunha17 at uol dot com dot br Status: Open Bug Type: Zend Engine 2 problem Operating System: RedHat Linux 9.0 PHP Version: 5CVS-2003-08-30 (dev) New Comment: Any information would be appreciated ... Previous Comments: ------------------------------------------------------------------------ [2003-08-30 14:21:48] cunha17 at uol dot com dot br Description: ------------ Is this suppose to work ? Currently it does not. class Priority { const DEBUG = 0; const INFO = 1; const WARN = 2; const ERROR = 3; const FATAL = 4; const MAX_PRIORITY = FATAL; } class ExtendedPriority ...

  1. #1

    Default #25323 [Opn]: class constants odd behavior

    ID: 25323
    User updated by: cunha17 at uol dot com dot br
    Reported By: cunha17 at uol dot com dot br
    Status: Open
    Bug Type: Zend Engine 2 problem
    Operating System: RedHat Linux 9.0
    PHP Version: 5CVS-2003-08-30 (dev)
    New Comment:

    Any information would be appreciated ...


    Previous Comments:
    ------------------------------------------------------------------------

    [2003-08-30 14:21:48] cunha17 at uol dot com dot br

    Description:
    ------------
    Is this suppose to work ? Currently it does not.

    class Priority {
    const DEBUG = 0;
    const INFO = 1;
    const WARN = 2;
    const ERROR = 3;
    const FATAL = 4;

    const MAX_PRIORITY = FATAL;
    }

    class ExtendedPriority extends Priority {
    const REMOTE = Priority::MAX_PRIORITY + 1;
    const URGENT = Priority::MAX_PRIORITY + 2;
    }

    if it's not supposed to work, there is some pr problem in ZE2 that
    accepts a constant expression based on string concatenation.

    Reproduce code:
    ---------------
    class test {
    const TEST = "hi";
    const TEST1 = self::TEST . "ih";
    }


    Expected result:
    ----------------
    No pr error nor core dumps. Or a paser error if it's not supposed
    to work.

    Actual result:
    --------------
    Segmentation Fault


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=25323&edit=1[/url]
    cunha17 at uol dot com dot br Guest

  2. #2

    Default #25323 [Opn]: class constants odd behavior

    ID: 25323
    User updated by: cunha17 at uol dot com dot br
    Reported By: cunha17 at uol dot com dot br
    Status: Open
    Bug Type: Zend Engine 2 problem
    Operating System: RedHat Linux 9.0
    -PHP Version: 5CVS-2003-08-30 (dev)
    +PHP Version: 5CVS-2003-09-20 (dev)
    New Comment:

    This but still exists in the latest CVS(2003-09-20 22:30)
    :-(


    Previous Comments:
    ------------------------------------------------------------------------

    [2003-09-20 18:35:45] lphuberdeau at sympatico dot ca

    I have also experienced this problem. The cvs snapshot I am using is
    around 2 weeks old at this time, the problem might be fixed by now, but
    it's not reported as fixed here, so here are a few more details about
    the problem.

    Information about the server:
    Gentoo Linux
    PHP5 from snaps, built with quite standard extensions.

    I ran a few tests when I saw the segmentation fault in the output of my
    script. I reduced the code as much as possible to locate the error and
    here is what I found out.

    Scripts are called directly from the PHP executable.

    No problem in this code:

    class foo
    {
    const bar = 1;
    }

    Still no problem here:

    class foo
    {
    const bar = 1;
    const odd = foo::bar;
    }

    First error arrives here:
    Fatal error: Unsupported operand types in /home/httpd/htdocs/foo.php on
    line 5

    class foo
    {
    const bar = 1;
    const odd = foo::bar + 10;
    }

    And now with a Segmentation fault:
    class foo
    {
    const bar = 1;
    const odd = foo::bar . 10;
    }

    Summary:
    I think there is a problem with the internal type of the constants.

    I hope these details will help solve the problem.

    ------------------------------------------------------------------------

    [2003-09-10 21:50:47] cunha17 at uol dot com dot br

    Any information would be appreciated ...

    ------------------------------------------------------------------------

    [2003-08-30 14:21:48] cunha17 at uol dot com dot br

    Description:
    ------------
    Is this suppose to work ? Currently it does not.

    class Priority {
    const DEBUG = 0;
    const INFO = 1;
    const WARN = 2;
    const ERROR = 3;
    const FATAL = 4;

    const MAX_PRIORITY = FATAL;
    }

    class ExtendedPriority extends Priority {
    const REMOTE = Priority::MAX_PRIORITY + 1;
    const URGENT = Priority::MAX_PRIORITY + 2;
    }

    if it's not supposed to work, there is some pr problem in ZE2 that
    accepts a constant expression based on string concatenation.

    Reproduce code:
    ---------------
    class test {
    const TEST = "hi";
    const TEST1 = self::TEST . "ih";
    }


    Expected result:
    ----------------
    No pr error nor core dumps. Or a paser error if it's not supposed
    to work.

    Actual result:
    --------------
    Segmentation Fault


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=25323&edit=1[/url]
    cunha17 at uol dot com dot br Guest

Similar Threads

  1. #25323 [Opn->Csd]: class constants odd behavior
    By sniper@php.net in forum PHP Development
    Replies: 0
    Last Post: October 16th, 04:04 AM
  2. #25323 [Com]: class constants odd behavior
    By lphuberdeau at sympatico dot ca in forum PHP Development
    Replies: 1
    Last Post: October 16th, 12:05 AM
  3. [PHP-DEV] Accessing child constants from base class
    By Dan Cox in forum PHP Development
    Replies: 15
    Last Post: October 11th, 02:30 PM
  4. [PHP-DEV] class constants bugs
    By Cristiano Duarte in forum PHP Development
    Replies: 2
    Last Post: September 30th, 10:51 PM
  5. PHP5 class constants
    By Cristiano Duarte in forum PHP Development
    Replies: 0
    Last Post: August 10th, 02:27 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139