Edit report at https://bugs.php.net/bug.php?id=52752&edit=1
ID: 52752 Updated by: a...@php.net Reported by: paulgao at yeah dot net Summary: Crash when lexing -Status: Open +Status: Duplicate Type: Bug Package: Scripting Engine problem Operating System: Centos 5 32bit PHP Version: 5.3SVN-2010-08-31 (SVN) Block user comment: N Private report: N New Comment: see bug #52752 Previous Comments: ------------------------------------------------------------------------ [2013-07-24 10:12:43] a...@php.net Related To: Bug #52752 ------------------------------------------------------------------------ [2013-07-24 09:53:58] a...@php.net Related To: Bug #64996 ------------------------------------------------------------------------ [2013-07-24 09:51:34] a...@php.net Related To: Bug #65312 ------------------------------------------------------------------------ [2012-12-28 19:06:18] jani dot ollikainen at mmd dot net Hi, After emailing to php-dev and fixing my code I've got rid of the error. Problem is that I've thought that PHP will handle concurrent stuff so I don't need to. My problem was having code that does something like this: fopen($fp,"file.php"); fputs($fp,"<?php /*code*/ ?>"); fclose($fp); And also in other parts of code to have: include("file.php"); Which caused sometimes the include have a broken file. I still think that crashing to broken file is not acceptable behavior, but I've understood that you can crash PHP by coding something wrong and PHP doesn't protect you or crash nicely. Which can be problem in hosted environment if not running basic PHP-CGI for every request. I think include/require documentation should have warning box saying something that you have to handle concurrent stuff and/or PHP can crash to broken PHP files without nice error. I think that might helped me. For the fix in my code was to change my writing to file: fopen($fp,"file.php.tmp.".getmypid()); fputs($fp,"<?php /*code*/ ?>"); fclose($fp); rename("file.php.tmp.".getmypid(),"file.php"); Pretty easy fix if you know that you have to do it or expect PHP to crash to broken files. Of course I can't say anything about the other crashes, but as the backtraces seem similar and the example code to used to crash PHP has similar problem might that help. ------------------------------------------------------------------------ [2012-12-19 13:17:52] jani dot ollikainen at mmd dot net Oh and here's the backtraces for the production enviroment using PHP 5.3.3, APC 3.1.13 on CentOS 6 (x86_64). Backtrace have two options but still problem seems to be the same: Core was generated by `/usr/bin/php-cgi'. Program terminated with signal 7, Bus error. #0 lex_scan (zendlval=0x7fff2f98cf48) at Zend/zend_language_scanner.c:931 931 if (yych != '<') goto yy4; (gdb) list 926 }; 927 928 YYDEBUG(0, *YYCURSOR); 929 YYFILL(8); 930 yych = *YYCURSOR; 931 if (yych != '<') goto yy4; 932 YYDEBUG(2, *YYCURSOR); 933 yyaccept = 0; 934 yych = *(YYMARKER = ++YYCURSOR); 935 if (yych <= '?') { (gdb) bt #0 lex_scan (zendlval=0x7fff901eca58) at Zend/zend_language_scanner.c:931 #1 0x000000000058deb0 in zendlex (zendlval=0x7fff901eca50) at /usr/src/debug/php-5.3.3/Zend/zend_compile.c:4942 #2 0x00000000005786f7 in zendparse () at /usr/src/debug/php-5.3.3/Zend/zend_language_parser.c:3282 #3 0x0000000000583342 in compile_file (file_handle=0x7fff901edfe0, type=<value optimized out>) at Zend/zend_language_scanner.l:354 #4 0x00007f413988da8f in my_compile_file (h=0x7fff901edfe0, type=2) at /usr/src/debug/php-pecl-apc-3.1.13/APC-3.1.13/apc_main.c:532 #5 0x00007f4134c64721 in phar_compile_file (file_handle=0x7fff901edfe0, type=2) at /usr/src/debug/php-5.3.3/ext/phar/phar.c:3393 #6 0x00000000005d8148 in ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER ( execute_data=0x1263560) at /usr/src/debug/php-5.3.3/Zend/zend_vm_execute.h:5179 #7 0x00000000005cc810 in execute (op_array=0x11f5ce0) at /usr/src/debug/php-5.3.3/Zend/zend_vm_execute.h:107 #8 0x00000000005a6f4d in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/src/debug/php-5.3.3/Zend/zend.c:1194 #9 0x00000000005551b8 in php_execute_script (primary_file=0x7fff901f07b0) at /usr/src/debug/php-5.3.3/main/main.c:2261 #10 0x000000000063081d in main (argc=1, argv=0x7fff901f29c8) at /usr/src/debug/php-5.3.3/sapi/cgi/cgi_main.c:2127 (gdb) bt #0 lex_scan (zendlval=0x7fffa8dc3898) at Zend/zend_language_scanner.c:931 #1 0x000000000058deb0 in zendlex (zendlval=0x7fffa8dc3890) at /usr/src/debug/php-5.3.3/Zend/zend_compile.c:4942 #2 0x00000000005786f7 in zendparse () at /usr/src/debug/php-5.3.3/Zend/zend_language_parser.c:3282 #3 0x0000000000583342 in compile_file (file_handle=0x7fffa8dc5340, type=<value optimized out>) at Zend/zend_language_scanner.l:354 #4 0x00007f55ee3c65b7 in apc_compile_cache_entry (key=0x7fffa8dc5170, h=0x7fffa8dc5340, type=2, t=<value optimized out>, op_array=0x7fffa8dc40b8, cache_entry=0x7fffa8dc40c0) at /usr/src/debug/php-pecl-apc-3.1.13/APC-3.1.13/apc_main.c:398 #5 0x00007f55ee3c6f9b in my_compile_file (h=0x7fffa8dc5340, type=2) at /usr/src/debug/php-pecl-apc-3.1.13/APC-3.1.13/apc_main.c:603 #6 0x00007f55e979d721 in phar_compile_file (file_handle=0x7fffa8dc5340, type=2) at /usr/src/debug/php-5.3.3/ext/phar/phar.c:3393 #7 0x00000000005d8148 in ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER ( execute_data=0x1e26370) at /usr/src/debug/php-5.3.3/Zend/zend_vm_execute.h:5179 #8 0x00000000005cc810 in execute (op_array=0x1d187e0) at /usr/src/debug/php-5.3.3/Zend/zend_vm_execute.h:107 #9 0x00000000005a6f4d in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/src/debug/php-5.3.3/Zend/zend.c:1194 #10 0x00000000005551b8 in php_execute_script (primary_file=0x7fffa8dc7b10) at /usr/src/debug/php-5.3.3/main/main.c:2261 #11 0x000000000063081d in main (argc=1, argv=0x7fffa8dc9d28) at /usr/src/debug/php-5.3.3/sapi/cgi/cgi_main.c:2127 ------------------------------------------------------------------------ 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=52752 -- Edit this bug report at https://bugs.php.net/bug.php?id=52752&edit=1