Commit graph

853 commits

Author SHA1 Message Date
Gina Peter Banyard
fa81a23138 ext/exif: Remove bool type coercions in tests 2025-06-21 22:19:28 +02:00
acc987
bd4333447e
Add OffsetTime* Exif tags
Closes GH-18237.
2025-04-07 18:47:06 +02:00
Gina Peter Banyard
50b976d716 ext/exif: Refactor implementation of exif_scan_FILE_header() 2025-03-28 18:39:15 +00:00
Gina Peter Banyard
aa92c70134 ext/exif: Reduce scope of variable 2025-03-28 18:39:15 +00:00
Gina Peter Banyard
64569d3b8a ext/exif: Add some const qualifiers 2025-03-28 18:39:15 +00:00
Gina Peter Banyard
96d41a67c5 ext/exif: Remove useless char* cast 2025-03-28 18:39:15 +00:00
Gina Peter Banyard
a04a5dbfb1 ext/exif: Use zend_str_has_nul_byte() API 2025-03-28 18:39:15 +00:00
Gina Peter Banyard
fbc84dd056 ext/exif: Voidify exif_discard_imageinfo()
This always returned true, and the return value was never checked anyway
2025-03-28 18:39:15 +00:00
Gina Peter Banyard
8a713c1e90 ext/exif: Voidify exif_file_sections_free()
This always returned true, and the return value was never checked anyway
2025-03-28 18:39:15 +00:00
DanielEScherzer
aeb2d5cfa6
ext/[ef]*: fix a bunch of typos (GH-16621) 2024-10-28 11:28:32 +01:00
Niels Dossche
41c55d18f5
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16409: Segfault in exif_thumbnail when not dealing with a real file
2024-10-13 21:13:12 +02:00
Niels Dossche
63c9d12a1e
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16409: Segfault in exif_thumbnail when not dealing with a real file
2024-10-13 21:13:06 +02:00
Niels Dossche
34e635f366
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16409: Segfault in exif_thumbnail when not dealing with a real file
2024-10-13 21:12:46 +02:00
Niels Dossche
3843f0ecfe
Fix GH-16409: Segfault in exif_thumbnail when not dealing with a real file
Closes GH-16416.
2024-10-13 21:12:17 +02:00
Gina Peter Banyard
291eef285c
ext/exif: Minor refactoring of exif_thumbnail() (#16111) 2024-09-29 15:57:04 +01:00
Peter Kokot
9ee9c0e674
Sync exif dependency on mbstring extension as optional (#16062)
When decoding multibyte data in EXIF tags, the mbstring extension needs
to be enabled. In Autotools this is now synced with ZEND_MOD_OPTIONAL
in the C code, and on Windows it is now also optional.

The required dependency on mbstring extension was removed via
755c2cd0d8 which made the mbstring
extension optional dependency.
2024-09-26 09:53:58 +02:00
Gina Peter Bnayard
5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
e7c4d54d65 Use new helper function for "cannot be empty" ValueErrors 2024-08-21 21:12:17 +01:00
Peter Kokot
f66feaec0f
Sync HAVE_<extension> help texts (#15167)
This syncs all help texts of extension preprocessor macros to the same
style "Define to 1 if the PHP extension '<ext>' is available.".
[skip ci]
2024-08-02 01:41:47 +02:00
Peter Kokot
1ceadaed52
Autotools: Normalize and quote all PHP_NEW_EXTENSION arguments (#15144)
This adds Autoconf quote characters to all PHP_NEW_EXTENSION arguments
and syncs the CS across the php-src Autotools build system.
2024-07-29 00:14:59 +02:00
Arnaud Le Blanc
11accb5cdf
Preferably include from build dir (#13516)
* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

    -I$(top_builddir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/main
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM
    -I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

    -I$(top_builddir)/main
    -I$(top_builddir)
    -I$(top_srcdir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
2024-06-26 00:26:43 +02:00
Gina Peter Banyard
fd2d869642
Clean-up some more headers (#14416)
Remove unused headers (such as php_ini.h for extensions that don't define INI settings)
Use more specific headers when possible
2024-06-08 17:15:36 +01:00
Gina Peter Banyard
192fad713e ext/exif: Fix some [-Wsign-compare] warnings 2024-06-06 16:18:23 +01:00
David CARLIER
1e2306b4c6
ext/exif: moving few instances from memmove to memcpy. (#14400) 2024-06-01 13:05:49 +01:00
Niels Dossche
e6abca4d24
Use helper macro in ext/exif (#14352) 2024-05-29 17:48:43 +02:00
Máté Kocsis
10957e498c
Do not generate frameless info items when func info generation is disabled
While here, I fixed newlines around arginfo and function entry generation. Previously, newlines were repeated.
2024-02-18 11:39:00 +01:00
Niels Dossche
c83632a503 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Use __DIR__-relative path in tests
  Fix GH-12675: MEMORY_LEAK in phpdbg_prompt.c
2023-11-15 22:00:44 +01:00
Niels Dossche
f320c3561e Use __DIR__-relative path in tests
Otherwise we can't run them from another directory, they'll fail
instead.
2023-11-15 22:00:04 +01:00
Cristian Rodríguez
782ffd761b
Use a single version of strnlen (#12015)
* Zend: Make zend_strnlen available for use outside zend_compile

* exif: remove local php_strnlen, use zend_strnlen instead

* main: remove local strnlen, use zend_strnlen instead

* phar: remove local strnlen, use zend_strnlen
2023-08-22 17:40:24 +02:00
nielsdos
2fa8473eca Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-10834: exif_read_data() cannot read smaller stream wrapper chunk sizes
2023-05-12 23:42:54 +02:00
nielsdos
d369a7764f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10834: exif_read_data() cannot read smaller stream wrapper chunk sizes
2023-05-12 23:40:54 +02:00
Niels Dossche
7b768485f3 Fix GH-10834: exif_read_data() cannot read smaller stream wrapper chunk sizes
php_stream_read() may return less than the requested amount of bytes by
design. This patch introduces a static function for exif which reads
from the stream in a loop until all the requested bytes are read.

For the test: Co-authored-by: dotpointer

Closes GH-10924.
2023-05-12 23:37:00 +02:00
Niels Dossche
ebf86d284e Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-9397: exif read : warnings and errors : Potentially invalid endianess, Illegal IFD size and Undefined index
2023-04-05 21:41:41 +02:00
Niels Dossche
2d2cf3b6e0 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-9397: exif read : warnings and errors : Potentially invalid endianess, Illegal IFD size and Undefined index
2023-04-05 21:37:48 +02:00
Niels Dossche
b81ce297a1 Fix GH-9397: exif read : warnings and errors : Potentially invalid endianess, Illegal IFD size and Undefined index
Don't misinterpret DJI info maker note as DJI maker note.

The DJI and DJI info maker note both share the "DJI" make string.
This caused the current code to try to interpret the DJI info maker note
as a DJI maker note. However, the DJI info maker note requires custom
parsing. Therefore, the misinterpretation actually caused the current
code to believe that there was an unrecoverable error in the IFD for the
maker note by returning false in the maker note parser. This in turn
caused the inability to parse other EXIF metadata.

This patch adds the identification of the DJI info maker note so that it
cannot be misinterpreted. Since we don't implement custom parsing, it
achieves this by setting the tag list to a special marker value (in this
case the NULL pointer). When this marker value is detected, the function
will just skip parsing the maker note and return true. Therefore, the
other code will believe that the IFD is not corrupt.

This approach is similar to handing an unrecognised maker note type
(see the loop on top of exif_process_IFD_in_MAKERNOTE() which also
returns true and treats it as a string). The end result of this patch
is that the DJI info maker note is considered as unknown to the caller of
exif_process_IFD_in_MAKERNOTE(), and therefore that the other EXIF
metadata can be parsed successfully.

Also fix debug output typos in exif.

Closes GH-10470.
2023-04-05 21:35:19 +02:00
George Peter Banyard
f13d541ca6
Fix GCC 12 compiler warnings (#10713)
* Fix -Wunused-but-set-variable compiler warning in ext/mysqli

* Fix -Wstrict-prototypes compiler warning in ext/mysqlnd

* Fix -Wstrict-prototypes compiler warning in ext/soap

* Fix -Wunused-but-set-variable compiler warning in ext/exif

However, this code looks really sketchy...

* Fix -Wstrict-prototypes compiler warning in ext/openssl

* Fix -Wstrict-prototypes compiler warning in ext/dba

Add void to our bundled libraries

* Refactor bundled BCMath library

Fix -Wdeprecated-non-prototype compiler warnings
Use bool instead of char/int
Cleanup some useless header includes
2023-02-28 14:21:01 +00:00
rj1
d2cdfdbe44
fixed some misspellings (#10503) 2023-02-04 07:03:10 +00:00
Max Kellermann
d3facbe283
Mark globals as const (#10303)
This moves them from ``.data`` to ``.rodata`` and allows more compiler optimizations.

* ext/opcache/zend_accelerator_hash: make prime_numbers const

* Zend/zend_signal: make zend_sigs const

* ext/dba: make dba_handler pointers const

* ext/exif: make php_tiff_bytes_per_format and other globals const

* ext/intl/grapheme: make grapheme_extract_iters const

* ext/mstring: make rare_codepoint_bitvec const

* ext/snmp: make objid_mib const

* ext/opcache: make all zend_shared_memory_handlers const
2023-01-23 13:46:58 +00:00
David Carlier
1ab5d35bde exif add simple assert into jpeg header parsing as safety net more in a context of a possible text change. follow-up on GH-10402.
Close GH-10416.
2023-01-23 12:14:22 +00:00
Niels Dossche
f4dd35ea53 Remove duplicated length check in exif and
remove always false condition from exif

The latter condition will never trigger because otherwise the do-while loop
wouldn't have exited.

Close GH-10402
2023-01-22 07:22:38 +00:00
Máté Kocsis
b4ec3e9bc0
Do not generate CONST_CS when registering constants (#9439) 2022-08-28 08:27:19 +02:00
Máté Kocsis
e328c68305
Rename @cname to @cvalue in stubs (#9043)
@cname currently refers to the constant name in C. However, it is not always a (constant) name, but sometimes a function invocation, so naming it as @cvalue would be more appropriate.
2022-07-19 15:11:42 +02:00
Pierrick Charron
6fd2b39397
Indent with TAB in .h files generated by gen_stub 2022-06-13 08:55:54 -04:00
Máté Kocsis
debd38f851 Add support for sensitive parameters in stubs 2022-06-04 18:15:05 +02:00
Máté Kocsis
bbc738e96b
Declare ext/exif constants in stubs (#8680) 2022-06-01 20:16:43 +02:00
George Peter Banyard
2ecd46f48f
Initialise zend_stat_t to fix MSAN build 2022-05-22 16:06:27 +01:00
Christoph M. Becker
c2ca9cd73f
Don't unnecessarily skip mb related tests
Apparently, these tests have been overlooked when we switched to using
the `--EXTENSIONS--` section.  That caused to skip these tests on
AppVeyor.

Closes GH-8504.
2022-05-06 15:48:21 +02:00
Nikita Popov
902d64390e Deprecate implicit dynamic properties
Writing to a proprety that hasn't been declared is deprecated,
unless the class uses the #[AllowDynamicProperties] attribute or
defines __get()/__set().

RFC: https://wiki.php.net/rfc/deprecate_dynamic_properties
2021-11-26 14:10:11 +01:00
Máté Kocsis
50f31829b1
Generate optimizer func info from stubs for a few extensions - part 2 (#7401)
ext/bcmath, ext/fileinfo, ext/filter, ext/gettext, ext/session
2021-08-25 15:29:46 +02:00
Patrick Allaert
ac18dd0dc7 Prefer EXPECT over EXPECTF 2021-06-29 17:13:02 +02:00