Hi,
Can this snippet of shebang checking be removed for php 5.3.+, 6?
Its for external FPM project.

cgi_main.c:
        php_fopen_primary_script(&file_handle TSRMLS_CC);

                if (CGIG(check_shebang_line) && file_handle.handle.fp &&
(file_handle.handle.fp != stdin)) {
                        /* #!php support */
                        c = fgetc(file_handle.handle.fp);  /* <------- SEGFAULT 
*/
                        if (c == '#') {
                                while (c != '\n' && c != '\r' && c != EOF) {
                                        c = fgetc(file_handle.handle.fp);       
/* skip to end of line */
                                }
                                /* handle situations where line is terminated 
by \r\n */
                                if (c == '\r') {
                                        if (fgetc(file_handle.handle.fp) != 
'\n') {
                                                long pos = 
ftell(file_handle.handle.fp);
                                                fseek(file_handle.handle.fp, 
pos - 1, SEEK_SET);
                                        }
                                }
                                CG(start_lineno) = 2;
                        } else {
                                rewind(file_handle.handle.fp);
                        }
                }

        fpm_request_executing();
        php_execute_script(&file_handle TSRMLS_CC);


Reference:
http://marc.info/?l=php-internals&m=121759090811279&w=2


Many thanks in advance,

dreamcat4
dreamc...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to