{"id":20208192,"url":"https://github.com/cubiclesoft/php-short-open-tag-finder","last_synced_at":"2025-04-10T12:54:47.030Z","repository":{"id":145129712,"uuid":"181179432","full_name":"cubiclesoft/php-short-open-tag-finder","owner":"cubiclesoft","description":"Intelligent command-line tool to find software references to short open tags with an optional \"ask to replace\" mode.  Compatible with all versions of PHP, including PHP 8.","archived":false,"fork":false,"pushed_at":"2020-08-19T17:06:49.000Z","size":14,"stargazers_count":5,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T11:44:28.769Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cubiclesoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"support/cli.php","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-13T14:01:31.000Z","updated_at":"2025-01-09T16:08:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"4bc0a8c2-aa0c-4384-930d-8da8978a1973","html_url":"https://github.com/cubiclesoft/php-short-open-tag-finder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cubiclesoft%2Fphp-short-open-tag-finder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cubiclesoft%2Fphp-short-open-tag-finder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cubiclesoft%2Fphp-short-open-tag-finder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cubiclesoft%2Fphp-short-open-tag-finder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cubiclesoft","download_url":"https://codeload.github.com/cubiclesoft/php-short-open-tag-finder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248221594,"owners_count":21067582,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T05:34:29.784Z","updated_at":"2025-04-10T12:54:47.022Z","avatar_url":"https://github.com/cubiclesoft.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Short Open Tag Finder for PHP\n=============================\n\nAn intelligent command-line tool to find software references to short open tags with an optional \"ask to replace\" mode.  Compatible with PHP 5.4 and later, including PHP 8.\n\nPHP 7.4 deprecates short open tags and PHP 8 and later removes short open tag support altogether.\n\nIf you are scrambling around looking for a tool that aids in finding and replacing short open tags that also works with PHP 8 (e.g. you deployed PHP 8 without reading the changelog and therefore can't easily rollback to PHP 7) but doesn't just bulk update your files like a grep/sed solution would, then you've come to the right spot.\n\nThis tool has been successfully validated against 9.45 million lines of PHP code spanning 31,000+ files across multiple systems with a variety of mixed short open and regular tags in various configurations.  This tool utilizes the PHP `token_get_all()` function to correctly parse and make modifications against each document instead of incorrectly using regular expressions.  The tool is relatively short (~275 lines) and reasonably well-commented.\n\nFeatures\n--------\n\n* Finds files that use the PHP short open tag `\u003c?` and outputs the line number, the file, and the line itself.\n* When the `-ask` option is used, shows proposal replacement lines with normalized `\u003c?php` tags and asks whether or not to update the file with the list of changes.\n* Skips `\u003c?=`, `\u003c?xml`, and `\u003c?mso-`.\n* Scans alphanumerically!  (English only)\n* Has a liberal open source license.  MIT or LGPL, your choice.\n* Designed for relatively painless conversion of your project.\n* Sits on GitHub for all of that pull request and issue tracker goodness to easily submit changes and ideas respectively.\n\nGetting Started\n---------------\n\nDownload or clone the latest software release.\n\nRun it to get instructions/syntax:\n\n```\nphp find.php\n```\n\nWhich shows something like:\n\n```\nShort open tag finder for PHP\nPurpose:  Finds short open tag references in PHP files.\n          Works under PHP 8 w/ pull request #3975 (https://github.com/php/php-src/pull/3975).\n\nSyntax:  find.php [options] directory\nOptions:\n    -ask   Ask about the references that are found and modify the file only if the suggested changes are accepted.\n    -ext   Additional case-insensitive file extension to look for.  Default is 'php', 'php3', 'php4', 'php5', 'php7', and 'phtml'.\n\nExamples:\n    php find.php /var/www\n    php find.php -ext phpapp -ext html /var/www\n    php find.php -ask /var/www\n```\n\nThis tool, by default, will not make any changes unless directed to do so via the `-ask` option.  When the `-ask` option is used, it isn't a blunt instrument that indiscriminately changes files like some tools and the tool defaults to the safest option of not making any changes even in `-ask` mode.  Still, the `-ask` option is faster than manually editing each individual file yet allows for fairly refined control over each file's changes.  It'll take a couple of hours if you have a few thousand files to modify, but you remain in total control of each set of changes.\n\nIf you encounter a complex parsing test case that produces false positives/negatives with this tool in the wild, please submit an issue/pull request.\n\nAdditional Information\n----------------------\n\nFor the curious, here's how the removal of short open tag support went down:\n\nhttps://wiki.php.net/rfc/deprecate_php_short_tags\n\nNotably, almost everyone who said \"No\" has `php-src.git` rights (i.e. aka \"karma\", which allows them to commit changes that modify the core of PHP).  My ballpark estimate is that there's about a 50-50 split among the votes of those users who have `php-src.git` rights.  Also of note, Zeev Suraski and Rasmus Lerdorf, two of the original designers of PHP and current members of the [PHP Group](https://www.php.net/credits.php) voted \"No\" for the change.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcubiclesoft%2Fphp-short-open-tag-finder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcubiclesoft%2Fphp-short-open-tag-finder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcubiclesoft%2Fphp-short-open-tag-finder/lists"}