Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ext/mysqli/tests/mysqli_fetch_field_types.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ require_once 'skipifconnectfailure.inc';
// MYSQLI_TYPE_GEOMETRY => array('GEOMETRY', 'TODO add testing'),
MYSQLI_TYPE_NEWDECIMAL => array('DECIMAL', '1.1'),
MYSQLI_TYPE_BIT => array('BIT', 0),
MYSQLI_TYPE_JSON => array('JSON', '[]'),
);

foreach ($datatypes as $php_type => $datatype) {
Expand Down
6 changes: 6 additions & 0 deletions ext/pdo_mysql/mysql_statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,12 @@ static char *type_to_name_native(int type) /* {{{ */
PDO_MYSQL_NATIVE_TYPE_NAME(DATE)
#ifdef FIELD_TYPE_NEWDATE
PDO_MYSQL_NATIVE_TYPE_NAME(NEWDATE)
#endif
#ifdef FIELD_TYPE_VECTOR
PDO_MYSQL_NATIVE_TYPE_NAME(VECTOR)
#endif
#ifdef FIELD_TYPE_JSON
PDO_MYSQL_NATIVE_TYPE_NAME(JSON)
#endif
PDO_MYSQL_NATIVE_TYPE_NAME(TIME)
PDO_MYSQL_NATIVE_TYPE_NAME(DATETIME)
Expand Down
32 changes: 32 additions & 0 deletions ext/pdo_mysql/tests/gh20122.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--TEST--
GH-20122 (getColumnMeta() for JSON-column in MySQL)
--EXTENSIONS--
pdo
pdo_mysql
--SKIPIF--
<?php
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
MySQLPDOTest::skip();
?>
--XFAIL--
--FILE--
<?php
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
$pdo = MySQLPDOTest::factory();

$db->exec('CREATE TABLE test (bar JSON)');
$db->exec('INSERT INTO test VALUES("[]")');

$stmt = $db->query('SELECT * from test');
$meta = $stmt->getColumnMeta(0);

// Note: JSON is an alias for LONGTEXT on MariaDB!
echo $meta['native_type'], "\n";
?>
--CLEAN--
<?php
require __DIR__ . '/mysql_pdo_test.inc';
MySQLPDOTest::dropTestTable();
?>
--EXPECTF--
%r(JSON|LONGTEXT)%r
50 changes: 28 additions & 22 deletions ext/phar/phar.c
Original file line number Diff line number Diff line change
Expand Up @@ -2453,42 +2453,48 @@ static int phar_flush_clean_deleted_apply(zval *zv) /* {{{ */

#include "stub.h" /* Generated phar_get_stub() function from makestub.php script */

zend_string *phar_create_default_stub(const char *index_php, const char *web_index, char **error) /* {{{ */
zend_string *phar_create_default_stub(const zend_string *php_index_str, const zend_string *web_index_str, char **error) /* {{{ */
{
size_t index_len, web_len;
const char *php_index;
const char *web_index;
size_t php_len, web_len;

if (error) {
*error = NULL;
}

if (!index_php) {
index_php = "index.php";
}

if (!web_index) {
web_index = "index.php";
}

index_len = strlen(index_php);
web_len = strlen(web_index);

if (index_len > 400) {
/* ridiculous size not allowed for index.php startup filename */
if (error) {
spprintf(error, 0, "Illegal filename passed in for stub creation, was %zd characters long, and only 400 or less is allowed", index_len);
if (!php_index_str) {
php_index = "index.php";
php_len = strlen("index.php");
} else {
php_index = ZSTR_VAL(php_index_str);
php_len = ZSTR_LEN(php_index_str);
if (php_len > 400) {
/* ridiculous size not allowed for index.php startup filename */
if (error) {
spprintf(error, 0, "Illegal filename passed in for stub creation, was %zd characters long, and only 400 or less is allowed", php_len);
}
return NULL;
}
}

if (web_len > 400) {
/* ridiculous size not allowed for index.php startup filename */
if (error) {
spprintf(error, 0, "Illegal web filename passed in for stub creation, was %zd characters long, and only 400 or less is allowed", web_len);
if (!web_index_str) {
web_index = "index.php";
web_len = strlen("index.php");
} else {
web_index = ZSTR_VAL(web_index_str);
web_len = ZSTR_LEN(web_index_str);

if (web_len > 400) {
/* ridiculous size not allowed for index.php startup filename */
if (error) {
spprintf(error, 0, "Illegal web filename passed in for stub creation, was %zd characters long, and only 400 or less is allowed", web_len);
}
return NULL;
}
}

return phar_get_stub(index_php, web_index, index_len+1, web_len+1);
return phar_get_stub(php_index, web_index, php_len+1, web_len+1);
}
/* }}} */

Expand Down
2 changes: 1 addition & 1 deletion ext/phar/phar_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ zend_result phar_verify_signature(php_stream *fp, size_t end_of_phar, uint32_t s
ZEND_ATTRIBUTE_NONNULL zend_result phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signature, size_t *signature_length, char **error);

/* utility functions */
zend_string *phar_create_default_stub(const char *index_php, const char *web_index, char **error);
zend_string *phar_create_default_stub(const zend_string *php_index_str, const zend_string *web_index_str, char **error);
const char *phar_decompress_filter(const phar_entry_info *entry, bool return_unknown);
const char *phar_compress_filter(const phar_entry_info *entry, bool return_unknown);

Expand Down
Loading