Results 1 to 5 of 5

Thread: IcePHP__t_type globals

  1. #1
    petteyg359 is offline Registered User
    Name: Gordon Pettey
    Organization: Personal
    Project: CakePHP
    Join Date
    Jan 2011
    Posts
    3

    Exclamation IcePHP__t_type globals

    Ice 3.4.1, PHP 5.3.4

    I am attempting to use Ice to implement a control panel in PHP, using an MVC framework (CakePHP). The nature of the framework prevents Ice's globals (IcePHP__t_bool, IcePHP__t_byte, IcePHP__t_short, IcePHP__t_int, IcePHP__t_long, IcePHP__t_float, IcePHP__t_double, IcePHP__t_string) from working. I could do "global $IcePHP__t_type" for each type in every place I want to use them, but that's far from pretty. Why aren't these enscapulated in the $ICE object created by Ice\initialize()?

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,445
    Hi Gordon,

    Welcome to the forum.

    Can you explain a bit more about the situation in which these globals aren't available? It will help us to ensure we get the necessary changes included in a future release.

    Thanks,
    Mark

  3. #3
    petteyg359 is offline Registered User
    Name: Gordon Pettey
    Organization: Personal
    Project: CakePHP
    Join Date
    Jan 2011
    Posts
    3
    They are available, if I'm willing to litter a dozen global $IcePHP__t_type;s in every file. What is the rationale for making them global? They're specific to Ice, so they should be part of Ice. Make them members of the object created by Ice\initialize(), and I'll pass it as a parameter of every call to the slice object. Or, the inclusion of a slice could be done by the Ice object ($ICE=Ice\initialize(); $ICE->loadSlice('myslice.php'); or some such), and then the slice object knows that the type objects are members of its parent. Either way is better than having a dozen global statements in each file.

  4. #4
    petteyg359 is offline Registered User
    Name: Gordon Pettey
    Organization: Personal
    Project: CakePHP
    Join Date
    Jan 2011
    Posts
    3
    Quote Originally Posted by mes View Post
    Can you explain a bit more about the situation in which these globals aren't available? It will help us to ensure we get the necessary changes included in a future release.
    A simple example, even outside of a framework, with just two pages:

    Code:
    <?php // filename: a.php
    require_once 'Ice_ns.php';
    $ICE = Ice\initialize();
    require_once 'b.php';
    murm();
    Code:
    <?php // filename: b.php
    function murm() {
    require_once 'murmur_slice.php';
    }
    Output:
    ( ! ) Notice: Undefined variable: IcePHP__t_byte in murmur_slice.php on line 26
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Warning: IcePHP_defineSequence() expects parameter 2 to be object, null given in murmur_slice.php on line 26
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3
    4 0.0030 1360496 IcePHP_defineSequence( ) ../murmur_slice.php:26

    ( ! ) Notice: Undefined variable: IcePHP__t_int in murmur_slice.php on line 91
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_int in murmur_slice.php on line 92
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_bool in murmur_slice.php on line 93
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_bool in murmur_slice.php on line 94
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_bool in murmur_slice.php on line 95
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_bool in murmur_slice.php on line 96
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_bool in murmur_slice.php on line 97
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_int in murmur_slice.php on line 98
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_string in murmur_slice.php on line 99
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_int in murmur_slice.php on line 100
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_int in murmur_slice.php on line 101
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_int in murmur_slice.php on line 102
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_string in murmur_slice.php on line 103
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_string in murmur_slice.php on line 104
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_string in murmur_slice.php on line 105
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_string in murmur_slice.php on line 106
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_string in murmur_slice.php on line 107
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_string in murmur_slice.php on line 108
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_bool in murmur_slice.php on line 110
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Notice: Undefined variable: IcePHP__t_int in murmur_slice.php on line 111
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3

    ( ! ) Fatal error: Uncaught exception 'RuntimeException' with message 'no object found in IcePHP_defineStruct()' in murmur_slice.php on line 111
    ( ! ) RuntimeException: no object found in IcePHP_defineStruct() in murmur_slice.php on line 111
    Call Stack
    # Time Memory Function Location
    1 0.0001 639176 {main}( ) ../a.php:0
    2 0.0027 1248152 murm( ) ../a.php:5
    3 0.0029 1360104 require_once( 'murmur_slice.php' ) ../b.php:3
    4 0.0036 1372984 IcePHP_defineStruct( ) ../murmur_slice.php:111
    The only way to make it work is to explicitly global $IcePHP__t_type; in every function Ice is used in. Hopefully a near-future version will make these part of the object returned by initialize().

  5. #5
    dmitry.medvedev's Avatar
    dmitry.medvedev is offline Registered User
    Name: Dmitry N. Medvedev
    Organization: Personal
    Project: Casual Game Analytics Dashboard
    Join Date
    Sep 2005
    Location
    Moscow, Russia
    Posts
    47
    Quote Originally Posted by mes View Post
    Hi Gordon,

    Welcome to the forum.

    Can you explain a bit more about the situation in which these globals aren't available? It will help us to ensure we get the necessary changes included in a future release.

    Thanks,
    Mark
    Mark, actually we've been talking about exactly the same thing as Gordon does. Please, recall our conversation here.

    ...and, if you have a solution, please, share! I'm very, very, very much like the idea of using Ice from PHP on my site!..
    Dmitry N. Medvedev@FaceBook

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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