[PHP-BUG] Req #65858 [NEW]: json_encode could consider __get magic method
From: leonardo at ebussola dot com Operating system: all PHP version: Irrelevant Package: JSON related Bug Type: Feature/Change Request Bug description:json_encode could consider __get magic method Description: When I use json_encode on a class, this get the properties values directly and bypass the __get magic method. It would be great if I could control the properties with __get Test script: --- class Example { public foo; public function __construct() { $this->foo = 'bar; } public function __get($param) { return $this->$param . ' modified'; } } $foo = new Example(); echo json_encode($foo); Expected result: {"foo":"bar modified"} Actual result: -- {"foo":"bar"} -- Edit bug report at https://bugs.php.net/bug.php?id=65858&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65858&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=65858&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65858&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65858&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65858&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65858&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65858&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65858&r=oldversion Not developer issue:https://bugs.php.net/fix.php?id=65858&r=support Expected behavior: https://bugs.php.net/fix.php?id=65858&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65858&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65858&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65858&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65858&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65858&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65858&r=isapi Install GNU Sed:https://bugs.php.net/fix.php?id=65858&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65858&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65858&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65858&r=mysqlcfg
Bug #65822 [Csd]: crash on shutdown because of zend extension cleanup order
Edit report at https://bugs.php.net/bug.php?id=65822&edit=1 ID: 65822 User updated by:askalski at gmail dot com Reported by:askalski at gmail dot com Summary:crash on shutdown because of zend extension cleanup order Status: Closed Type: Bug Package:Reproducible crash Operating System: Linux PHP Version:5.4.20 Assigned To:laruence Block user comment: N Private report: N New Comment: Thanks; wasn't aware this had been fixed on APC trunk. Just noticed now that APC has been moved from subversion to git - this made my day. Unaware of the already-committed fixes, I had started on a parallel development path of configuration to disable opcode caching and interned strings. One thing I did in my version of the patch which you might consider: In PHP_MINIT_FUNCTION(apc), I have it call zend_get_extension("Zend OPcache") to see if opcache is loaded, and if so, force-disable opcode caching and interned strings. It's a minor convenience, but could help to avoid questions in the future. Previous Comments: [2013-10-08 11:20:31] larue...@php.net actually, this is a knew issue. and already be fixed both in opcache: https://github.com/php/php-src/commit/0aa342e903bf012efe03db1e9f1fe4ed54225e76 and apc: http://svn.php.net/viewvc?view=revision&revision=330859 please try with the latest snapshot [2013-10-07 18:30:24] askalski at gmail dot com Turns out it's not so simple. It never is... Modules need to be shutdown before the global function/class tables are destroyed. Extensions need to be shutdown after. Consequently there is no valid way to interleave extension and module shutdown. Because this issue likely stems from APC meddling with PHP internals in a manner in which modules were never intended to meddle, I see no real reason to act upon this ticket... with one exception: One thing that still ought to be fixed is zend_shutdown_extensions() should apply zend_extension_shutdown over the zend_extensions list in *reverse* order, not forward order. (This would involve adding a zend_llist_reverse_apply_* family of functions to zend_llist.c) [2013-10-03 16:00:22] askalski at gmail dot com Spent some time digging into this. It's not as simple as calling zend_shutdown_extensions before zend_destroy_modules; there are a few issues at play which complicate matters. The two Zend Extensions I investigated (OpCache and XDebug) implement both the zend_extension and zend_module API. Both of these extensions load the zend_module portion by calling zend_startup_module in the zend_extension startup function. Also, it is possible to load modules at runtime using the dl() userland function. Consequently, the shutdown order is not a simple matter of "extensions first, then modules". Because startup order of extensions and modules can be interleaved, this precise order must be recorded during initialization. The implementation might be something as simple as a stack of enumerated values: { MODULE, MODULE, MODULE, MODULE, EXTENSION, MODULE, EXTENSION, MODULE } [2013-10-02 22:09:12] askalski at gmail dot com Description: php_module_startup() initializes modules first, extensions second. However, zend_shutdown() destroys them in the same order (modules first, extensions second), rather than in stack order as one would expect. Furthermore, it seems (based on reading the zend_startup_extensions() zend_shutdown_extensions() functions) that if multiple zend extensions are loaded, they are destroyed in the wrong order as well. Multiple modules work fine; they are destroyed in stack order. To reproduce the issue, load an extension and module which both override the same Zend structure. For example, loading both OpCache 7.0.2 and APC 3.1.13 will cause a segfault on shutdown because of improper cleanup order of orig_interned_strings_start, old_interned_strings_start, and compiler_globals.interned_strings_start. I'm aware that the example sounds like a bizarre combination of modules and extensions here; I'm reporting the bug because it points at an issue in PHP itself. The specific use case for loading both APC and OpCache is to use OpCache for opcodes and APC with apc.cache_by_default=0 for the apc_store/apc_fetch userland functions. Test script: --- zend_extension=/usr/lib64/php/modules/opcache.so extension=apc.so Load both OpCache and APC in mod_php in Apache "prefork" mode. Send SIGTERM to one of the workers (or simply send enough requests to make Apache reap the worker), and watch for the Segmentation fault in Apache's error_log.
Bug #53467 [Com]: Phar cannot compress large archives
Edit report at https://bugs.php.net/bug.php?id=53467&edit=1 ID: 53467 Comment by: Tr at visPaul dot me Reported by:mep_eisen at web dot de Summary:Phar cannot compress large archives Status: Open Type: Bug Package:PHAR related Operating System: Windows 7 - 64 PHP Version:5.3.3 Block user comment: N Private report: N New Comment: I also am seeing this problem in Fedora 19 Php 5.5.1. I found 2 workarounds and I'm curious if they works for others: 1. Don't attempt to compress the Phar. The compression seems to be the root of the issue and throws an exception: "unable to create temporary file" 2. Bump the number of max files that you can open by editing /etc/security/limits.conf or similar. For whatever reason it seems that the Phar's compress method needs to open all of the files at once. Perhaps a Php Dev can shed some light on this and confirm/deny that it is a bug. Previous Comments: [2013-02-27 16:59:11] cicerc...@php.net Still present with PHP 5.4 as well (with Ubuntu 12.04). PHP 5.4.12-1~quantal+1 (cli) (built: Feb 25 2013 19:19:48) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans [2012-07-27 12:10:16] mep_eisen at web dot de This bug is still present. The workarounds on large phar files are resulting high cpu-load and packaging phar in more than 30 mins. [2011-09-05 06:15:37] d dot kreuer at kremedia dot de I have the same problem under Ubuntu 10.04.3 with PHP 5.3.5 PHP 5.3.5-1ubuntu7.2ppa1~lucid with Suhosin-Patch (cli) (built: May 7 2011 03:15:14) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with the ionCube PHP Loader v4.0.7, Copyright (c) 2002-2011, by ionCube Ltd. with Suhosin v0.9.29, Copyright (c) 2007, by SektionEins GmbH [2010-12-03 20:31:20] mep_eisen at web dot de Description: I tried to create a large phar (exactly 2347 files). However compressing the phar simply fails. That may be a similar problem as closed pecl bug: http://pecl.php.net/bugs/bug.php?id=13727 Smaller phars are working. If using the commented section (compress them by hand) it does work but this is really slow. Test script: --- startBuffering(); //$localDir = realpath('D:\\Dev\\ws\\mavenphp-flow3\\FLOW3\\target\\classes\\Packages\\This\\FLOW3'); //$iter = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(realpath('D:\\Dev\\ws\\mavenphp-flow3\\FLOW3\\target\\classes\\Packages\\This\\FLOW3'))); //foreach ($iter as $file) //{ // $pathName = $file->getPathname(); // $localName = substr($pathName, strlen($localDir)); // $phar->addFile($pathName, $localName); // echo "adding $localName".PHP_EOL; // $phar[$localName]->compress(Phar::GZ); //} $phar->buildFromIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator(realpath('D:\\Dev\\ws\\mavenphp-flow3\\FLOW3\\target\\classes\\Packages\\This\\FLOW3'))), realpath('D:\\Dev\\ws\\mavenphp-flow3\\FLOW3\\target\\classes\\Packages\\This\\FLOW3')); echo "packed ".$phar->count()." files".PHP_EOL; echo "compressing".PHP_EOL; $phar->compressFiles(Phar::GZ); $phar->setStub(''); $phar->stopBuffering(); Expected result: expected to get the phar. Actual result: -- BadMethodCallException: unable to create temporary file in D:\Dev\ws\mavenphp-fl ow3\FLOW3\target\packagePhar.php on line 20 Call Stack: 0.0011 332160 1. {main}() D:\Dev\ws\mavenphp-flow3\FLOW3\target\packag ePhar.php:0 5.15701068784 2. Phar->compressFiles() D:\Dev\ws\mavenphp-flow3\FLOW3\ target\packagePhar.php:20 -- Edit this bug report at https://bugs.php.net/bug.php?id=53467&edit=1
Req #53785 [Opn->Csd]: Way to query a X.509 certificate fingerprint
Edit report at https://bugs.php.net/bug.php?id=53785&edit=1 ID: 53785 Updated by: m...@php.net Reported by:BenBE at geshi dot org Summary:Way to query a X.509 certificate fingerprint -Status: Open +Status: Closed Type: Feature/Change Request Package:OpenSSL related Operating System: Debian PHP Version:5.3.5 -Assigned To: +Assigned To:mike Block user comment: N Private report: N New Comment: Feature by Tjerk Meesters in master. Previous Comments: [2012-01-27 09:29:41] msn at searchy dot nl The fingerprint is nothing more than the md5 or sha1 sum of the certificate. When you take ther certificate, strip it of the begin and end tag, base64 decode the content and md5 that, you'll get the fingerprint. Sample code: $newcert = preg_replace("/-BEGIN CERTIFICATE-|-END CERTIFICATE-/","",$cert); $b64 = base64_decode($newcert); echo "MD5 fingerprint: " . md5($b64) . "\n"; [2011-01-19 06:38:49] BenBE at geshi dot org Description: When reading a X.509 certificate file (or fetching the certificate from an SSL connection) there is no straight forward way to query the certificate's fingerprint as shown by browsers when viewing the site's certificate. The output of openssl_x509_parse doesn't contain the fingerprint while openssl_x509_export might contain it in a hard to parse string representation. -- Edit this bug report at https://bugs.php.net/bug.php?id=53785&edit=1
Bug #64101 [Com]: SoapClient weirdness when passed undefined connection_timeout
Edit report at https://bugs.php.net/bug.php?id=64101&edit=1 ID: 64101 Comment by: nampuom at gmail dot com Reported by:jeffdafoe at gmail dot com Summary:SoapClient weirdness when passed undefined connection_timeout Status: Open Type: Bug Package:SOAP related Operating System: CentOS linux, Debian stable PHP Version:5.3.21 Block user comment: N Private report: N New Comment: I confirm this bug. Linux CentOS PHP 5.4.20 affected Linux Fentoo PHP 5.3.18 also affected It was very hard to locate this bug. Also we see this behavior: If try access to sub-element of non-existent array, then parent array initialize to 0. Test script: -- #$_SESSION['application'] = array(); $_SESSION['application']['id'] = 123; Expected result: -- array( 'application'=>array('id'=>1) ) Actual result: -- array( 'application'=>0 ) Previous Comments: [2013-07-05 15:03:17] 2013 at birth-online dot de Here's an old bug report from the Ubuntu bugtracker from May 2012 and today we stumbled upon this bug again using PHP 5.3.10-1ubuntu3.6 (latest version for Ubuntu 12.04LTS): EXAMPLE CODE 'www.silversolutions.de', 'uri' => 'www.silversolutions.de', 'connection_timeout' => $timeout ) ); $header = array(); $header["header_general"]["order_type"] = "SHOP"; print_r( $header ); ?> COMMAND --- php -n test.php (NO CONFIG IS USED!!) ACTUAL OUTPUT - Array ( [header_general] => Array ( [order_type] => SHOP ) ) Warning: Cannot use a scalar value as an array in /home/mab/test.php on line 11 Array ( [header_general] => 0 ) EXPECTED OUTPUT --- Array ( [header_general] => Array ( [order_type] => SHOP ) ) Array ( [header_general] => Array ( [order_type] => SHOP ) ) This is on Linux johndoe 3.2.0-24-virtual #37-Ubuntu SMP Wed Apr 25 10:17:19 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux. and Linux johndoe 3.2.0-38-virtual #61-Ubuntu SMP Tue Feb 19 12:37:47 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux On a desktop machine with Linux johndoe 3.2.0-24-generic #38-Ubuntu SMP Tue May 1 16:18:50 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux it works as expected. [2013-01-29 21:00:24] jeffdafoe at gmail dot com Description: When SoapClient is passed an undefined variable in the connection_timeout hash key, it seems that all global variables are initialized to 0. I can reproduce this on multiple linux distributions and PHP versions. I can also repro it using any WSDL. It only happens when connection_timeout is set to an uninitialized variable, I am not able to reproduce it in any other case. I discovered it by accident but figured I'd report it due to the unusual and seemingly wide impact of the resultant behavior. Test script: --- $myi = null; print 'Before: myi->foo=' . $myi->foo . ' fakevar=' . $fakevar . ' fakeobj->prop=' . $fakeobj->prop . "\n"; $url = 'http://soap.amazon.com/schemas2/AmazonWebServices.wsdl'; $sc = new SoapClient($url, array( 'connection_timeout'=>$foo ) ); print 'After: myi->foo=' . $myi->foo . ' fakevar=' . $fakevar . ' fakeobj->prop=' . $fakeobj->prop . "\n"; Expected result: myi->foo= fakevar= fakeobj->prop= Actual result: -- myi->foo=0 fakevar=0 fakeobj->prop=0 -- Edit this bug report at https://bugs.php.net/bug.php?id=64101&edit=1
Bug #65729 [Opn->Csd]: CN_match gives false positive
Edit report at https://bugs.php.net/bug.php?id=65729&edit=1 ID: 65729 Updated by: m...@php.net Reported by:datib...@php.net Summary:CN_match gives false positive -Status: Open +Status: Closed Type: Bug Package:OpenSSL related Operating System: Linux PHP Version:master-Git-2013-09-21 (Git) -Assigned To: +Assigned To:mike Block user comment: N Private report: N New Comment: Merged. Previous Comments: [2013-09-21 08:27:27] datib...@php.net Description: When the CN_match option is used to verify "foo.test.com.sg" and the server certificate CN is "*.test.com" it will succeed erroneously. Test script: --- $context = stream_context_create(['ssl' => [ 'verify_peer' => true, 'allow_self_signed' => true, 'CN_match' => 'foo.test.com.sg', ]]); $s = file_get_contents($url, 'rt', $context); var_dump($s); Expected result: Warning: file_get_contents(): Peer certificate CN=`*.test.com' did not match expected CN=`foo.test.com.sg' in /path/to/script.php on line 12 Warning: file_get_contents(): Failed to enable crypto in /Users/tjerk/work/ssl/ssl.php on line 11 Warning: file_get_contents(https://localhost:4433): failed to open stream: operation failed in /path/to/script.php on line 11 bool(false) Actual result: -- No errors. -- Edit this bug report at https://bugs.php.net/bug.php?id=65729&edit=1
Bug #65845 [Com]: Error when Zend Opcache Optimizer is fully enabled
Edit report at https://bugs.php.net/bug.php?id=65845&edit=1 ID: 65845 Comment by: guy dot cesaro at gmail dot com Reported by:bruno+php at ahennezel dot info Summary:Error when Zend Opcache Optimizer is fully enabled Status: Feedback Type: Bug Package:opcache Operating System: Linux 3.11.2-1-ARCH PHP Version:5.5.4 Block user comment: N Private report: N New Comment: Hello Laruence, I've tried with php-cli (windows and ubuntu), the output is ok. Antoher try with : Apache/2.4.6 (Ubuntu) + PHP Version 5.5.4-1+debphp.org~raring+1 and the output is not ok. Can you please try the script with http server ? Previous Comments: [2013-10-08 11:05:44] larue...@php.net Please try using this snapshot: http://snaps.php.net/php5.5-latest.tar.gz For Windows: http://windows.php.net/snapshots/ please try with the latest snapshot of php5.5 in git [2013-10-08 11:02:28] larue...@php.net hmm, I run this with opcache enable, and fully optimizer. seems the output is expected? " $ php55 -d opcache.enable=1 -d opcache.optimization_level=0x /tmp/1.php This should echo empty string: This should echo "tutu" string: tutu " [2013-10-08 10:44:11] brunobergot at gmail dot com Me again, here is a last test script that work without changing opcache.optimization_level : APC BUG < // This should echo "tutu" string: >tutu< function table_valeur($table, $cle, $defaut='') { foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars'][$zzz=(string)'toto'] = 'tutu')."<"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<"; ?> [2013-10-08 10:30:33] brunobergot at gmail dot com Hi again Laruence, We found that the problem comes form the cast in $Pile['vars'][(string)'toto']. With this news test script it works as expected : APC BUG < // This should echo "tutu" string: >tutu< // Works as expected with opcache.optimization_level=0xffef in php.ini function table_valeur($table, $cle, $defaut='') { var_dump($table); var_dump($cle); var_dump($table[$cle]); foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars']['toto'] = 'tutu')."<"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<"; ?> [2013-10-08 10:17:30] brunobergot at gmail dot com Hi Laurence, Here is a script that show the bug in action : APC BUG < // This should echo "tutu" string: >tutu< // Works as expected with opcache.optimization_level=0xffef in php.ini function table_valeur($table, $cle, $defaut='') { foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars'][(string)'toto'] = 'tutu')."<"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<"; ?> The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=65845 -- Edit this bug report at https://bugs.php.net/bug.php?id=65845&edit=1
Bug #65776 [Opn]: Incorrect line endings causes segfault in convert.quoted-printable-encode
Edit report at https://bugs.php.net/bug.php?id=65776&edit=1 ID: 65776 Updated by: larue...@php.net Reported by:mrubinsk at horde dot org Summary:Incorrect line endings causes segfault in convert.quoted-printable-encode Status: Open Type: Bug Package:Streams related Operating System: OSX, Ubuntu PHP Version:5.4.20 -Assigned To: +Assigned To:moriyoshi Block user comment: N Private report: N New Comment: hey Moriyoshi: seems these codes are obviously wrong, if in_pp is null but the lb_ptr is smaller than lb_cnt, then it must segfault in the later "*in_pp"; php-5.4/ext/standard/filters.c:805 if ((in_pp == NULL || in_left_p == NULL) && (lb_ptr >=lb_cnt)) { return PHP_CONV_ERR_SUCCESS; } ps = (unsigned char *)(*in_pp); Previous Comments: [2013-09-27 18:50:58] mrubinsk at horde dot org Description: When using the convert.quoted-printable-encode stream filter, if the stream contains a single bare CR line ending at the end of the stream when line-break-chars is set to CRLF this can cause a segfault with certain values of line-length. Changing the line-length in the test script, or setting line-break-chars to "\r" prevents the segfault. Test script: --- $data = fopen('php://temp', 'r+'); fwrite($data, "test\r\ntest\r\n\r"); $stream = fopen("php://temp", 'r+'); stream_filter_append($stream, 'convert.quoted-printable-encode', STREAM_FILTER_WRITE, array('line-length' => 5, 'line-break-chars' => "\r\n")); rewind($data); stream_copy_to_stream($data, $stream); Expected result: The data should be copied from the $data stream to the $stream stream, applying the convert filter. Actual result: -- Segfault. -- Edit this bug report at https://bugs.php.net/bug.php?id=65776&edit=1
Bug #65822 [Opn->Csd]: crash on shutdown because of zend extension cleanup order
Edit report at https://bugs.php.net/bug.php?id=65822&edit=1 ID: 65822 Updated by: larue...@php.net Reported by:askalski at gmail dot com Summary:crash on shutdown because of zend extension cleanup order -Status: Open +Status: Closed Type: Bug Package:Reproducible crash Operating System: Linux PHP Version:5.4.20 -Assigned To: +Assigned To:laruence Block user comment: N Private report: N New Comment: actually, this is a knew issue. and already be fixed both in opcache: https://github.com/php/php-src/commit/0aa342e903bf012efe03db1e9f1fe4ed54225e76 and apc: http://svn.php.net/viewvc?view=revision&revision=330859 please try with the latest snapshot Previous Comments: [2013-10-07 18:30:24] askalski at gmail dot com Turns out it's not so simple. It never is... Modules need to be shutdown before the global function/class tables are destroyed. Extensions need to be shutdown after. Consequently there is no valid way to interleave extension and module shutdown. Because this issue likely stems from APC meddling with PHP internals in a manner in which modules were never intended to meddle, I see no real reason to act upon this ticket... with one exception: One thing that still ought to be fixed is zend_shutdown_extensions() should apply zend_extension_shutdown over the zend_extensions list in *reverse* order, not forward order. (This would involve adding a zend_llist_reverse_apply_* family of functions to zend_llist.c) [2013-10-03 16:00:22] askalski at gmail dot com Spent some time digging into this. It's not as simple as calling zend_shutdown_extensions before zend_destroy_modules; there are a few issues at play which complicate matters. The two Zend Extensions I investigated (OpCache and XDebug) implement both the zend_extension and zend_module API. Both of these extensions load the zend_module portion by calling zend_startup_module in the zend_extension startup function. Also, it is possible to load modules at runtime using the dl() userland function. Consequently, the shutdown order is not a simple matter of "extensions first, then modules". Because startup order of extensions and modules can be interleaved, this precise order must be recorded during initialization. The implementation might be something as simple as a stack of enumerated values: { MODULE, MODULE, MODULE, MODULE, EXTENSION, MODULE, EXTENSION, MODULE } [2013-10-02 22:09:12] askalski at gmail dot com Description: php_module_startup() initializes modules first, extensions second. However, zend_shutdown() destroys them in the same order (modules first, extensions second), rather than in stack order as one would expect. Furthermore, it seems (based on reading the zend_startup_extensions() zend_shutdown_extensions() functions) that if multiple zend extensions are loaded, they are destroyed in the wrong order as well. Multiple modules work fine; they are destroyed in stack order. To reproduce the issue, load an extension and module which both override the same Zend structure. For example, loading both OpCache 7.0.2 and APC 3.1.13 will cause a segfault on shutdown because of improper cleanup order of orig_interned_strings_start, old_interned_strings_start, and compiler_globals.interned_strings_start. I'm aware that the example sounds like a bizarre combination of modules and extensions here; I'm reporting the bug because it points at an issue in PHP itself. The specific use case for loading both APC and OpCache is to use OpCache for opcodes and APC with apc.cache_by_default=0 for the apc_store/apc_fetch userland functions. Test script: --- zend_extension=/usr/lib64/php/modules/opcache.so extension=apc.so Load both OpCache and APC in mod_php in Apache "prefork" mode. Send SIGTERM to one of the workers (or simply send enough requests to make Apache reap the worker), and watch for the Segmentation fault in Apache's error_log. Expected result: No crash. Actual result: -- Segmentation fault. -- Edit this bug report at https://bugs.php.net/bug.php?id=65822&edit=1
Bug #65845 [Fbk]: Error when Zend Opcache Optimizer is fully enabled
Edit report at https://bugs.php.net/bug.php?id=65845&edit=1 ID: 65845 Updated by: larue...@php.net Reported by:bruno+php at ahennezel dot info Summary:Error when Zend Opcache Optimizer is fully enabled Status: Feedback Type: Bug Package:opcache Operating System: Linux 3.11.2-1-ARCH PHP Version:5.5.4 Block user comment: N Private report: N New Comment: Please try using this snapshot: http://snaps.php.net/php5.5-latest.tar.gz For Windows: http://windows.php.net/snapshots/ please try with the latest snapshot of php5.5 in git Previous Comments: [2013-10-08 11:02:28] larue...@php.net hmm, I run this with opcache enable, and fully optimizer. seems the output is expected? " $ php55 -d opcache.enable=1 -d opcache.optimization_level=0x /tmp/1.php This should echo empty string: This should echo "tutu" string: tutu " [2013-10-08 10:44:11] brunobergot at gmail dot com Me again, here is a last test script that work without changing opcache.optimization_level : APC BUG < // This should echo "tutu" string: >tutu< function table_valeur($table, $cle, $defaut='') { foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars'][$zzz=(string)'toto'] = 'tutu')."<"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<"; ?> [2013-10-08 10:30:33] brunobergot at gmail dot com Hi again Laruence, We found that the problem comes form the cast in $Pile['vars'][(string)'toto']. With this news test script it works as expected : APC BUG < // This should echo "tutu" string: >tutu< // Works as expected with opcache.optimization_level=0xffef in php.ini function table_valeur($table, $cle, $defaut='') { var_dump($table); var_dump($cle); var_dump($table[$cle]); foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars']['toto'] = 'tutu')."<"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<"; ?> [2013-10-08 10:17:30] brunobergot at gmail dot com Hi Laurence, Here is a script that show the bug in action : APC BUG < // This should echo "tutu" string: >tutu< // Works as expected with opcache.optimization_level=0xffef in php.ini function table_valeur($table, $cle, $defaut='') { foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars'][(string)'toto'] = 'tutu')."<"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<"; ?> [2013-10-08 05:56:39] larue...@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with , is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. hmm, are you able to get the compiled SPIP view file? it must be a PHP script which can be used to reproduce this problem? The remainder of the comments for this report are too long. To view the r
Bug #65845 [Fbk]: Error when Zend Opcache Optimizer is fully enabled
Edit report at https://bugs.php.net/bug.php?id=65845&edit=1 ID: 65845 Updated by: larue...@php.net Reported by:bruno+php at ahennezel dot info Summary:Error when Zend Opcache Optimizer is fully enabled Status: Feedback Type: Bug Package:opcache Operating System: Linux 3.11.2-1-ARCH PHP Version:5.5.4 Block user comment: N Private report: N New Comment: hmm, I run this with opcache enable, and fully optimizer. seems the output is expected? " $ php55 -d opcache.enable=1 -d opcache.optimization_level=0x /tmp/1.php This should echo empty string: This should echo "tutu" string: tutu " Previous Comments: [2013-10-08 10:44:11] brunobergot at gmail dot com Me again, here is a last test script that work without changing opcache.optimization_level : APC BUG < // This should echo "tutu" string: >tutu< function table_valeur($table, $cle, $defaut='') { foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars'][$zzz=(string)'toto'] = 'tutu')."<"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<"; ?> [2013-10-08 10:30:33] brunobergot at gmail dot com Hi again Laruence, We found that the problem comes form the cast in $Pile['vars'][(string)'toto']. With this news test script it works as expected : APC BUG < // This should echo "tutu" string: >tutu< // Works as expected with opcache.optimization_level=0xffef in php.ini function table_valeur($table, $cle, $defaut='') { var_dump($table); var_dump($cle); var_dump($table[$cle]); foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars']['toto'] = 'tutu')."<"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<"; ?> [2013-10-08 10:17:30] brunobergot at gmail dot com Hi Laurence, Here is a script that show the bug in action : APC BUG < // This should echo "tutu" string: >tutu< // Works as expected with opcache.optimization_level=0xffef in php.ini function table_valeur($table, $cle, $defaut='') { foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars'][(string)'toto'] = 'tutu')."<"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<"; ?> [2013-10-08 05:56:39] larue...@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with , is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. hmm, are you able to get the compiled SPIP view file? it must be a PHP script which can be used to reproduce this problem? [2013-10-06 18:13:34] bruno+php at ahennezel dot info Wrong package : Opcache The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=65845 -- Edit this bug report at https://bugs.
Bug #65845 [Com]: Error when Zend Opcache Optimizer is fully enabled
Edit report at https://bugs.php.net/bug.php?id=65845&edit=1 ID: 65845 Comment by: brunobergot at gmail dot com Reported by:bruno+php at ahennezel dot info Summary:Error when Zend Opcache Optimizer is fully enabled Status: Feedback Type: Bug Package:opcache Operating System: Linux 3.11.2-1-ARCH PHP Version:5.5.4 Block user comment: N Private report: N New Comment: Me again, here is a last test script that work without changing opcache.optimization_level : APC BUG < // This should echo "tutu" string: >tutu< function table_valeur($table, $cle, $defaut='') { foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars'][$zzz=(string)'toto'] = 'tutu')."<"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<"; ?> Previous Comments: [2013-10-08 10:30:33] brunobergot at gmail dot com Hi again Laruence, We found that the problem comes form the cast in $Pile['vars'][(string)'toto']. With this news test script it works as expected : APC BUG < // This should echo "tutu" string: >tutu< // Works as expected with opcache.optimization_level=0xffef in php.ini function table_valeur($table, $cle, $defaut='') { var_dump($table); var_dump($cle); var_dump($table[$cle]); foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars']['toto'] = 'tutu')."<"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<"; ?> [2013-10-08 10:17:30] brunobergot at gmail dot com Hi Laurence, Here is a script that show the bug in action : APC BUG < // This should echo "tutu" string: >tutu< // Works as expected with opcache.optimization_level=0xffef in php.ini function table_valeur($table, $cle, $defaut='') { foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars'][(string)'toto'] = 'tutu')."<"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<"; ?> [2013-10-08 05:56:39] larue...@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with , is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. hmm, are you able to get the compiled SPIP view file? it must be a PHP script which can be used to reproduce this problem? [2013-10-06 18:13:34] bruno+php at ahennezel dot info Wrong package : Opcache [2013-10-06 18:10:34] bruno+php at ahennezel dot info Typo : With opcache.optimization_level=0xffef the result is "value". The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=65845 -- Edit this bug report at https://bugs.php.net/bug.php?id=65845&edit=1
Bug #65845 [Com]: Error when Zend Opcache Optimizer is fully enabled
Edit report at https://bugs.php.net/bug.php?id=65845&edit=1 ID: 65845 Comment by: brunobergot at gmail dot com Reported by:bruno+php at ahennezel dot info Summary:Error when Zend Opcache Optimizer is fully enabled Status: Feedback Type: Bug Package:opcache Operating System: Linux 3.11.2-1-ARCH PHP Version:5.5.4 Block user comment: N Private report: N New Comment: Hi again Laruence, We found that the problem comes form the cast in $Pile['vars'][(string)'toto']. With this news test script it works as expected : APC BUG < // This should echo "tutu" string: >tutu< // Works as expected with opcache.optimization_level=0xffef in php.ini function table_valeur($table, $cle, $defaut='') { var_dump($table); var_dump($cle); var_dump($table[$cle]); foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars']['toto'] = 'tutu')."<"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<"; ?> Previous Comments: [2013-10-08 10:17:30] brunobergot at gmail dot com Hi Laurence, Here is a script that show the bug in action : APC BUG < // This should echo "tutu" string: >tutu< // Works as expected with opcache.optimization_level=0xffef in php.ini function table_valeur($table, $cle, $defaut='') { foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars'][(string)'toto'] = 'tutu')."<"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<"; ?> [2013-10-08 05:56:39] larue...@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with , is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. hmm, are you able to get the compiled SPIP view file? it must be a PHP script which can be used to reproduce this problem? [2013-10-06 18:13:34] bruno+php at ahennezel dot info Wrong package : Opcache [2013-10-06 18:10:34] bruno+php at ahennezel dot info Typo : With opcache.optimization_level=0xffef the result is "value". [2013-10-06 11:38:42] bruno+php at ahennezel dot info Description: With the SPIP CMS V3, the default optimization level opcache.optimization_level=0x and opcache.optimization_level=0xffef give different results. Test script: --- I dont know how to test directly in PHP, but here is a very short SPIP snippet which brings out the problem. Put in the SPIP's sommaire.html skeleton : #SET{var,value} [(#GET{var})] With opcache.optimization_level=0x the result is empty. With opcache.optimization_level=0x the result is "value". Expected result: I expect the content "value" Actual result: -- The content is empty -- Edit this bug report at https://bugs.php.net/bug.php?id=65845&edit=1
Bug #65845 [Com]: Error when Zend Opcache Optimizer is fully enabled
Edit report at https://bugs.php.net/bug.php?id=65845&edit=1 ID: 65845 Comment by: brunobergot at gmail dot com Reported by:bruno+php at ahennezel dot info Summary:Error when Zend Opcache Optimizer is fully enabled Status: Feedback Type: Bug Package:opcache Operating System: Linux 3.11.2-1-ARCH PHP Version:5.5.4 Block user comment: N Private report: N New Comment: Hi Laurence, Here is a script that show the bug in action : APC BUG < // This should echo "tutu" string: >tutu< // Works as expected with opcache.optimization_level=0xffef in php.ini function table_valeur($table, $cle, $defaut='') { foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars'][(string)'toto'] = 'tutu')."<"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<"; ?> Previous Comments: [2013-10-08 05:56:39] larue...@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with , is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. hmm, are you able to get the compiled SPIP view file? it must be a PHP script which can be used to reproduce this problem? [2013-10-06 18:13:34] bruno+php at ahennezel dot info Wrong package : Opcache [2013-10-06 18:10:34] bruno+php at ahennezel dot info Typo : With opcache.optimization_level=0xffef the result is "value". [2013-10-06 11:38:42] bruno+php at ahennezel dot info Description: With the SPIP CMS V3, the default optimization level opcache.optimization_level=0x and opcache.optimization_level=0xffef give different results. Test script: --- I dont know how to test directly in PHP, but here is a very short SPIP snippet which brings out the problem. Put in the SPIP's sommaire.html skeleton : #SET{var,value} [(#GET{var})] With opcache.optimization_level=0x the result is empty. With opcache.optimization_level=0x the result is "value". Expected result: I expect the content "value" Actual result: -- The content is empty -- Edit this bug report at https://bugs.php.net/bug.php?id=65845&edit=1