From:
Operating system: Windows 7 32-bit
PHP version: 5.4.1
Package: *Programming Data Structures
Bug Type: Bug
Bug description:Crashes on using variable equal to conditional shortcut
Description:
------------
I am using Apache 2.4 with PHP 5.4 on Windows 7 32bit. When executing the
code shown, from within a private class method, the server crashes. PHP is
compiled as a DSO. If the code is changed to utilize long form conditional
processing the execution works.
If I use the command line to execute the script, the class loaded by
require does not get called.
// my index.php
require("C:/Infinity/application/shared/classes/a.php");
$x = new a();
// my a.php
class a { __constructor(){ $this->import_variables($_POST); }}
further code in test script.
Test script:
---------------
# retrieve caller name
$calledby = debug_backtrace(); print_r($calledby);
// does not work
$caller = (strlen($calledby[1]['class'])) ? $calledby[1]['class'] :
$calledby[0]['class'];
// works and does does not segfault
if (strlen($calledby[1]['class'])) $caller = $calledby[1]['class'];
else $caller = $calledby[0]['class'];
# arguments are required
if (!func_num_args()) { return; }
# fill variables with argument contents if exists
$variables = (func_num_args() == 0) ? NULL : (is_array(func_get_arg(0)) ?
func_get_arg(0) : NULL);
Expected result:
----------------
I expect that Apache will not SEGFAULT
--
Edit bug report at https://bugs.php.net/bug.php?id=61925&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=61925&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=61925&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=61925&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=61925&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=61925&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=61925&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=61925&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=61925&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=61925&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=61925&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=61925&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=61925&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=61925&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=61925&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=61925&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61925&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=61925&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=61925&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=61925&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=61925&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=61925&r=mysqlcfg