Bug #69921 [NEW]: function_exists

From: Date: Wed, 24 Jun 2015 14:56:20 +0000
Subject: Bug #69921 [NEW]: function_exists
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193845@lists.php.net to get a copy of this message
From:             alan at aondra dot com
Operating system: Any
PHP version:      5.6.10
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:function_exists

Description:
------------
---
From manual page: http://www.php.net/function.function-exists
---

The function 'function_exists' does not execute in the order in which
the code is evaluated. Not only is this wrong, it allows for the
possibility that code could be executed in the incorrect scope.

I saw this note on the documentation:

"A function name may exist even if the function itself is unusable due
to configuration or compiling options (with the image functions being an
example)."

I looked and found no such configuration or compiling option that would
allow for this.

Test script:
---------------
<?php
    header('Content-Type: text/plain');

    $mystr = 'should not execute';

    if(function_exists('myfunc'))
        { myfunc($mystr); }

    $mystr = 'execute';

    function myfunc($str)
        { die($str); }

    myfunc($mystr);

Expected result:
----------------
execute

Actual result:
--------------
should not execute

-- 
Edit bug report at https://bugs.php.net/bug.php?id=69921&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=69921&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=69921&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=69921&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=69921&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=69921&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=69921&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=69921&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=69921&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=69921&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=69921&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=69921&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=69921&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=69921&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69921&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=69921&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=69921&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=69921&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69921&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=69921&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=69921&r=mysqlcfg



Thread (5 messages)

« previous php.bugs (#193845) next »