Skip to content

Conversation

@kingkero
Copy link
Contributor

@kingkero kingkero commented May 2, 2022

In all of the ZipArchive methods, the index is always described as int (see https://www.php.net/manual/en/class.ziparchive.php). Only for the replaceFile it is documented as string. However, actually passing a string will trigger (in PHP 8.1.5)

Fatal error: Uncaught TypeError: ZipArchive::replaceFile(): Argument #2 ($index) must be of type int, string given

TypeError: ZipArchive::replaceFile(): Argument #2 ($index) must be of type int, string given

The error also appears in other languages of the documentation. But replacefile.xml is only present in this repo. So I assume the other language docs will be automatically fixed after merging this?

@cmb69
Copy link
Member

cmb69 commented May 2, 2022

Oh, right, but we need to fix the stub first. Do you want to provide a PR for php-src? If so, you need to fix the stub, and then run php build/gen_stub.php ext/zip/php_zip.stub.php to regenerate php_zip_arginfo.h.

@kingkero kingkero changed the title Fix type for filepath in ZipArchive::replaceFile Fix type for index in ZipArchive::replaceFile May 2, 2022
@kingkero
Copy link
Contributor Author

kingkero commented May 2, 2022

@cmb69 Thanks for the info, created as php/php-src#8481

@cmb69
Copy link
Member

cmb69 commented May 2, 2022

Since the php-src PR has already been merged, I'm going to merge this as well. Thanks again!

@cmb69 cmb69 merged commit c1da6cc into php:master May 2, 2022
@kingkero kingkero deleted the fix-type-ziparchive-replaceFile branch May 2, 2022 12:56
tiffany-taylor pushed a commit to tiffany-taylor/doc-en that referenced this pull request Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants