Skip to content

Commit

Permalink
Fix count php 7.2 jpfuentes2#602
Browse files Browse the repository at this point in the history
  • Loading branch information
willy68 committed Mar 10, 2020
1 parent 4b07198 commit a1fdd82
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1673,8 +1673,8 @@ public static function find_by_pk($values, $options)
if ($results != ($expected = count($values)))
{
$class = get_called_class();
if (is_array($values))
$values = join(',',$values);

$values = join(',',$values);

if ($expected == 1)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/SQLBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public static function create_conditions_from_underscored_string(Connection $con
return null;

$parts = preg_split('/(_and_|_or_)/i',$name,-1,PREG_SPLIT_DELIM_CAPTURE);
$num_values = count($values);
$num_values = is_null($values) ? 0 : count($values);
$conditions = array('');

for ($i=0,$j=0,$n=count($parts); $i<$n; $i+=2,++$j)
Expand Down
2 changes: 2 additions & 0 deletions test/ModelCallbackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public function register_and_invoke_callbacks($callbacks, $return, $closure)

public function assert_fires($callbacks, $closure)
{
if (!is_array($callbacks))
$callbacks = array($callbacks);
$executed = $this->register_and_invoke_callbacks($callbacks,true,$closure);
$this->assert_equals(count($callbacks),count($executed));
}
Expand Down
4 changes: 2 additions & 2 deletions test/helpers/AdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,12 @@ public function test_tables()

public function test_query_column_info()
{
$this->assert_greater_than(0,count($this->conn->query_column_info("authors")));
$this->assert_greater_than(0,count((array) $this->conn->query_column_info("authors")));
}

public function test_query_table_info()
{
$this->assert_greater_than(0,count($this->conn->query_for_tables()));
$$this->assert_greater_than(0,count((array) $this->conn->query_for_tables()));
}

public function test_query_table_info_must_return_one_field()
Expand Down

0 comments on commit a1fdd82

Please sign in to comment.