#40775 [NEW]: __autoload not invoked in cli interactive mode?

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #40775 [NEW]: __autoload not invoked in cli interactive mode?

    From: seanius at debian dot org
    Operating system: Debian GNU/Linux
    PHP version: 5.2.1
    PHP Bug Type: Scripting Engine problem
    Bug description: __autoload not invoked in cli interactive mode?

    Description:
    ------------
    the __autoload hook doesn't seem to be run for the cmdline/cgi versions
    of php when invoked in "interactive" (-a) mode.

    originally reported at [url]http://bugs.debian.org/406264[/url]

    Reproduce code:
    ---------------
    <?php
    function __autoload($class)
    {
    echo $class;// should output class name
    echo 'lol';// should at least print it if it comes into function body
    require($class . '.php');// should break script because of missing file
    }
    // but it will just cause fatal error about missing class :|
    $foo = new Bar(); ?>

    Expected result:
    ----------------
    client-158[~]13:14:49$ php < foo.php
    Barlol
    Warning: require(Bar.php): failed to open stream: No such file or
    directory in - on line 6

    Fatal error: require(): Failed opening required 'Bar.php'
    (include_path='.:/usr/share/php:/usr/share/pear') in - on line 6



    Actual result:
    --------------
    client-158[~]13:14:54$ php -a < foo.php
    Interactive mode enabled


    Fatal error: Class 'Bar' not found in - on line 9

    --
    Edit bug report at [url]http://bugs.php.net/?id=40775&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40775&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40775&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40775&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40775&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=40775&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=40775&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40775&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=40775&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=40775&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=40775&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=40775&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=40775&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=40775&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40775&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=40775&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=40775&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40775&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=40775&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40775&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40775&r=mysqlcfg[/url]
    seanius at debian dot org Guest

  2. Similar Questions and Discussions

    1. [PHP-DEV] __autoload() lowercase
      We run into a problem, when tryng to organize class files since autoload always uses lowercase. My class file, for example, is named...
    2. [PHP-DEV] __autoload & exceptions
      Marcus- Here are just some interesting observations with __autoload() and exceptions: Currently, an empty php file with just "throw new...
    3. interactive mode post
      Is there a way to simulate "POST mode user input" while running PHP from the command line or in interactive mode? For example with python, you can...
    4. #24922 [Ver->Csd]: php CLI gets a segmentation fault in interactive mode with a simple foreach
      ID: 24922 Updated by: helly@php.net Reported By: llucax@php.net -Status: Verified +Status: Closed...
    5. #24922 [NEW]: php CLI gets a segmentation fault in interactive mode with a simple foreach
      From: llucax@php.net Operating system: Linux 2.4.21 (debian sid) PHP version: 5.0.0b1 (beta1) PHP Bug Type: Reproducible...
  3. #2

    Default #40775 [Opn->Asn]: __autoload not invoked in cli interactive mode?

    ID: 40775
    Updated by: [email]tony2001@php.net[/email]
    Reported By: seanius at debian dot org
    -Status: Open
    +Status: Assigned
    Bug Type: Scripting Engine problem
    Operating System: Debian GNU/Linux
    PHP Version: 5.2.1
    -Assigned To:
    +Assigned To: tony2001


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

    [2007-03-11 12:20:45] seanius at debian dot org

    Description:
    ------------
    the __autoload hook doesn't seem to be run for the cmdline/cgi versions
    of php when invoked in "interactive" (-a) mode.

    originally reported at [url]http://bugs.debian.org/406264[/url]

    Reproduce code:
    ---------------
    <?php
    function __autoload($class)
    {
    echo $class;// should output class name
    echo 'lol';// should at least print it if it comes into function body
    require($class . '.php');// should break script because of missing
    file
    }
    // but it will just cause fatal error about missing class :|
    $foo = new Bar(); ?>

    Expected result:
    ----------------
    client-158[~]13:14:49$ php < foo.php
    Barlol
    Warning: require(Bar.php): failed to open stream: No such file or
    directory in - on line 6

    Fatal error: require(): Failed opening required 'Bar.php'
    (include_path='.:/usr/share/php:/usr/share/pear') in - on line 6



    Actual result:
    --------------
    client-158[~]13:14:54$ php -a < foo.php
    Interactive mode enabled


    Fatal error: Class 'Bar' not found in - on line 9


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40775&edit=1[/url]
    tony2001@php.net Guest

Posting Permissions

  • You may not post new threads
  • You may 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