8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PHP7.0.0β3でscandirのバグが修正される

Posted at

これまでscandirにはバグがありました。

Windows環境下で、1ディレクトリに置いてあるファイル数が65535を越えると、scandir()で同じファイルが重複して出てきてしまうというものです。
こんなの気付く方もどうかしてる。

原因はREADDIR構造体のオフセットをshort型で定義していたからという、わりかし残念なものですが、
よく見てみたらこのバグが報告されたのは2006/02/11です。

で、2015/07/23に、超今さらPHP7にこの修正がマージされました
おそらくβ3でリリースされると思います。

修正方法は単にshort型をint型になおしただけという暴挙。
これじゃあファイル数が4294967295以上で同じバグが発生しちゃうぞ!
まあそのまえにWindowsが死ぬか。

というか何故こんな1行の修正で済むバグが9年間も埋もれてて、そして何故今さらのタイミングで修正されたのか、果てしなく謎だ。

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?